Send data from Enterprise IIoT Gateway in the same format as sent by the WiFi Microgateway Amazon AWS

Hi, we were using WiFi Microgateway Amazon AWS gateways for our IoT infrastructure.
It means that our setup in AWS IoT Core, the rules and the Lambda functions are expecting the information from the topics like:
$aws/things/+/shadow/update/accepted or
$aws/things/+/shadow/update/documents, …
in the format expected by AWS.

We are starting to replace the AWS microgateways by Industrial Edge Computing Gateways with Node-Red. The raw data that Node-Red is sending from the sensors is not formated in the same way than the AWS microgateways.

Do you have any Node-Red nodes that emulates what the AWS Microgateways are formating after collecting the information from any sensor and publish topics before sending them to AWS by MQTT protocol?

It will help us a lot not having to modify all setup to our existing datamodel in AWS.

  1. List item

Below an example from an environmental sensor from AWS Microgateway for topic:
$aws/things/+/shadow/update/accepted where you see the payload for sensor_data indented as state.reported.nodes and the serial number is build as “SN”+ MAC address without “:”:

{
“topicFilter”: “$aws/things/A842E3ED686C/shadow/+/accepted”,
“qos”: 0,
“messages”: [
{
“format”: “json”,
“topic”: “$aws/things/A842E3ED686C/shadow/update/accepted”,
“timestamp”: 1758116796430,
“payload”: {
“state”: {
“reported”: {
“nodes”: {
“SN0013A200424F1166”: {
“firmware_version”: 3,
“transmission_count”: 145,
“reserve_byte”: 0,
“battery_level”: 3.29406,
“type”: 27,
“node_id”: 0,
“rssi”: 13,
“temperature”: 23.44,
“pressure”: 1000.74,
“humidity”: 43.619,
“gas_resistance”: 146605,
“iaq”: 1
}
}
}
},
“metadata”: {
“reported”: {
“nodes”: {
“SN0013A200424F1166”: {
“firmware_version”: {
“timestamp”: 1758116797
},
“transmission_count”: {
“timestamp”: 1758116797
},
“reserve_byte”: {
“timestamp”: 1758116797
},
“battery_level”: {
“timestamp”: 1758116797
},
“type”: {
“timestamp”: 1758116797
},
“node_id”: {
“timestamp”: 1758116797
},
“rssi”: {
“timestamp”: 1758116797
},
“temperature”: {
“timestamp”: 1758116797
},
“pressure”: {
“timestamp”: 1758116797
},
“humidity”: {
“timestamp”: 1758116797
},
“gas_resistance”: {
“timestamp”: 1758116797
},
“iaq”: {
“timestamp”: 1758116797
}
}
}
}
},
“version”: 70802,
“timestamp”: 1758116797
},
“qos”: 0
}
]
}

  1. List item

Below an example of an environmental sensor from the Node-Red gateway where you see the payload is not formated same way:

{
“topicFilter”: “$aws/things/06671824060079/shadow/+/accepted”,
“qos”: 0,
“messages”: [
{
“format”: “json”,
“topic”: “$aws/things/06671824060079/shadow/update/accepted”,
“timestamp”: 1759311542252,
“payload”: {
“nodeId”: 0,
“firmware”: 3,
“battery”: “3.06”,
“battery_percent”: “73.65”,
“counter”: 178,
“sensor_type”: 74,
“sensor_data”: {
“temperature”: 26.81,
“pressure”: 1014.82,
“humidity”: 54.484,
“resistance”: 41612,
“iaq”: 188,
“co2_eqv”: 1270,
“breath_voc”: 2.86,
“static_iaq”: 127.03,
“iaq_accuracy”: 3
},
“sensor_name”: “Wireless Temp Humidity Pressure Air quality Sensor V2”,
“type”: “sensor_data”,
“addr”: “00:13:a2:00:42:52:48:c0”,
“received”: 1759311541435,
“original”: {
“mac”: “00:13:a2:00:42:52:48:c0”,
“receive_options”: {
“ack”: 0,
“broadcast”: 0,
“type”: “”
},
“data”: [
127,
0,
3,
3,
183,
178,
0,
74,
0,
10,
121,
0,
1,
140,
106,
0,
0,
212,
212,
0,
0,
162,
140,
0,
188,
4,
246,
0,
0,
1,
30,
0,
0,
49,
159,
3
],
“type”: “receive_packet”
}
},
“qos”: 0
},
{
“format”: “json”,
“topic”: “$aws/things/06671824060079/shadow/update/accepted”,
“timestamp”: 1759311528181,
“payload”: {
“nodeId”: 0,
“firmware”: 3,
“battery”: “3.10”,
“battery_percent”: “77.98”,
“counter”: 190,
“sensor_type”: 74,
“sensor_data”: {
“temperature”: 22.56,
“pressure”: 1015.24,
“humidity”: 39.481,
“resistance”: 247462,
“iaq”: 105,
“co2_eqv”: 909,
“breath_voc”: 1.26,
“static_iaq”: 90.96,
“iaq_accuracy”: 3
},
“sensor_name”: “Wireless Temp Humidity Pressure Air quality Sensor V2”,
“type”: “sensor_data”,
“addr”: “00:13:a2:00:42:52:49:ab”,
“received”: 1759311527364,
“original”: {
“mac”: “00:13:a2:00:42:52:49:ab”,
“receive_options”: {
“ack”: 0,
“broadcast”: 0,
“type”: “”
},
“data”: [
127,
0,
3,
3,
195,
190,
0,
74,
0,
8,
208,
0,
1,
140,
148,
0,
0,
154,
57,
0,
3,
198,
166,
0,
105,
3,
141,
0,
0,
0,
126,
0,
0,
35,
136,
3
],
“type”: “receive_packet”
}
},
“qos”: 0
},
]
}

Thanks!

I attach the files in json format to see how are indented:
AWS_Microgateway.json (10.0 KB)
Node-Red_gateway.json (3.3 KB)

hI @xtyhyperion I definitely think formatting the data using a Node-RED Function node is possible.

I will review the files and run some tests on my end. I’ll get back to you in this thread just as soon as I have any progress or results.

Since I don’t have an AWS IoT account ready at the moment, I can share the Node-RED flow with you directly. That way, you can test it on your side and we can troubleshoot any bugs that pop up.

Thank you,
Eduardo M

Hi @xtyhyperion could you share a screenshot of your Enterprise IIoT Gateway Node-RED flow? or your Node-RED Flow File, To do so, please follow these steps:

  1. Select your complete Node-RED flow (leaving out any nodes that contain sensitive information such as AWS credentials).
  2. Click the main menu (three horizontal lines in the top-right corner) in Node-RED.
  3. Select the “Export” option.
  4. Ensure the “selected nodes” option is selected.
  5. Click the “Download” button to save the JSON file.
  6. Attach the JSON file to this thread.

Thank you,
Eduardo M.