Take a look at the code, next to the first include you’ll see:
#include <IoTkit.h> // include IoTkit.h to use the Intel IoT Kit
Have you included it? You can find IoTkit.h here iotkit-samples/IoTkit.h at master · enableiot/iotkit-samples · GitHub
Have you completed all prerequisites? Take a look at the note of the IotKitActuationExample.ino:
// 1. Device must be activated
// 2. Agent must be started and configured to use MQTT protocol
// 3. A component named "power" of the default type "powerswitch.v1.0" must be
// registered on the device. The default powerswitch.v1.0 component type has
// a command named "LED.v1.0"
//When executed from Control section on dashboard with value 0, LED light is turned off
//When executed from Control section on dashboard with value 1, LED light is turned on
//iotkit-agent must use MQTT connection (not REST) for actuation to work.
//It also sends 1 as power when agent is started.
Yes, I did it. The problem is in the aforementioned library
You could do this sketch in your machine ?
In addition to the error with iotkit.h now I realized that I have problem with MQTT. It is installed (: ~ # iotkit-admin protocol MQTT) ok. But the commands show that it does not appear:
root@edison:~# iotkit-admin move-data-directory ~/.data
2015-10-06T18:23:18.294Z - info: Data directory moved
root@edison:~# iotkit-admin protocol mqtt
2015-10-06T18:23:33.562Z - info: protocol set to: mqtt
root@edison:~# iotkit-admin -V
root@edison:~# npm info postinstall firstname.lastname@example.org
npm ERR! Error: getaddrinfo ESRCH
npm ERR! at errnoException (dns.js:37:11)
npm ERR! at Object.onanswer [as oncomplete] (dns.js:124:16)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Linux 3.10.17-poky-edison+
npm ERR! command "node" "/usr/bin/npm" "info" "postinstall" "email@example.com"
npm ERR! cwd /home/root
npm ERR! node -v v0.10.38
npm ERR! npm -v 1.4.28
npm ERR! syscall getaddrinfo
npm ERR! code ESRCH
npm ERR! errno ESRCH
npm ERR! Additional logging details can be found in:
npm ERR! /home/root/npm-debug.log
npm ERR! not ok code 0
root@edison:~# iotkit-admin catalog
2015-10-06T19:17:39.431Z - info: Getting Component Getting
2015-10-06T19:17:39.461Z - info: Trying with Secure Connection tobroker.us.enableiot.com:8883
2015-10-06T19:17:39.568Z - info: Waiting for MQTTConnector to connect # 1
2015-10-06T19:17:41.243Z - info: MQTTConnector: Connection successful to broker.us.enableiot.com:8883
2015-10-06T19:18:41.272Z - error: Connection to MQTT broker is closed. Retrying...
2015-10-06T19:18:43.734Z - info: Connection to MQTT broker established.
2015-10-06T19:19:43.755Z - error: Connection to MQTT broker is closed. Retrying...
2015-10-06T19:19:46.261Z - info: Connection to MQTT broker established.
2015-10-06T19:20:46.328Z - error: Connection to MQTT broker is closed. Retrying...
2015-10-06T19:20:49.003Z - info: Connection to MQTT broker established.
2015-10-06T19:21:49.239Z - error: Connection to MQTT broker is closed. Retrying...
I believe 1.7.0 is not the latest version available. Follow these instructions to update:
If you installed the Agent globally using NPM or if it came pre-installed
npm update -g iotkit-agent
If you installed locally using NPM
npm update iotkit-agent (from within your local node_modules directory)
If you initially installed locally using Git
git stash git pull npm -d install
After doing this run this command and let me know the output of iotkit-admin –V and iotkit-admin test
root@edison:~# iotkit-admin -V
root@edison:~# iotkit-admin test
2015-10-07T00:29:55.003Z - info: Trying to connect to host ...
2015-10-07T00:30:02.066Z - info: Connected to dashboard.us.enableiot.com
2015-10-07T00:30:02.070Z - info: Environment: prod
2015-10-07T00:30:02.072Z - info: Build: 0.14.3
2015-10-07T00:30:02.079Z - info: Trying to connect to WS server ...
2015-10-07T00:30:05.224Z - info: Connection to Web Socket Server successful
2015-10-07T00:30:05.463Z - info: Websocket connection closed. Reason: 1000 Normal connection closure
Now that you’ve upgraded to the latest version what error do you see in the Arduino IDE? Is your error still “fatal error: IoTkit.h: No such file or directory”?
How did you include the IoTkit library, what method did you follow? The first error is related to not installing the library correctly. In what folder did you include the IoTkit.h file and what other files did you include? The Iotkit library needs calls for other libraries to function correctly, how did you add these libraries?
I solved my problem when I downloaded iotkit-samples-master zip file and put folder iotkit.h folder in C:\Program Files (x86)\Arduino\libraries\IoTkit