Reset relay state at reboot Cerbo GX

Hi all,

When the power of the Cerbo is cut, and then brought back, the Cerbo remembers the state of the relays. The relays recover automatically to the state before the power cut.

In my situation this is not wanted. The Cerbo is part of a bigger control circuit in my hybrid generator. The power of this circuit is turned off and on to reset the whole apparatus. Therefore all relays need to return back to off.

I have a Node-RED program running that sets all relays to off at startup but it seems that this is too late. 1 minute after reboot the Cerbo resets the relays to the prior state and only 2 minutes after reboot the Node-RED program kicks in and put the relays in off position.

I have spent hours trying to find a solution on the old forum. Apparently the relays would clear at reboot in older firmware versions from 2019 but I’m affraid to go back that far. I also looked at the gpio_pins.sh script and the gpio_list to define off states during boot but I got confused because the pins had no number in my gpio_list. But I suspect that the Cerbo applies its relay state memory still after this point in the boot process anyway.

Any advice would be greatly appreciated!
Simon

You could always add a smart switch that latches after boot of node red disconnecting the power after the relay. That way it only powers on after the relay is reset? Not ideal but definitely a work around.

Other than to dig deep and change the basic OS behaviour. (I think there was a feature request for it a while ago for it to remember its previous state- i could be mistaken)

Is the relay set as Generator start/stop?

1 Like

Having an extra relay that needs to be explicitly turned on by a Node-RED flow is an excellent work around! However, I do not know this smart switch. Could you post a link of an example?

No, they are manual relay that are controlled by Node-RED. They are used to put on light indications. The problem is that the light indications should not be set before the Node-RED program is running. When Cerbo boots, the light indications show the state before boot while after boot the startup light indications that Node-RED commands should be shown.

The relay states are saved in nonvolatile memory and restored on reboot. You could write a script that is called from /data/rc.local to set the state off. This too may be too late.

It may be necessary to modify the relay code in /opt/victronenergy/dbus-systemcalc-py/delegates/relaystate.py to avoid picking up the nonvolatile state during startup

Hi Kevin, this is something that’s is well beyond my skill. I will need to do a work around as Alexandra suggests. But I’am becoming more and more interested in Venus OS and maybe one day I will pull it off!

Rather than reboot the device by disconnecting the power could you initiate the reboot from Node-Red logic?

So for example use a digital input as a “reboot” signal. That starts a Node-Red flow which sets your relay states then reboots the device.

1 Like

I use Sonoff switches (flashed with tasmota) but i am switching AC gear. Using node red.
Other options easily integrated are Shelley switches.
Is the circuit you want to switch AC or DC?

The purpose is to shut the whole hybrid generator down. Not just only reboot. But thanks for the suggestion, I might implement it for something else!

I need to switch 24V low power circuit that contains some leds of different collor and a buzzer. Should be easy to find a switch. I was thinking of putting a relay that is firstly powered by Cerbo relay through Node-RED. Next the circuit downstreams excites this relay and Node-RED can turn off the Cerbo relay. Therefore if 24V power is cut, the extra relay opens and the cerbo relay is in the open state during the reboot process. In that way I don’t need to use wireless relays wich seem to me to complicate stuff and make the circuit more volnerable.

Shelly devices might help here. There are various models of relays that can be controlled either by dry contact inputs or via MQTT/HTTP commands.

They also have settings for relay state on power-up.

2 Likes