Mysensors switches saved state is pushed on HA start

Hi,
I am using mysensors to control a set of Arduino switches/relays. They are also controlled internally with a push switch. The switches are nicely detected in the HA and I can either control them from HA as well as with the Arduino push button. The state changes are reflected in HA.

It all works great but when I stop HA and during that time the states of switches change, then upon startup, the HA will revert to the state that it saved when it was going down.

I would like to change this behavior so that the state of switches is not touched when HA gets back up. It should only update the state to whatever it is now.

Is there an option to achieve this? Or should I change the type of device to light instead of switch?

Hi Bart, sorry, no solution for your problem, but I am quite new to HA, just moved from fhem.de having several mysensors node running for years.
I see the nodes in HA, I can also see all messages, but there is no Switch in the HA-UI to change the state of relays. Any hint? This is a code example I am using V_STATUS and S_BINARY, is this not correct:

...
MyMessage msgRelay(CHILD_ID_RELAY1, V_STATUS); 

void presentation() {
  sendSketchInfo(SKETCH_NAME, SKETCH_VERSION " (" __DATE__ ")");
  // 4 channel relay
  for (int relays = 1, pin = RELAY_1; relays <= NUMBER_OF_RELAYS; relays++, pin++) {
    // Register all sensors to gateway (they will be created as child devices)
    present(relays, S_BINARY, "Relais (1/0)", ack);
  }
}
...

You can look up my sensor example in this GitHub repository: GitHub - bcelary/Switch: Managing multiple button/relay groups with multiple button or relay per group

This is what I’m using with my setup and it detects the switches correctly.

I’m currently moving away from my sensor anyway and will be using Home Assistant MQTT library to get rid of the USB serial connection.