I have a switch that wants to understand the current state of a venthood fan. The venthood exposes two entities fan_light and fan_speed that can be changed through my HassIO lovelace UI or directly by a human on the physical device itself.
Here is where it get’s interesting - the current state of the device cannot be queried since it is a dumb device - but I can infer the state of the device by pulling the current power draw of the circuit it is connected to.
The integration that provides this information doesn’t want to be hammered to get real time power usage - so I was thinking it would be great to normally run the integration in regular time update loops - say every minute - and then increase polling frequency to say every 2 seconds when the button is pressed or when the UI is opened.
I would update the integration to basically support a “realtime for 1 minute” service endpoint that would increase polling rate in bursts.
I was hoping to trigger this all using an action call from the jinja value template - but you cannot call services from templates.
Any other ideas for how to pull this off?