Software Archive
Read-only legacy content
17061 Discussions

Arduino IoTkitSimpleExample on Edison does not appear to send to dashboard

Chandler_H_
Beginner
597 Views

Greetings,

I have activated an Intel Edison with Arduino breakout board on the http://dashboard.us.enableiot.com site as well as registered a component with the catalog (ie: temp with temperature.v1.0)

This all works with the Galileo Gen1 with the Gen1 consistently uploading the values to the dashboard successfully.

Steps taken:

I loaded the Arduino IotKitSimpleExampleSendTemp sketch, the sketch appears to go in with a "Done Loading" and "Transfer Complete" like the Gen1 does.

On the Edison

1) issued iotkit-admin intialize

2014-12-15T21:06:45.701Z - info: Token file: /usr/share/iotkit-agent/certs/token.json

2014-12-15T21:06:45.736Z - info: Using data store: /usr/share/iotkit-agent/data/

2014-12-15T21:06:45.742Z - info: Initialized

2) issued iotkit-admin test

root@labgarage:/tmp# iotkit-admin test

2014-12-15T21:06:57.832Z - info: Trying to connect to host ...

2014-12-15T21:06:59.725Z - info: Connected to dashboard.us.enableiot.com

2014-12-15T21:06:59.729Z - info: Environment: prod

2014-12-15T21:06:59.731Z - info: Build: 0.11.2

3) issued iotkit-admin device-id and activate

root@labgarage:/tmp# iotkit-admin device-id

2014-12-15T21:07:19.432Z - info: Device ID: aa-2c-2b-97-14-60

root@labgarage:/tmp# iotkit-admin activate O3FGhqhH

2014-12-15T21:08:19.218Z - info: Activating ...

2014-12-15T21:08:20.506Z - info: Saving device token...

2014-12-15T21:08:20.519Z - info: Sending attributes...

4) issued iotkit-admin register temp temperature.v1.0

root@labgarage:/tmp# iotkit-admin register temp temperature.v1.0

2014-12-15T21:09:18.958Z - info: Starting registration ...

2014-12-15T21:09:19.076Z - info: Sending attributes...

Attributes sent

2014-12-15T21:09:21.912Z - info: Component registered name=temp, type=temperature.v1.0, cid=4cfd2491-f59f-43c6-8fce-95b98c75d845

root@labgarage:/tmp# tail -f agent.log

{"level":"info","message":"Using data store: /usr/share/iotkit-agent/data/","timestamp":"2014-12-15T21:06:45.739Z"}

{"level":"info","message":"Initialized","timestamp":"2014-12-15T21:06:45.743Z"}

{"level":"info","message":"Trying to connect to host ...","timestamp":"2014-12-15T21:06:57.849Z"}

{"level":"info","message":"Connected to dashboard.us.enableiot.com","timestamp":"2014-12-15T21:06:59.727Z"}

{"level":"info","message":"Device ID: aa-2c-2b-97-14-60","timestamp":"2014-12-15T21:07:19.450Z"}

{"level":"info","message":"Activating ...","timestamp":"2014-12-15T21:08:19.235Z"}

{"level":"info","message":"Saving device token...","timestamp":"2014-12-15T21:08:20.508Z"}

{"level":"info","message":"Sending attributes...","timestamp":"2014-12-15T21:08:20.520Z"}

{"level":"info","message":"Starting registration ...","timestamp":"2014-12-15T21:09:18.977Z"}

{"0":{"name":"temp","type":"temperature.v1.0","cid":"4cfd2491-f59f-43c6-8fce-95b98c75d845"},"level":"info","message":"Component registered","timestamp":"2014-12-15T21:09:21.916Z"}

The iotkit-agent never sends the value of "temp".

Thank you for any insight you may be able to provide.

 

0 Kudos
6 Replies
Chandler_H_
Beginner
597 Views

A quick add, I was able to send a manual "observation" using the component "temp" to "temperature.v1.0. 

root@labgarage:/tmp# iotkit-admin observation temp 110

2014-12-15T21:36:27.263Z - debug: Proxy Connector : rest  to be Set

2014-12-15T21:36:27.303Z - debug: Rest Proxy Created

2014-12-15T21:36:27.553Z - debug: Filename  /usr/share/iotkit-agent/certs/token.json  read  deviceToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJmY2NhMjUzMC1jOTNiLTQwMTgtYTQ4Yy0xODZjYzAyMmY1MGQiLCJpc3MiOiJodHRwOi8vZW5hYmxlaW90LmNvbSIsInN1YiI6ImFhLTJjLTJiLTk3LTE0LTYwIiwiZXhwIjoiMjAyNC0xMi0xMlQyMTowODoyMC40MjNaIn0.K8RRVR6MkDc00MDAkLCR-MxTQWt03ggKxeOtqvhJB49kfKJ4KOWhdrC51JB8onJgAFOilHluakqT1Px-0RlyEvaSqoXp0VkmCrO2bfXyp7TtYDIKRAuVfnGE4xs7bgdKV0yKkKtIjKJlMi15MwO4tzrd4hDCDfXPBttLKU8JFwyhHtceNjbUB9ikBptquEtTUuFrJAU214iDIU1PNO-MH3NOWVUDXQocJmwN2MFSs_YnaSwMaU2lAn_-iGjnbTxkX7OP0uLg7ke0qclZ97Awf2Ogg-_KYeLFGUd2qtZDA-duT10g7tdyLBFW3S36OmKxCi2lzBpIbDx5-sPAckmk8w, accountId=4b9ca90a-5cb1-4a35-b14b-f9c261c4cae6

2014-12-15T21:36:27.559Z - debug: Cloud Proxy Created with Cloud Handler  rest

2014-12-15T21:36:27.561Z - debug: Starting Activate Process function

2014-12-15T21:36:27.563Z - debug: The user is:  aa-2c-2b-97-14-60  and password  eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJmY2NhMjUzMC1jOTNiLTQwMTgtYTQ4Yy0xODZjYzAyMmY1MGQiLCJpc3MiOiJodHRwOi8vZW5hYmxlaW90LmNvbSIsInN1YiI6ImFhLTJjLTJiLTk3LTE0LTYwIiwiZXhwIjoiMjAyNC0xMi0xMlQyMTowODoyMC40MjNaIn0.K8RRVR6MkDc00MDAkLCR-MxTQWt03ggKxeOtqvhJB49kfKJ4KOWhdrC51JB8onJgAFOilHluakqT1Px-0RlyEvaSqoXp0VkmCrO2bfXyp7TtYDIKRAuVfnGE4xs7bgdKV0yKkKtIjKJlMi15MwO4tzrd4hDCDfXPBttLKU8JFwyhHtceNjbUB9ikBptquEtTUuFrJAU214iDIU1PNO-MH3NOWVUDXQocJmwN2MFSs_YnaSwMaU2lAn_-iGjnbTxkX7OP0uLg7ke0qclZ97Awf2Ogg-_KYeLFGUd2qtZDA-duT10g7tdyLBFW3S36OmKxCi2lzBpIbDx5-sPAckmk8w

2014-12-15T21:36:27.569Z - info: Sending attributes...

2014-12-15T21:36:27.571Z - debug: Attributes Registration : 

2014-12-15T21:36:27.572Z - debug: Attributes ,  deviceId=aa-2c-2b-97-14-60, deviceToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJmY2NhMjUzMC1jOTNiLTQwMTgtYTQ4Yy0xODZjYzAyMmY1MGQiLCJpc3MiOiJodHRwOi8vZW5hYmxlaW90LmNvbSIsInN1YiI6ImFhLTJjLTJiLTk3LTE0LTYwIiwiZXhwIjoiMjAyNC0xMi0xMlQyMTowODoyMC40MjNaIn0.K8RRVR6MkDc00MDAkLCR-MxTQWt03ggKxeOtqvhJB49kfKJ4KOWhdrC51JB8onJgAFOilHluakqT1Px-0RlyEvaSqoXp0VkmCrO2bfXyp7TtYDIKRAuVfnGE4xs7bgdKV0yKkKtIjKJlMi15MwO4tzrd4hDCDfXPBttLKU8JFwyhHtceNjbUB9ikBptquEtTUuFrJAU214iDIU1PNO-MH3NOWVUDXQocJmwN2MFSs_YnaSwMaU2lAn_-iGjnbTxkX7OP0uLg7ke0qclZ97Awf2Ogg-_KYeLFGUd2qtZDA-duT10g7tdyLBFW3S36OmKxCi2lzBpIbDx5-sPAckmk8w, agent_version=1.5.0, hardware_vendor=Genuine Intel(R) CPU   4000  @  500MHz, hardware_model=linux, Model Name=ia32, Firmware Version=3.10.17-poky-edison+, gatewayId=aa-2c-2b-97-14-60

2014-12-15T21:36:28.963Z - debug: attributes has returned from  rest

2014-12-15T21:36:28.970Z - debug: Filename  /usr/share/iotkit-agent/data/sensor-list.json  read  name=temp, type=temperature.v1.0, cid=4cfd2491-f59f-43c6-8fce-95b98c75d845

2014-12-15T21:36:28.989Z - info: Submitting:  n=temp, v=110

2014-12-15T21:36:28.995Z - debug: Metric doc: {"accountId":"4b9ca90a-5cb1-4a35-b14b-f9c261c4cae6","did":"aa-2c-2b-97-14-60","on":1418679388992,"count":1,"data":[{"on":1418679388992,"value":"110","cid":"4cfd2491-f59f-43c6-8fce-95b98c75d845"}],"gatewayId":"aa-2c-2b-97-14-60","deviceToken":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJmY2NhMjUzMC1jOTNiLTQwMTgtYTQ4Yy0xODZjYzAyMmY1MGQiLCJpc3MiOiJodHRwOi8vZW5hYmxlaW90LmNvbSIsInN1YiI6ImFhLTJjLTJiLTk3LTE0LTYwIiwiZXhwIjoiMjAyNC0xMi0xMlQyMTowODoyMC40MjNaIn0.K8RRVR6MkDc00MDAkLCR-MxTQWt03ggKxeOtqvhJB49kfKJ4KOWhdrC51JB8onJgAFOilHluakqT1Px-0RlyEvaSqoXp0VkmCrO2bfXyp7TtYDIKRAuVfnGE4xs7bgdKV0yKkKtIjKJlMi15MwO4tzrd4hDCDfXPBttLKU8JFwyhHtceNjbUB9ikBptquEtTUuFrJAU214iDIU1PNO-MH3NOWVUDXQocJmwN2MFSs_YnaSwMaU2lAn_-iGjnbTxkX7OP0uLg7ke0qclZ97Awf2Ogg-_KYeLFGUd2qtZDA-duT10g7tdyLBFW3S36OmKxCi2lzBpIbDx5-sPAckmk8w"}

2014-12-15T21:36:28.998Z - debug: Metric doc: {"accountId":"4b9ca90a-5cb1-4a35-b14b-f9c261c4cae6","did":"aa-2c-2b-97-14-60","on":1418679388992,"count":1,"data":[{"on":1418679388992,"value":"110","cid":"4cfd2491-f59f-43c6-8fce-95b98c75d845"}],"gatewayId":"aa-2c-2b-97-14-60","deviceToken":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJmY2NhMjUzMC1jOTNiLTQwMTgtYTQ4Yy0xODZjYzAyMmY1MGQiLCJpc3MiOiJodHRwOi8vZW5hYmxlaW90LmNvbSIsInN1YiI6ImFhLTJjLTJiLTk3LTE0LTYwIiwiZXhwIjoiMjAyNC0xMi0xMlQyMTowODoyMC40MjNaIn0.K8RRVR6MkDc00MDAkLCR-MxTQWt03ggKxeOtqvhJB49kfKJ4KOWhdrC51JB8onJgAFOilHluakqT1Px-0RlyEvaSqoXp0VkmCrO2bfXyp7TtYDIKRAuVfnGE4xs7bgdKV0yKkKtIjKJlMi15MwO4tzrd4hDCDfXPBttLKU8JFwyhHtceNjbUB9ikBptquEtTUuFrJAU214iDIU1PNO-MH3NOWVUDXQocJmwN2MFSs_YnaSwMaU2lAn_-iGjnbTxkX7OP0uLg7ke0qclZ97Awf2Ogg-_KYeLFGUd2qtZDA-duT10g7tdyLBFW3S36OmKxCi2lzBpIbDx5-sPAckmk8w"}

2014-12-15T21:36:29.006Z - debug: Metadata Device:  aa-2c-2b-97-14-60 Updated :  agent_version=1.5.0, hardware_vendor=Genuine Intel(R) CPU   4000  @  500MHz, hardware_model=linux, Model Name=ia32, Firmware Version=3.10.17-poky-edison+, created=1418677657734, components=[name=temp, type=temperature.v1.0, cid=4cfd2491-f59f-43c6-8fce-95b98c75d845], deviceId=aa-2c-2b-97-14-60, gatewayId=aa-2c-2b-97-14-60, name=aa-2c-2b-97-14-60, status=active

2014-12-15T21:36:30.123Z - debug: Response From data Submission from API

2014-12-15T21:36:30.126Z - info: Response received:  response=none detail, status=0

2014-12-15T21:36:30.130Z - info: Observation Sent response=none detail, status=0

0 Kudos
PeterKerney
Employee
597 Views

It could be that you are using "iotkit-admin register temp temperature.v1.0" and then "iotkit.send("temperature sensor", temp);" so the paramerters don't match. I looked back at your post and noticed you had the parameter correct.

OR

I am not sure is this is exactly your problem or not but I had a similar thing with the Python version at https://github.com/enableiot/iotkit-samples/blob/master/python/IoTkitSimpleExample.py

It tool me a little while (due to lack of good documentation) to realise that the way this all works is that you have an iot-agent that acts as a gateway for the observations from one-many iot-clients. When you look at the IoT solution architecture that we are delivering this makes perfect sense.

As I understand it, when you issue "iotkit-admin observation temp 110", this actually starts up an iot-agent on the localhost on behalf of the command, then sends the observation to the cloud and then shuts down the agent.

Therefore, if you want to send the observation to the cloud, you need the agent running separately and you send the observation to the host that the agent is running on (which may be localhost) as opposed to directly to the cloud.

When I did this with the Python version without the agent running and pointed directly to the cloud, the send observation function failed transparently. When I started the agent in the background and then left the code as localhost (127.0.0.1) UDP all worked fine.

Disclaimer: I am a "user" of the IoT-kit and am not involved in the actual IoT program so I am speaking from personal experience rather than actual knowledge/training.

0 Kudos
Chandler_H_
Beginner
597 Views

Hi Peter,

Thank you for the reply. I am finding that that Arduino IDE delivery of the sketch is broken. Something changed between the Gen1 and Gen2 as there are other issues I am seeing with IoTkit 1.1 too. The Galileo Gen2 console reports a segfault after upload of the sketch from Arduino IDE 1.5.3 (1.0.4).

Are you able to use the python version with the Arduino breakout board and shields? At this point I am open to other options.

Cheers,

Chandler

0 Kudos
PeterKerney
Employee
597 Views

Unfortunately I cannot comment on the Galileo issues you are facing. I am using Edison with the Arduino board and have the Python temperature update working with the code below (basically the same code from GitHub) from the shell when running the iot-agent on localhost as a daemon started from systemctld.

I have not used IoT dev kit from Arduino at all I might give that a try at some point. I am just starting to play with Python IoT and the dashboard. Not started on shields yet. I was planning on tackling mraa and SPI/I2C next in order to get my SSD1603 OLED display working.

#!/usr/bin/python

import os
import socket
import json
import time

HOST = "localhost"
PORT = 41234
INTERVAL = 60

def send_data(metric_name, value):
#    print "Sending data", metric_name, value
    msg = {
        "n": metric_name,
        "v": value
    }
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    sock.sendto(json.dumps(msg), (HOST, PORT))


def get_temp():
    temp = 0.1
    temp_src = "/sys/class/thermal/thermal_zone3/temp"
    if os.path.isfile(temp_src):
        try:
            f = open(temp_src)
            t = f.read()
            temp = int(float(t)) / 1000
        except IOError:
            pass
    return temp

next_send_time = 0
while True:
    t = time.time()
    if t > next_send_time:
        temp = get_temp()
        send_data("temp", temp)
        next_send_time = t + INTERVAL
    time.sleep(1)
 

 

0 Kudos
Rahul_S_
Beginner
597 Views

@ Chandler 

Have you tried starting the iotkit-agent?
Use root:~# systemctl start iotkit-agent

0 Kudos
Chandler_H_
Beginner
597 Views

@ Rahul,

I have started the iotkit-agent and it is running. I just never see any data passed from the arduino side to the agent and off to the dashboard.

Cheers

 

0 Kudos
Reply