Change over switch 230V - 12V

Hello together

I am using a small UPS to keep the HA server alive during the daily load shedding here in South Africa. I have a offgrid solar system with a deep cycle 60Ah 12V battery. To built a system which is switching between 230V and 12V, I need a change over switch. First job is toggling between the main power supply and the battery, but also preventing charging from the UPS when 230V is back again. This is critical since the battery is still connected to the solar panel. The switch cannot have a connection between 230V and 12V but must handle the two separatly.

First I thought of using two Sonoffs switches: one for the 230V supply and one between the battery and the UPS. As soon as 230V is out, the UPS kicks in till the 12V Sonoff is on. The Sonoff at the 230V side is set to be switched off after 230V is back, the 12V is switched off and the 230V back on. While that should work, a industrial change over switch should be more solid. I would not like to have different currents fighting each other in my server cupboardā€¦

Sorry about the wording, I hope I could explain my idea. Does anybody have an idea for such a device?