When the state is off, the relay switch automatically closes and when the water level state is off, the relay switch is prohibited from opening. If it is opened, it automatically closes. The relay switch cannot be opened freely until the water level state is on. How to implement this function?
What state? The water level state? The relay state?
It’s unclear what you want, does this match your logic?
- if water level switches to off, really switches to on
- while water level continues to be off, relay cannot be turned off
- if water level turns to on, relay can be turned off but is not done automatically?
- if relay is requested off and water level is on, relay can be switched off
I am assuming water level is a sensor and not a switch, would be good if you shared your yaml showing this, formatted correctly.
Yeah - assuming they are both switches. If one is a sensor then not so much.
I think a template switch (within ESPhome) could be created as an intermediate step to make it work, not something I’ve tried before though.