I would like to have a switch template in ESPHome which would put the device into manual mode. When yhe device is in manual mode I should be able to turn on off some relay using the HA gui. If the device is not in manual mode, the on the HA gui the relay swetches should show the state of the relays but I shall not be able to control the relays manually, something like having a disabled button.
Is this possible?
Make your real ESPHome switches local - so they are not visible in HA. Creat a series of matching template switches.
Then process events on the template switches to either pass them through (action the real switches) or revert to original state, based on a flag you set with your original “mode” template switch.