NEWS
time of the last change of a data point.
-
is there a way in javascript (for node-red) to query the time of the last change of a data point.
The system "knows" this because the time is displayed in the object list. -
let lc = getState(id).lc; // Trigger: on(id, function(dp) { let lc = dp.state.lc; });
-
@paul53 Hi Paul thank you for very quick response. The question ist how can I access to the ts property. I mien ts is the value I am looking for.
-
@franzda sagte: how can I access to the ts property.
.ts
instead of.lc
. -
- you insert a node "iobroker in"
- select your datapoint as topic
- select object in payload
- then you select a function node with the following code
msg.payload=msg.payload.lc; //or msg.payload.ts return msg;
5 for testing purpose you can connect the function node with a debug node
-
@oliverio Hi Oliver Thank you for quick response. it works
-
@franzda said in time of the last change of a data point.:
@oliverio Hi Oliver Thank you for quick response. it works
this is my code thank you for helping: (two different formats for testing)
// --- sensor.neulcT = (new Date(msg.payload[i].lc)).toLocaleTimeString(); sensor.neulc = (new Date(msg.payload[i].lc)).toLocaleString(); // ---
-
@oliverio
Hi Oliver Thank you for quick response. it worksthis is my code thank you for helping: (two different formats for testing)
// --- sensor.neulcT = (new Date(msg.payload[i].lc)).toLocaleTimeString(); sensor.neulc = (new Date(msg.payload[i].lc)).toLocaleString(); // ---
-
@paul53 hi Paul Thank you for quick response. it works
this is my code thank you for helping: (two different formats for testing)
// --- sensor.neulcT = (new Date(msg.payload[i].lc)).toLocaleTimeString(); sensor.neulc = (new Date(msg.payload[i].lc)).toLocaleString(); // ---