NodeRed: flow "overrules" remote control settings, how can i fix this?

Hi, i’m new in the forum, first post, i hope i am doing things right :slight_smile:

i have a full victron offgrid system and - with the help of one reddit victron user - made my first programming flow with node-red. a very simple flow to control the relay 1 of the cerbo gx (to switch on and off my water heater depending on Battery SoC).

the flow is working as intended and the hardware (switch, relay) as well! but i am still complete noob with node-red.

i encountered one issue that i would like to solve:

in the venus os settings (remote control or vrm) there is the option to manually turn on (close) / off (open) the relay.

i thought it would make sense to be able to manually turn it off/open it (for example for maintainance or remote decisions), BUT the node-red flow “overrules” the manual setting! after 5 secs there will be a new value forwarded by the flow and it will close the relay again, although i just opened it manually in the settings.

i could set the nodes to “only send changes”, which would give me an unpredictable amount of more time, but this seems to be “unsafe”.

when i think about it, either way, no matter if the flow tells “off” and i manually want to switch it on, or the flow says “on” and i manually want to switch it off, there will always be a conflict between the activated flow and the manual switch.

how could i solve this? how could i either deactivate the running flow to have control over the manual switch, or implement the switch into the flow? the point would be to be able to control this WITHOUT having to go to the computer and connect to node-red on the cerbo and stop the flow…

could i add something like an on/off-switch for the node-red flow, that appears in the settings or in vrm?

thanks for your ideas!

Hello,
Try to tick the checkbox only changes in the Victron input node …

Xavier

I think you need the same feature I asked about in another post. See the answer I got there:

I’d like to add that you need to get your ‘logic rules’ well defined first, regardless of the implementation. With relays being controllable from multiple sources, the key question is what ‘signal’ is ‘master’ and when.
Once that is clear, you create a flow to reflect the ‘required’ relay status first, and use that to ‘lock’ the relay in that state by monitoring any changes (a) and resetting it to the required state immediately.
In some cases this can still leave a side effect to be solved: fast unintended on/off cycling (under 5 seconds) , that to my best knowledge can only be solved reliably by a hardware ‘delay’ timer relay set to a bit more than the regular 5 seconds (1 message per 5 seconds) that most Victron nodes use.

(a) By monitoring the changes you can also ‘catch’ desired state changes, for instance if you want a manual ‘open’ in the app to be a hard ‘off’ or only ‘off’ under certain circumstances or time conditions. Feed that to the decision logic to change the required ‘state’.

PS I recommend the boolean ultimate set of nodes to do logic operations in node-red , it includes boolean logic (with delay timer), basic math, flow interrupts and much more. A basic control flow connects the relay input node to an interrupt node to a boolean decision node and then back to the relay control node. That way you can interrupt the 5msg/s flow ánd control the state of the relay with the smallest possibly feedback loop (do not tick the ‘only changes’ box as you want that as a ‘heartbeat’ msg to trigger your logic-control that then in it’s turn controls the feedback loop by interrupt and a forced state signal)

PPS, I’d add at least one 1 second delay node in the feedback loop to prevent a possible runaway (race) condition that can instantly make your Cerbo lock up. Speaking from experience.