When the ODROID n2+ hardware starts, all i2c switches are turned on

It has happened several times that the HA system restarts due to a power failure. Then the host hardware also restarts and not only the HA software starts. In this case, the i2c switches are turned on.

If only the HA restarts and the hardware does not, then the i2c switches do not turn on.

This case of switches that are switched on at start-up causes a serious headache because the heating is controlled with them.

The system is an ODROID N2+ and it runs a Home Assistant as an operating system, so the HA is not in a container and not in a virtual environment. The i2c expander is a mcp23017 io expansion board which is connected via the i2c pins of the odroid.

What do you think, what could be the reason for this and how could it be solved so that the i2c outputs are not turned ON when the hardware is started, but in the best case they are in the state before the restart or in the OFF state.

thank you in advance for your insights

It is solved.

…RTFM…good to know that there is a new hw_sync option allowing to either synchronize initial value of the switch with the hardware (true, default option) or to set it to a fixed value (false, value=invert_logic).
Lib doc: GitHub - jpcornil-git/HA-mcp23017: MCP23017 implementation for Home Assistant (threadsafe, lower latency and config flow support)