Azure / azure-iot-remote-monitoring

Azure IoT Remote Monitoring preconfigured solution
Other
249 stars 221 forks source link

Devices stuck in pending state #138

Closed kylecaulfield closed 8 years ago

kylecaulfield commented 8 years ago

Hi all -

Hoping this is something easy. My physical devices never get flipped to active status in the IoT Suite. The devices are connected and sending data to the IoThub, steam analytics is sending to both the event hub and storage account but my website never seems to pick up this information. Anything you can think of for me to check?

Thanks Kyle

jamesweb-ms commented 8 years ago

Are you sending a DeviceInfo message? @stevehob is working on a blog article that describes the whole requirements, but the are minimum DeviceInfo is:

{ "ObjectType": "DeviceInfo", "Version": "1.0", "DeviceProperties": { "DeviceID": "yourdeviceid", "DeviceState": "normal" }}

If you want the device to show on the map, include "Latitude": 47.696114,"Longitude": -122.024719 in the DeviceProperties section.

One note on Telemetry - If you are using Device SDK sample and deployed via AzureIotSuite.com, your telemetry will not display as I haven't updated the binaries for the case sensitive bug. Deploying via cmdline will get you that fix, plus Jeff's change yesterday for dynamic telemetry.

Here is complete DeviceInfo message body including new Telemetry from @princjef ... note it is optional, if not provided, it will default to double for unknown telemetry. If provided, it will parse based on type. DisplayName is optional as well and will use Name if not set. { "ObjectType": "DeviceInfo", "Version": "1.0", "IsSimulatedDevice": false, "DeviceProperties": { "DeviceID": "TestDev1", "HubEnabledState": true, "CreatedTime": 0, "DeviceState": "normal", "UpdatedTime": 0, "Manufacturer": "Microsoft", "ModelNumber": "424242", "SerialNumber": "434343434343", "FirmwareVersion": "1", "Platform": "Windows 10", "Processor": "Intel", "InstalledRAM": "32GB", "Latitude": 47.696114, "Longitude": -122.024719 }, "Commands": [ { "Name": "SetHumidity", "Parameters": [ { "Name": "humidity", "Type": "int" } ] }, { "Name": "SetTemperature", "Parameters": [ { "Name": "temperature", "Type": "int" } ] } ], "Telemetry": [ { "Name": "Temperature", "Type": "int", "DisplayName": "Thunderdome Arena Temperature" }, { "Name": "Humidity", "Type": "int" }, { "Name": "HeartRate", "Type": "int", "DisplayName": "Excitement level" } ] }

kylecaulfield commented 8 years ago

Looks correct, let me know what you think:

// Send device meta data var deviceMetaData = { 'ObjectType': 'DeviceInfo', 'IsSimulatedDevice': 'false', 'Version': '1.0', 'DeviceProperties': { 'DeviceID': deviceId, 'HubEnabledState': 'true', 'CreatedTime': '2015-09-21T20:28:55.5448990Z', 'DeviceState': 'normal', 'UpdatedTime': null, 'Manufacturer': 'Intel', 'ModelNumber': 'Edison', 'SerialNumber': '12345678', 'FirmwareVersion': '159', 'Platform': 'node.js', 'Processor': 'Intel', 'InstalledRAM': '64 MB', 'Latitude': 47.617025, 'Longitude': -122.191285 }, 'Commands': [{ 'Name': 'SetTemperature', 'Parameters': [{ 'Name': 'Temperature', 'Type': 'double' }] }, { 'Name': 'SetHumidity', 'Parameters': [{ 'Name': 'Humidity', 'Type': 'double' }] }] };

I deployed from command line but I changed some of the skus to make it fit into my msdn budget. Not too many changes on my end. I'm going to try to enable some logging and see what I come up with as well. Thanks!

jamesweb-ms commented 8 years ago

So are you still not seeing go active? Also if you forked, make sure you pull from master. I also updated the binaries, so AzureIotSuite.com now deploys the latest master with dynamic telemetry.

stevehob commented 8 years ago

We've got a published node.js sample that includes a full device info message which you can copy: https://github.com/Azure/azure-iot-sdks/blob/master/node/device/samples/remote_monitoring.js

kylecaulfield commented 8 years ago

Still not active with that configuration... Still digging logs. IoTHub sees it without issue. I am a few behind on my fork so I will pull now.

Steve - That is the node code I am running. I got the edison board at build this year and I am having a lot of fun with the tutorials in the starter kit.

I noticed in my docdb the hub enabled state is null - Do you know how this is updated?

{ "DeviceProperties": { "DeviceID": "Edison_groove", "HubEnabledState": null, "CreatedTime": "2016-04-07T03:00:21.7607781Z", "DeviceState": "normal", "UpdatedTime": null }, "SystemProperties": { "ICCID": null }, "Commands": [], "CommandHistory": [], "IsSimulatedDevice": false, "id": "2b35591a-9c43-445e-8b77-34937b76d1ac" }

kylecaulfield commented 8 years ago

Merging from the latest got me going, thanks for the help!