Hi,
I am not sure if this is the appropriate place to ask these questions, or that the third party integration category is. Maybe someone can help me answer some general questions that I could not find an answer for in the documentation. (If it is there, please point me to it.)
I have made a switch-integration for a board named ‘Ethrly02’. When I press the switch in Lovelace, function async_turn_on is called, and I ask my EthRly02 lib to switch on the corresponding relay. If this fails (for whatever reason), the switch remains on in Lovelace, not representing the actual state. The pollrate is about 30 seconds, I have noticed(default), and if ‘async_update’ and HA requests the updated state using ‘is_on’ and finds the relay is not on, the switch turns off again, as expected.
Q1. I would like to know if there is a standard way of processing feedback, like having the switch in Lovelace switch back to off if the integration fails to turn on the physical switch. Maybe it’s a return value that I can set, or maybe I have to fire a ‘turn off’ event in the ‘turn_on’ function? I prefer not to increase the pollrate as a solution.
Q2. Am I allowed to do some blocking IO or async sleep if the ‘turn_on’/‘turn_off’ functions are prefixed with ‘async_’, like when I need to attempt a reconnect with some timeout?
Thanks!