Custom component for improved Hue button and sensor events

I know there a plenty of options out there for using Hue buttons/switches/sensors with Home Assistant.

The cool fact is that starting in Home Assistant 0.108 we already have native support for most Hue buttons/switches/sensors. The motion sensor already shows up as an entity and Hue switches (Dimmer Switch, Hue Tap, Smart Button and FOH switches) generate events in Home Assistant, which can be used in automations.

The only issue right now is that the Hue Bridge needs to be polled for changes (which is always a bad thing) and the default polling interval that Home Assistant is using introduces a nasty lag between button presses and events.

That’s why I am using a custom component which is lowering the scan_interval of the official Hue integration to 0.5 seconds. This way button/sensor events from Hue devices are less laggy and usable for automations within Home Assistant. There is still a tiny lag, but it’s usable.

In case anybody is interested, that’s the code I am using:

The main benefit of this approach is that this component does not provide any entities or additional functionality to HASS. By using this you’ll stay very close to Home Assistant upstream.

Let’s hope that the Philips Hue API will support actual events one day without polling, so we can stop this silly polling.