Hi,
I have a function node that is accessed via a call node.
The function sends data to a database.
I have numerous meters that I wish to save the data into the same database.
At the moment I copy the function and just change device & Garage and add it in another flow.
2 examples ...
let device = "IP15";
let location = "Garage"
let device = "IP21";
let location = "Shed"
Is there a way to only have one function ... and pass the device & locations to it ?
Thanks
.
let meter = msg.payload
let device = "IP15"; // ENTER HERE ... the last part of the IP address.
let location = "Garage"; // ENTER HERE ... Location
let new_date = new Date();
let iso = new Date().toISOString();
let timestamp = Math.round(new_date.getTime() / 1000);
let payload =
{
iso: iso,
location: location,
timestamp: timestamp,
meter_reading: meter
};