I just asked Gemini Argon, and it made a working flow by the looks of it, I manually tested the relay and it works on my Ekrano.
This is what I asked:
"Can you make a downloadable Node Red Flow for someone else to use who has a Victron Cerbo. this is what they want: I want to use just the clock in the cerbo purely as a relay on off timer for relay 2 on the cerbo, (relay one is already in use) I want relay two to close at midnight and open at 5am regardless of any conditions, only the clock needs to time that relay.
I have node red installed, but cant figure out which nodes to choose from the left and how to wire them, or if this is even possible.
Can anyone please help and possibly draw me a node flow diagram? "
[
{
"id": "tab_cerbo_relay2_timer",
"type": "tab",
"label": "Cerbo Relay 2 Timer",
"disabled": false,
"info": "Simple clock-based timer for Victron Cerbo GX Relay 2.\nCloses at 00:00 (Midnight) and opens at 05:00 AM.\nIncludes a 1-minute watchdog check so the relay recovers its correct state if the Cerbo reboots."
},
{
"id": "comment_instructions",
"type": "comment",
"z": "tab_cerbo_relay2_timer",
"name": "IMPORTANT: Set Relay 2 Function to 'Manual' in Cerbo Remote Console (Settings -> Relays)",
"info": "For Node-RED to control Relay 2 without Venus OS overriding it, ensure Relay 2 is set to 'Manual' in the Cerbo GX settings.",
"x": 370,
"y": 60,
"wires": []
},
{
"id": "inject_midnight_on",
"type": "inject",
"z": "tab_cerbo_relay2_timer",
"name": "00:00 - Close Relay (1)",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "00 00 * * *",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "1",
"payloadType": "num",
"x": 190,
"y": 140,
"wires": [
[
"victron_relay_2_out"
]
]
},
{
"id": "inject_5am_off",
"type": "inject",
"z": "tab_cerbo_relay2_timer",
"name": "05:00 - Open Relay (0)",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "00 05 * * *",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "0",
"payloadType": "num",
"x": 190,
"y": 200,
"wires": [
[
"victron_relay_2_out"
]
]
},
{
"id": "inject_boot_watchdog",
"type": "inject",
"z": "tab_cerbo_relay2_timer",
"name": "Boot & 1-Min Check",
"props": [
{
"p": "payload"
}
],
"repeat": "60",
"crontab": "",
"once": true,
"onceDelay": "5",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 180,
"y": 280,
"wires": [
[
"func_time_window_check"
]
]
},
{
"id": "func_time_window_check",
"type": "function",
"z": "tab_cerbo_relay2_timer",
"name": "00:00 to 05:00?",
"func": "const now = new Date();\nconst hour = now.getHours();\n\n// Between 00:00:00 and 04:59:59, Relay 2 should be CLOSED (1)\n// From 05:00:00 onwards, Relay 2 should be OPEN (0)\nif (hour >= 0 && hour < 5) {\n msg.payload = 1;\n node.status({fill: \"green\", shape: \"dot\", text: \"Active Window: ON (1)\"});\n} else {\n msg.payload = 0;\n node.status({fill: \"grey\", shape: \"ring\", text: \"Outside Window: OFF (0)\"});\n}\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 380,
"y": 280,
"wires": [
[
"rbe_filter_changes"
]
]
},
{
"id": "rbe_filter_changes",
"type": "rbe",
"z": "tab_cerbo_relay2_timer",
"name": "Filter (Send on Change)",
"func": "rbe",
"gap": "",
"start": "",
"inout": "out",
"septopics": false,
"property": "payload",
"topi": "topic",
"x": 590,
"y": 280,
"wires": [
[
"victron_relay_2_out"
]
]
},
{
"id": "victron_relay_2_out",
"type": "victron-output-relay",
"z": "tab_cerbo_relay2_timer",
"outputs": 0,
"service": "com.victronenergy.system/0",
"path": "/Relay/1/State",
"serviceObj": {
"service": "com.victronenergy.system/0",
"name": "Venus device"
},
"pathObj": {
"path": "/Relay/1/State",
"type": "enum",
"name": "Venus relay 2 state",
"enum": {
"0": "Open",
"1": "Closed"
},
"writable": true
},
"initial": "",
"name": "Cerbo GX Relay 2",
"onlyChanges": false,
"x": 630,
"y": 170,
"wires": []
},
{
"id": "41dc70bdd995c9dc",
"type": "global-config",
"env": [],
"modules": {
"@victronenergy/node-red-contrib-victron": "1.7.27"
}
}
]