IO board with local automation support when HA is down

For a new home installation, a preference is to use as many things wired as possible. The key piece shall be lights and switches. But I struggle to find adequate hardware at a reasonable cost.

What I’d like to have:

  • Up to 8 or 16 inputs and outputs at the same time, to be installed in the distribution box or near to it.
  • Has an option to run local automation if connection to HA is down. I need it to be a super robust, so that at least we can toggle the power to lights, even if lights are smart or dumb.
  • Relay outputs, no need for power measurement per channel, no triac outputs
  • 230V input (live inputs), can be with optocoupler, to read button presses from the room
  • Strong preference is ETH over WIFI
  • Can run ESPhome
  • Integrated with HA

As for local automations, the only things it needs to do is to toggle the relay on the input press. Here the request of same number of inputs and outputs. If HA connection exists, HA will take care of that. ESPHome seems to have a nice api.connected check that I can use for every binary sensor input. ESPHome fallback

I looked into these option so far:

As simple as it may sound, but I can’t find a solution so far.

Could you please suggest an appropriate HA-supported hardware, that can handle toggle automation if HA isn’t available?