Sending Message from Platform to Device

It is a two step process to produce message and send to device.

Step1: Create Node RED Flow with a function that actually generates data meant for device.

Step2: Create a Rule to route the message to Device

Step1 - Generating message

Navigate to NodeRed Tab. Include a trigger node, function node and Service Out Node under vitalpointz custom node section.

Connect them in a flow as shown below.

Function Node should emit 2 fields namely, msg.topic and msg.payload

Use allocated Device Topic associated with the intended recepient device as msg.topic

msg.topic is the actual message that needs to be sent to device.

Step2 - Routing message using Rules Engine

Next step is to create a rule to send the message generated by the user defined function to the device.

Navigate to Rules Engine -> click Add New Rule.

Enter name of your choice.

Select ‘Event to Forward’ to ‘User Defined’. Enter Device’s allocated topic as ‘Custom Event’.

Enter ‘HOSTED_NODERED’ as ‘source’

Select ‘Forward to’ to ‘User Defined Service Name’. Enter ‘TO_DEVICE’ as ‘service name’.

Click submit.