2 Replies Latest reply on Nov 24, 2014 3:05 PM by mhahn

    IoTKit activaction failed: "could not be updated  Unauthorized"

    Paul2

      Hey, we would like to connect Edison to the IoT Analytic Platform

       

      1) testing the connection

      root@edison:~# iotkit-admin test

      2014-09-25T12:42:12.961Z - info: Trying to connect to host ...

      2014-09-25T12:42:15.149Z - info: Connected to dashboard.us.enableiot.com

      2014-09-25T12:42:15.154Z - info: Environment: prod

      2014-09-25T12:42:15.156Z - info: Build: 0.9.1237.4

       

      2) reading the Device ID

      root@edison:~# iotkit-admin device-id

      2014-09-25T12:44:58.489Z - info: Device ID: XX-XX-XX-XX-XX-XX

       

      3) we add the Device ID in the IoT dashboard

       

      4) we are using the activation code given in "Account" => "Details" => "Activation code".

      root@edison:~# iotkit-admin activate ACTIVATION_CODE

      2014-09-25T12:38:42.025Z - info: Sending attributes...

      2014-09-25T12:38:44.406Z - error: Metadata Device :  XX-XX-XX-XX-XX-XX could not be updated  Unauthorized

       

      Any ideas whats wrong with this?

        • 1. Re: IoTKit activaction failed: "could not be updated  Unauthorized"
          mhahn

          haven't tried on Edison yet. But from my experience on Galileo:

          the cloud seems to be not completely stable yet. Possibly also still some work in progress.  I have seen similar issues a couple of times.

          That said:

          • is it a fresh installation? If not there might be some cached data which yields problems
          • you may try "iotkit-admin initialize && iotkit-admin reset-components", deleting the board in the cloud and start over again

           

          (e.g. right now I couldn't send data - also authorization refused; had to go over the steps above. But afterwards it's working fine again)

          • 2. Re: IoTKit activaction failed: "could not be updated  Unauthorized"
            mhahn

            Just tried on Edison

            # configure_edison --version
            68
            # iotkit-admin -V
            1.5.0
            
            
            
            

             

            activation worked fine - I did

            iotkit-admin initialize
            iotkit-admin reset-components
            id=$(iotkit-admin device-id | awk '{print $(NF)}')
            echo $id
            
            
            
            

             

            add device with the given ID, i.e. [$id below meaning value of that variable]

            ID = $id

            Gateway = $id

            Name = Edison

             

            activation code: goto "Account" -> "Activation Code"

             

            then with that code

            iotkit-admin activate <activation code>
            
            
            
            

             

            No issues with activation on my side

             

            Now the board should be displayed "active" on dashboard.us.enableiot.com.

            afterwards:

            systemctl enable iotkit-agent
            systemctl start iotkit-agent
            # systemctl status iotkit-agent
            ● iotkit-agent.service - iotkit-agent
               Loaded: loaded (/lib/systemd/system/iotkit-agent.service; enabled)
               Active: active (running) since Thu 2014-09-25 19:32:15 UTC; 22min ago
            Main PID: 343 (node)
               CGroup: /system.slice/iotkit-agent.service
                       └─343 node /usr/bin/iotkit-agent
            
            
            Sep 25 19:32:15 edison systemd[1]: Started iotkit-agent.
            Sep 25 19:32:17 edison iotkit-agent[343]: 2014-09-25T19:32:17.946Z - info: Sending attributes...
            Sep 25 19:32:19 edison iotkit-agent[343]: 2014-09-25T19:32:19.920Z - info: Starting listeners...
            Sep 25 19:32:20 edison iotkit-agent[343]: 2014-09-25T19:32:20.056Z - info: MQTT listener started on port:  1884
            Sep 25 19:32:20 edison iotkit-agent[343]: 2014-09-25T19:32:20.061Z - info: TCP listener started on port:   7070
            Sep 25 19:32:20 edison iotkit-agent[343]: 2014-09-25T19:32:20.067Z - info: UDP listener started on port:  41234
            
            
            
            

             

            I initially created the board with wrong device id. Activation worked as well but I couldn't register components and hence wasn't able to send data. Also got a message like "Authorization failed". After correct activation of the board registering components and sending data works fine - in the example belo

             

            # systemctl status iotkit-agent
            ● iotkit-agent.service - iotkit-agent
               Loaded: loaded (/lib/systemd/system/iotkit-agent.service; enabled)
               Active: active (running) since Thu 2014-09-25 19:32:15 UTC; 22min ago
            Main PID: 343 (node)
               CGroup: /system.slice/iotkit-agent.service
                       └─343 node /usr/bin/iotkit-agent
            
            
            Sep 25 19:32:15 edison systemd[1]: Started iotkit-agent.
            Sep 25 19:32:17 edison iotkit-agent[343]: 2014-09-25T19:32:17.946Z - info: Sending attributes...
            Sep 25 19:32:19 edison iotkit-agent[343]: 2014-09-25T19:32:19.920Z - info: Starting listeners...
            Sep 25 19:32:20 edison iotkit-agent[343]: 2014-09-25T19:32:20.056Z - info: MQTT listener started on port:  1884
            Sep 25 19:32:20 edison iotkit-agent[343]: 2014-09-25T19:32:20.061Z - info: TCP listener started on port:   7070
            Sep 25 19:32:20 edison iotkit-agent[343]: 2014-09-25T19:32:20.067Z - info: UDP listener started on port:  41234
            Sep 25 19:32:41 edison iotkit-agent[343]: Attributes sent
            Sep 25 19:32:57 edison iotkit-agent[343]: 2014-09-25T19:32:57.758Z - info: Submitting:  n=temp, v=45
            Sep 25 19:32:59 edison iotkit-agent[343]: 2014-09-25T19:32:59.466Z - info: Response received:  response=none detail, status=0
            
            
            
            

             

            "attributes sent" is the registration of the temperature.v1.0 component "temp" via iotkit-agent. Afterwards data (temp = 45) has been sent.

            Update: Note: in order to see the data sent in systemctl you'd have to send via iotkit-agent. Using "iotkit-admin observe" would bypass the agent and hence you wouldn't see data sent

             

            Data accessible ok in dashboard

             

            So in summary: works for me right now