I am trying to do a simple subtraction of time in a function node.
The elements of time include; current time, minus 'time since last motion'. Both of these are formatted in epoch time.
The issue that I am having is that 'time since last motion' - only sends a piece of data every time motion is sensed and the time is obviously a constant, therefore the flow gets thrown off as there is never a cross over with data being received.
I am using MQTT to pull in the 'time since last motion' and I am using a simple inject node for the current time.
The function node consists of:
msg.payload = msg.time - msg.payload.mot;
return msg;
The output I am getting is NaN.
Please see below for the flow.
Any help would be greatly appreciated. Thanks in advance.