I am developing pump control component for HA.
Pump can be controlled manually (outside HA) too.
I based pump Entity on ToggleEntity where I can turn it on or off via implementing turn_on()/turn_off(), but how should I read pump state?
I can set should_poll() to True, and implement reading pump state via is_on():
@property
def is_on(self) -> bool:
“”“Return true if device is on.”""
status = self._ecoal_contr.get_cached_status(max_cache_period=1)
self._state = getattr(status, self._state_attr)
return self._state
and it works, but IMHO having side effects in property is ugly.
Is any better callback to perform reading real pump state? async_update() ? update() ?
P.S. code blocks formatting seems not work for me?