1

Can any one suggest me how to receive Message/payload on RPI as device sent to Azure IoT Hub.

I am using SimulatedDevice.js and sending data with interval of every 5 seconds to Azure IoT Hub that data is going to store in Azure table storage from windows machine using NodeJS. Everything working Ok.

Now I want to receive complete message/payload from IoT Hub to RPI as device.

I have used sendcloudtodevicemessage.js as given example on Azure. I am able to recieve message only only once as below

[{"originalMessageId":"My Message ID","description":"Success","deviceGenerationId":"636341763976720081","deviceId":"testDevice","enqueuedTimeUtc":"2017-07-18T09:50:27.991313Z","statusCode":"Success"}]

But I want to recieve message on device each time.

Can any one help me for this?

Koby Douek
  • 16,156
  • 19
  • 74
  • 103
  • Exactly, this sample `sendcloudtodevicemessage.js` send **one** Cloud-To-Device message. If you run this sample one time you will receive only one message as expected. – Rita Han Jul 19 '17 at 07:13
  • But How to receive repeatedly/continue payload/message on device? I want to receive message in device whenever Azure Data store to Cloud. Can you suggest me ? – user8324594 Jul 19 '17 at 08:13
  • What's your os running on Raspberry Pi? – Rita Han Jul 19 '17 at 08:42
  • I am running simulatedDevice.js on windows which sends data to Azure IoT Hub when user enter any input from console or random message/payload with interval of 5 seconds. when I enter any input from cmd to simulatedDevice.js I am able to store that data in Azure Storage using functions. On other hand i have SendCloundToDevice.js in RPI So I want to receive the same message on RPI when user enter any input from windows. – user8324594 Jul 19 '17 at 09:11
  • Currently I am able to get only one message and how to get message payload because currently I am only getting message info not message data i mean payload which I had sent from SimulatedDevice.js. – user8324594 Jul 19 '17 at 09:11
  • You can get message payload(body) using [`msg.data`](https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-node-node-c2d#receive-messages-in-the-simulated-device-app). – Rita Han Jul 20 '17 at 01:03
  • but how to get continue data on RPI when user send a new data to Azure IoT hub each time from cmd? Can you please suggest me if possible? – user8324594 Jul 20 '17 at 10:51

0 Answers0