No idea how these timers capture running time and if system load could impact this, but am using this timer (running on a Victron Cerbo) and the amount of time that passes is not very accurate. I have determined this by using system logging debug nodes. The time stamps on the events show more than the expected elapsed time.
Here are my log entries from /var/log/node-red-venus/current:
@4000000068a33b571ae03dcc 18 Aug 10:40:13 - [info] [debug:Start Time] true (Aug 18 10:40)
@4000000068a34285002fb4e4 18 Aug 11:10:51 - [info] [debug:Stop Time] false (Aug 18 11:10)
Since this is a 2% error, that seems huge.
I’m almost thinking that this problem may be specific for Node-RED running on Victron Venus OS, but could use any help that’s out there.
Please see this flow for testing:
[
{
"id": "527ab749e2070dab",
"type": "tab",
"label": "Countdown Timer Test",
"disabled": false,
"info": "",
"env":
},
{
"id": "3a78a69f84c97096",
"type": "inject",
"z": "527ab749e2070dab",
"name": "Start",
"props": [
{
"p": "payload"
},
{
"p": "timestamp",
"v": "",
"vt": "date"
},
{
"p": "command",
"v": "reset",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "start",
"payloadType": "str",
"x": 190,
"y": 260,
"wires": [
[
"30fef349703ce032",
"985e2092890824f6"
]
]
},
{
"id": "24c65f19cc74a5c6",
"type": "debug",
"z": "527ab749e2070dab",
"name": "Stop Time",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 890,
"y": 560,
"wires":
},
{
"id": "852dd574cca62bcf",
"type": "debug",
"z": "527ab749e2070dab",
"name": "Start Time",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 450,
"y": 500,
"wires":
},
{
"id": "8f66745030415cf7",
"type": "moment",
"z": "527ab749e2070dab",
"name": "",
"topic": "",
"input": "timestamp",
"inputType": "msg",
"inTz": "ETC/UTC",
"adjAmount": 0,
"adjType": "days",
"adjDir": "add",
"format": "MMM D HH:mm",
"locale": "POSIX",
"output": "timestamp",
"outputType": "msg",
"outTz": "America/Puerto_Rico",
"x": 480,
"y": 420,
"wires": [
[
"9e61e56a4da55917"
]
]
},
{
"id": "9e61e56a4da55917",
"type": "string",
"z": "527ab749e2070dab",
"name": "Prepend TimeStamp",
"methods": [
{
"name": "append",
"params": [
{
"type": "str",
"value": " ("
}
]
},
{
"name": "append",
"params": [
{
"type": "msg",
"value": "timestamp"
}
]
},
{
"name": "append",
"params": [
{
"type": "str",
"value": ")"
}
]
}
],
"prop": "payload",
"propout": "payload",
"object": "msg",
"objectout": "msg",
"x": 480,
"y": 460,
"wires": [
[
"852dd574cca62bcf"
]
]
},
{
"id": "4b9d6bc65f990ece",
"type": "change",
"z": "527ab749e2070dab",
"name": "",
"rules": [
{
"t": "set",
"p": "timestamp",
"pt": "msg",
"to": "",
"tot": "date"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 910,
"y": 420,
"wires": [
[
"5f3ad71ed57f3653"
]
]
},
{
"id": "5f3ad71ed57f3653",
"type": "moment",
"z": "527ab749e2070dab",
"name": "",
"topic": "",
"input": "timestamp",
"inputType": "msg",
"inTz": "ETC/UTC",
"adjAmount": 0,
"adjType": "days",
"adjDir": "add",
"format": "MMM D HH:mm",
"locale": "POSIX",
"output": "timestamp",
"outputType": "msg",
"outTz": "America/Puerto_Rico",
"x": 920,
"y": 480,
"wires": [
[
"b53743f2598ef35e"
]
]
},
{
"id": "b53743f2598ef35e",
"type": "string",
"z": "527ab749e2070dab",
"name": "Prepend TimeStamp",
"methods": [
{
"name": "append",
"params": [
{
"type": "str",
"value": " ("
}
]
},
{
"name": "append",
"params": [
{
"type": "msg",
"value": "timestamp"
}
]
},
{
"name": "append",
"params": [
{
"type": "str",
"value": ")"
}
]
}
],
"prop": "payload",
"propout": "payload",
"object": "msg",
"objectout": "msg",
"x": 920,
"y": 520,
"wires": [
[
"24c65f19cc74a5c6"
]
]
},
{
"id": "4fba68aeee42473c",
"type": "switch",
"z": "527ab749e2070dab",
"name": "Pass Stop",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 690,
"y": 340,
"wires": [
[
"4b9d6bc65f990ece",
"4ee02b2066d88b69"
]
]
},
{
"id": "23e884ce3edbadd0",
"type": "countdowner",
"z": "527ab749e2070dab",
"name": "",
"topic": "",
"payloadTimerStart": "true",
"payloadTimerStartType": "bool",
"payloadTimerStop": "false",
"payloadTimerStopType": "bool",
"timer": "30",
"resetWhileRunning": false,
"setTimeToNewWhileRunning": true,
"startCountdownOnControlMessage": false,
"minuteCounter": true,
"showCleanTimer": true,
"x": 470,
"y": 360,
"wires": [
[
"4fba68aeee42473c"
],
]
},
{
"id": "30fef349703ce032",
"type": "hourglass",
"z": "527ab749e2070dab",
"name": "",
"persistId": "",
"humanizeLocale": "",
"x": 1020,
"y": 60,
"wires": [
[
"eed4c24ab9ae2b7d"
]
]
},
{
"id": "4ee02b2066d88b69",
"type": "change",
"z": "527ab749e2070dab",
"name": "Get Status",
"rules": [
{
"t": "set",
"p": "status",
"pt": "msg",
"to": "true",
"tot": "bool"
},
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "set",
"p": "command",
"pt": "msg",
"to": "stop",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 890,
"y": 260,
"wires": [
[
"30fef349703ce032"
]
]
},
{
"id": "eed4c24ab9ae2b7d",
"type": "debug",
"z": "527ab749e2070dab",
"name": "Elapsed Time",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1240,
"y": 60,
"wires":
},
{
"id": "985e2092890824f6",
"type": "change",
"z": "527ab749e2070dab",
"name": "",
"rules": [
{
"t": "set",
"p": "command",
"pt": "msg",
"to": "start",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "Start",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 220,
"y": 360,
"wires": [
[
"23e884ce3edbadd0",
"30fef349703ce032",
"8f66745030415cf7"
]
]
}
]