Rick from tech support gave me these instructions for automatically inserting the device name into a text message. This allowed me to run the same program on multiple devices, but when one publishes and event I can recieve a message that notes which device it is coming from.
I wanted to modify to do the same for a firebase database. I set this up to recieve all publications from all devices. The previous instructions worked for this, but the data came in as all on string…“this event happened at this time from this device”
I need it to come through as different data sets so I tried to modify the function similar to this tutorial:
https://docs.particle.io/tutorials/iot-rules-engine/real-time-alerting/
Here’s my code. and a screen shot with the error I get.
Can anyone help me format this, so that it works
var deviceNames = flow.get(‘deviceNames’, deviceNames);
msg.payload = {‘Event’: (msg.event),
‘Payload’: (msg.payload),
‘Time’: msg.published_at,
‘Device’: deviceNames[msg.device]};
here’s a picture of the database with previous entries coming through the way I want, then the last entries are with my new flow (all one strng)