Giter VIP home page Giter VIP logo

noderediothub's Introduction

@nodecolor/node-red-contrib-azure-iot-hub

Security patch and update for "node-red-contrib-azure-iot-hub" see https://github.com/lcarli/NodeRedIoTHub

node-red-contrib-azure-iot-hub is a Node-RED node that allows you to send messages and register devices with Azure IoT Hub. This is a fork from the original Node-RED example by the Azure IoT team found here.

It contains a total of four Node-RED cloud nodes: Azure IoT Hub, Azure IoT Registry, Azure IoT Hub Receiver and Azure IoT Hub Device Twin

Azure IoT Hub

This node allows you to send messages to your Azure IoT Hub. It has the following payload format:

{
  "deviceId": "testenode1",
  "key": "cw3nniq77BbjpOCDLqb7xEFTU509HeR6Ki1NwR20jj0=",
  "protocol": "amqp",
  "data": "{tem: 25, wind: 20}"
}
  • deviceId is your device's unique id.
  • key is your device's primary or secondary key.
  • protocol options are: amqp, amqpws, mqtt or http.
  • data can either be a plain string or string wrapped JSON.

Azure IoT Registry

This node allows you to registers devices with your Azure IoT Hub. It has the following payload format:

{
  "deviceId": "testenode1"
}

Azure IoT Hub Receiver

This is a simple node for receiving device-to-cloud messages via default Azure Events Hub endpoint. It does not require a payload.

Azure IoT Hub Device Twin

This is a simple node to retrieve Azure IoT Hub Device Twin(s). It has the following optional payload format:

"deviceId123"
  • The optional payload can be the device Id in string format
  • If this property type is not defined or is not a string, all Device Twins are retrieved
  • Each input will produce an output with either msg.error as error object or msg.payload as an array of Device Twin data.

Installation

npm install -g node-red-contrib-azure-iot-hub

How to Use

Node-RED Setup

Follow the instructions here to get Node-RED setup locally.

Register Azure IoT Hub Device

  1. Open Node-RED, usually: http://127.0.0.1:1880

  2. Go to Hamburger Menu -> Import -> Clipboard

  3. Paste the following code into the "Import nodes" dialog

    [{"id":"6a913d9a.fa0844","type":"azureiothubregistry","z":"e621cbfa.f8a5f8","name":"Azure IoT Hub Registry","x":630,"y":240,"wires":[["14a58301.e60a9d"]]},{"id":"2fd0a3f.969ce5c","type":"inject","z":"e621cbfa.f8a5f8","name":"Register Payload","topic":"","payload":"{\"deviceId\":\"device146\"}","payloadType":"json","repeat":"","crontab":"","once":false,"x":400,"y":240,"wires":[["6a913d9a.fa0844"]]},{"id":"14a58301.e60a9d","type":"debug","z":"e621cbfa.f8a5f8","name":"Log","active":true,"console":"false","complete":"true","x":910,"y":240,"wires":[]},{"id":"f775e252.a49f2","type":"debug","z":"e621cbfa.f8a5f8","name":"Log","active":true,"console":"false","complete":"true","x":910,"y":180,"wires":[]},{"id":"95789379.e44d2","type":"azureiothub","z":"e621cbfa.f8a5f8","name":"Azure IoT Hub","protocol":"http","x":600,"y":180,"wires":[["f775e252.a49f2"]]},{"id":"228b0f18.7799c","type":"inject","z":"e621cbfa.f8a5f8","name":"Send Payload","topic":"","payload":"{\"deviceId\":\"device146\",\"key\":\"FgySFuUzwtQMrlS29GRr7luoW07RNAmKcMy5oPDA8pA=\",\"protocol\":\"http\",\"data\":\"{tem: 25, wind: 20}\"}","payloadType":"json","repeat":"","crontab":"","once":false,"x":390,"y":180,"wires":[["95789379.e44d2"]]},{"id":"817f33a3.ddf5f","type":"azureiothubreceiver","z":"e621cbfa.f8a5f8","name":"Azure IoT Hub Receiver","x":620,"y":340,"wires":[["c2825fc8.d6323"]]},{"id":"723d625e.52eb7c","type":"azureiothubdevicetwin","z":"e621cbfa.f8a5f8","name":"Azure IoT Hub Device Twin","x":640,"y":440,"wires":[["5e9fec30.6a52f4"]]},{"id":"c2825fc8.d6323","type":"debug","z":"e621cbfa.f8a5f8","name":"Log","active":true,"console":"false","complete":"true","x":910,"y":340,"wires":[]},{"id":"5e9fec30.6a52f4","type":"debug","z":"e621cbfa.f8a5f8","name":"Log","active":true,"console":"false","complete":"true","x":910,"y":440,"wires":[]},{"id":"3afc72bf.5c112e","type":"inject","z":"e621cbfa.f8a5f8","name":"Send DeviceId","topic":"","payload":"device146","payloadType":"str","repeat":"","crontab":"","once":false,"x":400,"y":440,"wires":[["723d625e.52eb7c"]]}]
    
  4. Double-click the Register Payload node

  5. Enter your desired deviceId into the Payload field and click Done. Check "Inject once at start?" to register this device when you click Deploy.

  6. Double-click the Azure IoT Hub Registry node, enter your IoT Hub connection string and click Done.

  7. Click Deploy

  8. Click the square button on the left side of the Register Payload node.

  9. Click on the debug tab to your right and you'll see the device's primary and secondary keys.

Send Data to Azure IoT Hub

  1. Double-click on the Send Payload node and modify the JSON in the Payload field to contain your deviceId, key, protocol and data.

  2. Double-click the Azure IoT Hub node and enter your hostname and click Done.

  3. Click Deploy

  4. Click the square button on the left side of the Send Payload node.

  5. You should then see a Message sent debug message in the debug pane.

Reading all messages received into Azure IoT Hub

  1. Double-click on the Azure IoT Hub Receiver node and enter the connectionString for your Azure IoT Hub and click Done.

  2. Click Deploy

  3. You should see the below messages on your command line from where you are running NodeRED. The Azure IoT Hub Receiver node should now say 'Connected'.

  4. Once you have messages coming into your Azure IoT Hub, you should see them in the debug pane. The Azure IoT Hub Receiver node should now say 'Recieved'.

Retrieving the Device Twin information

  1. Double-click on the Send DeviceId node and modify the string in the Payload field to contain your deviceId and click Done. The input payload for Device Twin is optional and you can always delete this node to get Device Twin information for ALL your IoT devices.

  2. Double-click on the Azure IoT Hub Device Twin node and enter the connectionString for your Azure IoT Hub and click Done.

  3. Click Deploy

  4. Click the square button on the left side of the Send Payload node.

  5. You should then see a Device Twin information in the debug pane.

References

You can read more about Azure IoT Hub here.

noderediothub's People

Contributors

dependabot[bot] avatar jongio avatar kasarol avatar lcarli avatar marianraphael avatar rasavant-ms avatar sandro-k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

noderediothub's Issues

undefined key causes Node-RED crash

I'm coming across a situation where the node should report an error without crashing the entire Node-RED process:

TypeError: Cannot read property 'sendEvent' of undefined

This happens when I don't have a SharedKey defined for the connection and undefined gets passed to the node:

26 Dec 14:43:11 - [info] [azureiothub:Stream IoT Hub] Connected to Azure IoT Hub.
26 Dec 14:43:11 - [info] [azureiothub:Stream IoT Hub] Message is pending. Sending it to Azure IoT Hub.
26 Dec 14:43:11 - [info] [azureiothub:Stream IoT Hub] Sending Message to Azure IoT Hub :
   Payload: "{\"battery\":99,\"voltage\":3005,\"linkquality\":0,\"angle_x\":3,\"angle_y\":1,\"angle_z\":87,\"angle_x_absolute\":87,\"angle_y_absolute\":89,\"unknown_data\":3932160,\"action\":\"vibration\"}"
26 Dec 14:43:11 - [info] [filter:filter for STB IP] nr-regexp-filter: message dropped (not matching the '192.168.1.66' regular expression)
26 Dec 14:43:11 - [info] [azureiothub:Stream IoT Hub] Message sent.
26 Dec 14:43:12 - [info] [azureiothub:Stream IoT Hub] JSON
26 Dec 14:43:12 - [info] [azureiothub:Stream IoT Hub] Connection to IoT Hub not established or configuration changed. Reconnecting.
26 Dec 14:43:12 - [info] [azureiothub:Stream IoT Hub] Disconnecting from Azure IoT Hub
26 Dec 14:43:12 - [info] [azureiothub:Stream IoT Hub] Connecting to Azure IoT Hub:
   Protocol: mqtt
   Connection string :HostName=stream.azure-devices.net;DeviceId=router0;SharedAccessKey=undefined
26 Dec 14:43:12 - [error] [azureiothub:Stream IoT Hub] Could not connect: Connection refused: Not authorized
26 Dec 14:43:12 - [info] [azureiothub:Stream IoT Hub] Connected to Azure IoT Hub.
26 Dec 14:43:12 - [info] [azureiothub:Stream IoT Hub] Message is pending. Sending it to Azure IoT Hub.
26 Dec 14:43:12 - [info] [azureiothub:Stream IoT Hub] Sending Message to Azure IoT Hub :
   Payload: "{\"state\":true,\"linkquality\":0,\"description\":\"0/REDACTED\",\"type\":\"COORD\",\"rssi\":1}"
26 Dec 14:43:12 - [red] Uncaught Exception:
26 Dec 14:43:12 - TypeError: Cannot read property 'sendEvent' of undefined
    at sendData (/home/user/.npm-packages/lib/node_modules/node-red-contrib-azure-iot-hub/azureiothub.js:38:16)
    at /home/user/.npm-packages/lib/node_modules/node-red-contrib-azure-iot-hub/azureiothub.js:86:21
    at /home/user/.npm-packages/lib/node_modules/node-red-contrib-azure-iot-hub/node_modules/azure-iot-device/lib/client.js:240:9
    at Mqtt.<anonymous> (/home/user/.npm-packages/lib/node_modules/node-red-contrib-azure-iot-hub/node_modules/azure-iot-device-mqtt/lib/mqtt.js:45:17)
    at MqttClient.errCallback (/home/user/.npm-packages/lib/node_modules/node-red-contrib-azure-iot-hub/node_modules/azure-iot-mqtt-base/lib/mqtt.js:75:7)
    at emitNone (events.js:111:20)
    at MqttClient.emit (events.js:208:7)
    at TLSSocket.f (/home/user/.npm-packages/lib/node_modules/node-red-contrib-azure-iot-hub/node_modules/once/once.js:25:25)
    at TLSSocket.onfinish (/home/user/.npm-packages/lib/node_modules/node-red-contrib-azure-iot-hub/node_modules/end-of-stream/index.js:30:27)
    at emitNone (events.js:111:20)
    at TLSSocket.emit (events.js:208:7)
    at finishMaybe (_stream_writable.js:613:14)
    at stream._final (_stream_writable.js:591:5)
    at TLSSocket.Socket._final (net.js:300:5)
    at callFinal (_stream_writable.js:584:10)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)
26 Dec 14:43:27 - [info] 

Routing Device Messages with IoTHub to different Endpoints

Dear Ladies and Gentlemen
I have one Problem.
I want route a device Message to different Endpoints . I have a Routing rule with a specific query string.
But i need for my Query string the specific condition, wich is send with my data with Node-red.
This condition has to send in "appProperties" in a JSON format.
I have to add "systemProperties" with contentType and contentEncoding.

Where i have to add in the msg.payload Message this information?
Is it already possible to use this node to route messages to various endpoints?

Can someone help me with this problem?

Thank you
Best regards, Daniel

[armv7] Error while trying to send message:Unauthorized

Hi everyone,

I encounter a problem on armv7 platform. It always shows "authorized" when I try to send message to Azure. The same procedure is OK on my x86 PC. Here is my system configuration.

[email protected]
[email protected]
[email protected]

13 Jul 11:04:17 - [info] Started flows
13 Jul 11:04:23 - [info] [azureiothub:Azure IoT Hub] JSON
13 Jul 11:04:23 - [info] [azureiothub:Azure IoT Hub] Connection to IoT Hub not established or configuration changed. Reconnecting.
13 Jul 11:04:23 - [info] [azureiothub:Azure IoT Hub] Connecting to Azure IoT Hub:
Protocol: http
Connection string :HostName=IoTHubTest111222.azure-devices.net;DeviceId=device146;SharedAccessKey=KytvWFxJvtpsp9BYlwvAziNW8GAyY3+dsgLHeLe/DMw=
13 Jul 11:04:26 - [info] [azureiothub:Azure IoT Hub] Connected to Azure IoT Hub.
13 Jul 11:04:26 - [info] [azureiothub:Azure IoT Hub] Message is pending. Sending it to Azure IoT Hub.
13 Jul 11:04:26 - [info] [azureiothub:Azure IoT Hub] Sending Message to Azure IoT Hub :
Payload: "{tem: 25, wind: 20}"
13 Jul 11:04:26 - [error] [azureiothub:Azure IoT Hub] Error while trying to send message:UnauthorizedError: Could not send message: Unauthorized
13 Jul 11:04:27 - [error] [azureiothub:Azure IoT Hub] Unauthorized
13 Jul 11:04:28 - [error] [azureiothub:Azure IoT Hub] Unauthorized
13 Jul 11:04:29 - [error] [azureiothub:Azure IoT Hub] Unauthorized
13 Jul 11:04:30 - [error] [azureiothub:Azure IoT Hub] Unauthorized
13 Jul 11:04:31 - [error] [azureiothub:Azure IoT Hub] Unauthorized
13 Jul 11:04:32 - [error] [azureiothub:Azure IoT Hub] Unauthorized
13 Jul 11:04:33 - [error] [azureiothub:Azure IoT Hub] Unauthorized
13 Jul 11:04:34 - [error] [azureiothub:Azure IoT Hub] Unauthorized
13 Jul 11:04:35 - [error] [azureiothub:Azure IoT Hub] Unauthorized
13 Jul 11:04:36 - [error] [azureiothub:Azure IoT Hub] Unauthorized
13 Jul 11:04:37 - [error] [azureiothub:Azure IoT Hub] Unauthorized
13 Jul 11:04:38 - [error] [azureiothub:Azure IoT Hub] Unauthorized

Best regards,
Daniel

Connection String Error

Hi

I have just installed the latest Nod Red and Azure IoT hub nodes on my raspberry pi. The connection string property of the hub node is not saving. I have tried with all protocols and cannot get the connection string to save so I am unable to connect to my hub.

Are there any workarounds for this?

Thanks
David Dwyer

Connectivity Status of Azure IoT Hub Nodes

Hi,

Is there any way to continuously monitor the connection state of Azure IoT Nodes to Azure Cloud?
Can it indicate whether we are connected to the cloud or not at fixed time intervals and on connect and disconnect events like to MQTT Nodes do?

BR

Consumer Group support

I can't find any configuration for consumer group for the IoT-Hub receiver. Do you plan to add this feature?

TypeError: this.mqttprovider.connect is not a function

Hello Ladies and Gentlemen,
i updated my node from version 0.3.0 to 0.4.0. Now after a period of time nearly from 30 mintes to one our i get this error: TypeError: this.mqttprovider.connect is not a function.

After this error Node-Rred reboots and the node shows me the status error. After that i can´t send no messages to Azure. I have to delete the node, add a new one and configure the node.
After the deploy it is possible to send new messages.

I tested different internet-connections and different devices. On both systems the same problem with the new version.

Iam using Node Red version 0.18 and node.js v8.9.4.

Has someone else the same Problem?
Thank you for your answer.

Best regards
Daniel

failure mqtt

Iot-hub receive stops working around 40 seconds after re-deploy

I'm using the Azure IoT Hub Receiver with iothubowner access. The node stops to receive messages around 40 seconds after I deploy a flow. If I restart node-red it continuous to run as it should but as soon as I redploy any flow the behaviour comes back and it stops receiving messages after around 40 seconds. Any one have a clue as of what is going on? I don't see any errors in debug window and no messages in the node-red log (debug mode).

Connection String Error

Hi
getting this error:
5.3.2017, 12:16:49node: Azure IoT Hub
msg : error "ArgumentError: The connection string is missing the property: DeviceId"

My String in the node is:
HostName=XXXXXXXXX.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=XXXXXXXXX
What shall i change?

Thank you!
reto

Multiple Azure IoT Hub nodes refuse connection

Hi to all of you,

I have a node red instance which sends data via mqtt to several clouds simultaneously. Last week I've added a Azure IoT Hub node to it and as long as there is only one Azure node it is fine. But when I try to send data to different Azure endpoints, it seems like they are blocking each other so one always gets disconnected. I thought maybe the same messaging frequence could be the problem, which is why I time shifted the frequences of the messages.
It worked for a couple of days but now one node is constantly disconnected (always the one I set up first)

Does anybody can tell me how you can make it work or what might be the issue?

Thanks in advance!

Cannot populate Node with data via msg object

Cannot populate keys and hostname in AzureIoTHub and AzureIoTHubRegistry Nodes.
These values should have the ability to be populated also in an "external way" like "msg.key" or "msg.hostName".

Exception from Node Red that terminates the flow

In a scenario where we want to send data to an IoT device that doesn’t exist in Azure IoT Hub (using Azure IoT Hub Node) we get an Exception from the Node Red and the Flow is terminated, this behavior also occurs when using the Azure IoT Hub Registry Node when we try to add an IoT device that is already exist.

Azure IoT Hub Node:

[azureiothub:Azure IoT Hub] JSON
[azureiothub:Azure IoT Hub] Connection to IoT Hub not established or configuration changed. Reconnecting.
[azureiothub:Azure IoT Hub] Connecting to Azure IoT Hub:
Protocol: mqtt
Connection string :HostName=fleet-tests.azure-devices.net;DeviceId=testenode11;SharedAccessKey=NVYVIsTozHf3Ts4HlhWfsai18Y100JE8qtbxv86Jz58=
[azureiothub:Azure IoT Hub] Could not connect: Connection refused: Not authorized
[azureiothub:Azure IoT Hub] Connected to Azure IoT Hub.
[azureiothub:Azure IoT Hub] Message is pending. Sending it to Azure IoT Hub.
[azureiothub:Azure IoT Hub] Sending Message to Azure IoT Hub :

[red] Uncaught Exception:
TypeError: Cannot read property 'sendEvent' of undefined
An uncaught exception or error event has been observed. The project is configured to prevent termination of node.js in this case. Continuing activity.

It should behave as stated in the log: “The project is configured to prevent the termination of node.js in this case. Continuing activity” but this is not the case.

Azure IoT Hub Registry Node:

Nov 20 13:36:13 dataflow-westus-paas-rt0 bash[82045]: |error|Y|||moshe|iothub|sandbox|truck.azureiothubregistry:Azure IoT Hub Registry|[azureiothubregistry:Azure IoT Hub Registry] Error while trying to create a new device: DeviceAlreadyExistsError: A device with ID 'testenode10' is already registered.

We need to receive a status code in return without terminating the flow in order to proceed to another Node and handle these events.

In case of Success, for example when using the Azure IoT Hub Node for an existing IoT device we get in return:

[azureiothub:Azure IoT Hub] JSON
[azureiothub:Azure IoT Hub] Connection to IoT Hub not established or configuration changed. Reconnecting.
[azureiothub:Azure IoT Hub] Connecting to Azure IoT Hub:
Protocol: mqtt
Connection string :HostName=fleet-tests.azure-devices.net;DeviceId=testenode9;SharedAccessKey=NVYVIsTozHf3Ts4HlhWfsai18Y100JE8qtbxv86Jz58=
[azureiothub:Azure IoT Hub] Connected to Azure IoT Hub.
[azureiothub:Azure IoT Hub] Message is pending. Sending it to Azure IoT Hub.
[azureiothub:Azure IoT Hub] Sending Message to Azure IoT Hub :
Payload: "{tem: 25, wind: 20}"
[azureiothub:Azure IoT Hub] Message sent.
{"payload":"Message sent.","_msgid":"594b3fdd.22d58"}

It seems that if "err" exists the code performs also the "else" section:

var connectToIoTHub = function (node, pendingMessage) {
node.log('Connecting to Azure IoT Hub:\n Protocol: ' + newProtocol + '\n Connection string :' + newConnectionString);
client = Client.fromConnectionString(newConnectionString, Protocols[newProtocol]);
client.open(function (err) {
if (err) {
node.error('Could not connect: ' + err.message);
setStatus(node, statusEnum.disconnected);
// works for me..
client = undefined;
} else {
node.log('Connected to Azure IoT Hub.');
setStatus(node, statusEnum.connected);
// Check if a message is pending and send it
if (pendingMessage) {
node.log('Message is pending. Sending it to Azure IoT Hub.');
// Send the pending message
sendData(node, pendingMessage);
}

Question: Pass IoT hub Identity via config

Hi together,

Is there a way to transmit the identity and the SAS token to this module via a configuration? The idea here is that node Red runs in a Docker container and this should receive the corresponding information about the environment variables, for example.

Is there a feature / possibility to map this with the module?

Dependencies update

An update for the dependencies would probably fix a lot of problems.

I always got the message: "Error while trying to send message:Error: AMQP Transport: Could not send" on every second message in a "batch". This happened when sending multiple message while the connection was not yet established.
Updating the following packages fixed it for me:

  • azure-iot-device
  • azure-iot-device-amqp
  • azure-iot-device-amqp-ws
  • azure-iot-device-http
  • azure-iot-device-mqtt

Is there a reason for the current way the dependencies are set up?

Node outputs as string instead of object

when trying to manipulate the output from the node most of the nodes can't pick up the output because it's formatted as a string instead of an object. Usually the output is loaded to msg.payload, instead this is what comes out.

image

Handling of errors on message publishing

Hello Gentlemen,

Fisrt of all, thank you for creating Azure IoT Hub nodes. I've been using the package for a while, it is awesome!

Recently I've faced the situation when handling of messages publish fails is required. As a simple exmaple, the scenarion would look like the following:

  1. Get/generate some data within nodes;
  2. Wrap the data into IoT Hub Publish Node package;
  3. Publish the message;
  4. Check if message was sent;
  5. If any error on publishing occur - save message within flow;
  6. Try to send message later, repeat until message will be sent successfully.

First three steps (publishing without sending success checking) are working perfectly on local PC as well as Raspberry Pi, however in case if for some reason the message is not sent (i.e. no Internet connection or bad credentials etc.) - Node-RED server instance crashes. Implementation of "Catch Node" for "Publish Node" does not help.

Could you please suggest a solution for publish error handling which would sustain Node-RED server operations?

Thank you in advance!

Best Regards,
Vitaliy

IoT Hub Receiver gives missing property keyName

I deployed the Azure IoT Hub Receiver node, entered my info and immediately get this error: This is not a user input field. Did NodeRed introduce a new requirement and this contrib doesn't meet it? How to fix?
"ArgumentError: config is missing property keyName"

Waiting for missing types to be registered: - azureiothub

I am getting following errors, any ideas what could be a problem?

I followed the instructions but now luck.

I tired to reinstalled npm, tried several node.js versions still no luck.

Welcome to Node-RED

22 Nov 13:15:47 - [info] Node-RED version: v0.17.5
22 Nov 13:15:47 - [info] Node.js version: v8.9.1
22 Nov 13:15:47 - [info] Linux 4.4.0-101-generic x64 LE
22 Nov 13:15:47 - [info] Loading palette nodes
22 Nov 13:15:48 - [warn] ------------------------------------------------------
22 Nov 13:15:48 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node
22 Nov 13:15:48 - [warn] [Azure] Error: azureiothub already registered (line:191)
22 Nov 13:15:48 - [warn] ------------------------------------------------------
22 Nov 13:15:48 - [info] Settings file : /home/parallels/.node-red/settings.js
22 Nov 13:15:48 - [info] User directory : /home/parallels/.node-red
22 Nov 13:15:48 - [info] Flows file : /home/parallels/.node-red/flows_ubuntu.json
22 Nov 13:15:48 - [info] Server now running at http://127.0.0.1:1880/
22 Nov 13:15:48 - [info] Waiting for missing types to be registered:
22 Nov 13:15:48 - [info] - azureiothub
22 Nov 13:16:26 - [info] Stopping flows
22 Nov 13:16:26 - [info] Stopped flows
22 Nov 13:16:26 - [info] Waiting for missing types to be registered:
22 Nov 13:16:26 - [info] - azureiothub
22 Nov 13:17:05 - [info] Stopping flows
22 Nov 13:17:05 - [info] Stopped flows
22 Nov 13:17:05 - [info] Waiting for missing types to be registered:
22 Nov 13:17:05 - [info] - azureiothub
22 Nov 13:17:23 - [info] Stopping flows
22 Nov 13:17:23 - [info] Stopped flows
22 Nov 13:17:23 - [info] Waiting for missing types to be registered:
22 Nov 13:17:23 - [info] - azureiothub

C2D Received data

I managed to receive some data that i created in a azure function and sent back to the iot hub. When i place a debug node behind the IoT Hub node it shows me just the information: "[object Object]". How can i read the data i received (i wanna print the results on a senseHat)? Thanks for the help!

Wrong data sent to IoT Hub

I have 2 node-red tabs sending data to IoT Hub under different device IDs. The first tab runs every minute to query data from the source and pass into IoT Hub using MQTT. The second tab uses a streamed source that updates around every 15 minutes.
The issue is that when the second tab fires, the data getting sent to Azure IoT Hub is that from the first tab but it is recorded under the Device ID as per the second tab connection.
Debug on the output of the node feeding the IoT Hub node shows the correct data is sent to the node, however that data never makes it to the IoT Hub.
Changing the 2nd tab node to AMQP (with the 1st remaining on MQTT) makes no difference.

node-red-contrib-azure-iot-hub deconnections

Hello,

Since the IoT Hub update of October 2020, I notice périodic deconnection of the node Azure IoT Hub and Azure IoT Hub Receiver from the IoT Hub.

The node does not detect disconnections or closures of the communication channel.

Did exist a newer implementation or better way to keep connections and detect disconnections ?

Regards.

Selected protocol not being used

I decided to check the data (with wireshark) sent from my device to azure iot hub and I noticed when I change the protocol it will always send AMQP messages. You can see the Application Data Protocol is AMQP meanwhile in node-red, the selected protocol was HTTP (same for MQTT).

HTTP node red Wireshark screenshot

I also decided to check if the azure sdk has the same issue, but it seems like that is working correctly.

MQTT SDK Wireshark screenshot

Does anyone know about this issue and know how to fix it?

SyntaxError: Unexpected token [

I get the following error message:

[error] [azureiothub:Azure IoT Hub] SyntaxError: Unexpected token [

Tried both mqtt and amqp protocols and different data values, basic strings and JSON objects.

TypeError: Cannot read properties of undefined (reading 'fromConnectionString')

It happens when using Azure IoT Hub Receiver

I'm guessing here?

node.client = EventHubClient.fromConnectionString(connectionString);

It seems like

const { EventHubProducerClient, EventHubConsumerClient } = require("@azure/event-hubs");

is what is commonly documented instead of

var EventHubClient = require('@azure/event-hubs').Client;

"TypeError: transportCtor is not a constructor"

Upon sending data to an IoT data hub I get the following error:

TypeError: transportCtor is not a constructor

The data is as follows:
{"deviceId":"Device","key":"xxx","Protocol":"mqtt","Data":"{\"eVerbruik\":\"0\"}"}

npm ERR! No valid versions available for node-red-contrib-azure-iot-edge

I'm trying to build a module for Azure IoT Edge using node-red-contrib-azure-iot-edge. The project I'm building is unchanged since I last built, pushed, and deployed it a few days ago. But now it won't build, reporting...

#11 5.778 npm ERR! code ENOVERSIONS
#11 5.782 npm ERR! No valid versions available for node-red-contrib-azure-iot-edge

Help?

Usage with data array and timestamps

Hey folks,
the node seems to be the easiest way to transfer measurement data from NodeRed to Azure. In addition, this is how Microsoft recommends it:
https://azure.microsoft.com/de-de/blog/connecting-node-red-to-azure-iot-central/
Unfortunately it seems to be necessary to create a message for each data point. Is it also possible with the implemented functionality to send an array of data and define the timestamps? Or to set the timestamp at all.

Any help appreciated. Cheers
fludki

Security of the IoT-Hub-Node

Hi guys,

first of all, I am new to this matter so excuse me for beeing a total noob on this topic. I plan to use Node-RED plus the IoT-Hub Node to send Data to the Azure cloud.

Microsoft says that the IoT-Hub only accepts connections via MQTT over port 8333. Furthermore it is required that the entire connection is encrypted via TLS/SSL.

Obviously the Node works just fine but i was wonderding wether it establishes any secure connection at all?

Thank you for your answers!

missing type

I can't get to send messages, it will not deploy the flow.
If i only deploy the device registration flow, it works.
Any hints?

17 Jan 10:35:37 - [info] Node-RED version: v0.16.1
17 Jan 10:35:37 - [info] Node.js version: v7.2.0
17 Jan 10:35:37 - [info] Windows_NT 10.0.14393 x64 LE
17 Jan 10:35:38 - [info] Loading palette nodes
17 Jan 10:35:41 - [warn] ------------------------------------------------------
17 Jan 10:35:41 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node
17 Jan 10:35:41 - [warn] [azureiothubnode] Error: azureiothub already registered
17 Jan 10:35:41 - [warn] ------------------------------------------------------
17 Jan 10:35:41 - [info] Settings file : \Users\lucarv.node-red\settings.js
17 Jan 10:35:41 - [info] User directory : \Users\lucarv.node-red
17 Jan 10:35:41 - [info] Flows file : \Users\lucarv.node-red\scratch.json
17 Jan 10:35:41 - [info] Creating new flow file
17 Jan 10:35:41 - [info] Starting flows
17 Jan 10:35:41 - [info] Started flows
17 Jan 10:35:41 - [info] Server now running at http://127.0.0.1:1880/
17 Jan 10:36:38 - [info] Stopping flows
17 Jan 10:36:38 - [info] Stopped flows
17 Jan 10:36:38 - [info] Waiting for missing types to be registered:
17 Jan 10:36:38 - [info] - azureiothub

TypeError: node.log is not a function (Node-RED in Azure)

I am using the IBM Virtual Device nodes to store data and update device data. In the flow I also use the IoTHub node to send device data on to an Azure IoT Hub.

The flow works very well when running it locally on my PC. When we run the exact same flow in Azure, the error/exception "TypeError: node.log is not a function" crashes the IoTHub node over and over again. We are trying to have an "always on" fleet of devices running, but that proves to be hard when the node seem to crash frequently.

Please advise.

/Tobias

"azureiothub" node does not export "Hostname"

I have set up node-red on my RaspberryPi to send some sensor data to my Azure IoT Hub. It worked fine when using the browser interface to enter the IoT Hub details. But I found when I try to export the flow to deploy it to another device, "Hostname" field was not included. I have to open the node-red in a browser and manually type it.

Is this a security measure?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.