FOR COMMUNITY SUPPORT PLEASE USE THIS THREAD
For Hue motion sensors checkout Hue-sensors-HASS
If using Home Assistant >= v0.108, please read the deprecation and suggested migration section
Custom integration for Hue & Lutron Aurora Friends of Hue (FOH) remotes with Home Assistant.
This custom integration provides the missing support for remote
devices in the official Hue integration of HA Core, by registering the platform in the main integration and sharing the sensor data with it.
As this new platform imposes a lower scan_interval
for all hue sensors (of 1Hz), sensors from the main hue integration will also increase their refresh rate to 1 Hz.
Be advised that the increased update of this custom integration may cause connectivity problems which can result in errors in the official hue integration, please do not create any issue for this. If you can't live with these errors, do not use this custom integration.
Since HA v0.108 Hue switches are recognized in the hue
integration,
making this CC not really necessary anymore, but there are some caveats,
as it is not a perfect replacement for this CC.
Now the main hue
registers the remotes as devices
, and fires events with the detected button presses.
For easier usage from UI, it also presents the button presses as device triggers
for automations.
In addition, for battery-powered remotes it generates battery sensor entities
.
The features of this CC over what the main hue offers are to:
- Expose the switches as entities (of kind
remote
, but they actually aresensor
), showing the last button press as the state, using fixed state mappings (like code 3002 is "3_click_up", etc.) - Modify the hue update interval to a fixed, much faster, rate (1Hz by default, customizable with scan_interval: X), to have a faster polling than the 5 secs of the main integration
But as this CC is not using the Integrations menu, it needs manual yaml and a HA restart for any config change. It also has some problems derived of doing too many calls to the Hue bridge, and its usage for automation triggers now presents some flaws with false positives.
In this context, this CC is being deprecated, and these are some suggestions to migrate to other HACS custom integrations to achieve the best results, depending of your own specific needs:
-
If you need a faster polling interval for the hue bridge than the 5s, use Fast-Hue CC to:
- Modify the main hue update interval to any value, different for each bridge
- Monitor the current refresh rates with sensor entities
- Enable a service to change the refresh rate anytime
-
If you want to expose the remotes as entities, because you want to track their state or use it to trigger automations, use EventSensor CC
- It is UI configurable (with no restart required) and has configuration wizards to help configure the Hue switches for this specific migration.
- The mapping for the button presses is customizable, being the default maps the same ones used here
- It will not generate false positives, as it listens to the events generated in the main hue (listening directly to those events, or using UI device triggers would also do the trick)
You can use both new CCs, or none of them, if you are comfortable with the main hue polling and change your automations to use 'device triggers'.
Both are configurable via UI, so no restarts are needed to install and try them. To do the smoothest migration, with just one HA restart, follow these steps:
- Remove the yaml config for this CC, and replace every
remote.entity_name
in your config (like inautomations.yaml
) tosensor.entity_name
, as the new entities will be ofsensor
type. - Disable all automations using the remotes, as we don't want them triggering until migration is finished :)
- Uninstall this CC from HACS.
- Restart HA. Now the
remote.x
entities should be gone and this CC would not be loaded. - Install "Event sensor" from HACS.
- In Integrations, add and configure a new sensor for each old
remote
. Follow the wizard for Hue remotes, set the same name as before (so new entities will besensor.entity_name
), and, as the identifier, choose "id" and set theentity_name
.
At that point the migration is done, and you can check the new sensor entities by pressing buttons, and then re-enable the automations to check that everything works as before.
If the fast polling interval is required, install "Fast-Hue polling" from HACS and configure it for your needs, taking into account that, if polling too fast, some logging errors may appear in the main hue.
In that case, feel free of playing with different values to optimize your specific system, as there is a new service fasthue.set_update_interval
to do just that in any moment.
Install via HACS. You need to set up your Hue bridge first.
Alternatively, place the custom_components
folder in your configuration directory (or add its contents to an existing custom_components
folder).
Once installed add to your configuration:
remote:
- platform: hueremote
The scan interval can be modified optionally, by adding scan_interval: 2
.
- Hue dimmer switch - can be used for a click and long press (hold button for 2 sec and see LED blink twice).
- Hue tap switch
- Hue smart button
- Lutron Aurora smart bulb dimmer
- Lutron Aurora rotary dimmer
- Create venv ->
$ python3 -m venv venv
- Use venv ->
$ source venv/bin/activate
- Install requirements ->
$ pip install -r requirements.txt
&$ pip install -r requirements-dev.txt
- Run tests ->
$ venv/bin/py.test --cov=custom_components tests/ -vv -p no:warnings
- Black format ->
$ venv/bin/black custom_components/*
(or setup VScode for format on save)
Please format code usign Black before opening a pull request.
A big thanks to Atsuko Ito and Eugenio Panadero for their many contributions to this work!