Right now IoT sensors are sending json of data to the gateway and then it’s passing to the MQTT straight away.
Is there a function that can call the mac address of the gateway that is sending the data?
then is there a way to combine a string of text with the gateway mac address to the json that the sensor is attached to so that it is easy to parse which device is attached to which gateway?
Can you export your Node-Red flow and attach it here so we can take a look? Are you saying you just want the Gateway’s MAC address included in the JSON object published to the MQTT broker?
Thank you,
Travis Elliott
flows.json (528 Bytes)
Please see attached I’m testing the function going to ‘debug 155’
Yes that is the case. I want to add a new line in the json package. I was thinking there are 2 issue’s I’m thinking is there a function that can call the gateway MAC, or is it something that I have to manually configure each time I spin up a gateway.
nodeId: 0
firmware: 10
battery: “3.28”
battery_percent: “98.56”
counter: 151
sensor_type: 44
sensor_data: object
sensor_name: “Wireless CO2 Gas Sensor”
type: “sensor_data”
addr: “00:13:a2:00:42:38:29:f5”
Gateway Mac: XX:XX…
received: 1757686727111
original: object
I can add this for you, the flow attachment you sent was only for one node though. Can you send me the complete flow so I can modify to include the Gateway Mac in the payload?
flows (3).json (107.7 KB)
Hi, I must have been selected on a node. Please see attached.
Attached is a flow. You will see a switch node connected to the wireless gateway which is then connected to a change node. Here we are extracting the ID of the Gateway and setting a flow variable we can reference in the function node Add Modem_MAC.
Let me know if this is what you had in mind. I know this isn’t the actual MAC address of the modem but it is a unique identifier for the XBee module installed in the gateway.
If this is not what you were looking for please let me know.
Thank you,
Travis
flows-66.json (108.1 KB)
Hi, I think that’s right.
Do I just use a join node to combine the messages? It seems like the modem mac is only setting up as a string and not an object.
