I would like to share a configuration which allows me to control HA entities from the Philips Hue Dimmer Switch instantly, without HA having to poll for its status!
It works by integrating the switch via Apple’s HomeKit which in turn links to HA via Homebridge. There’s unfortunately a limitation whereby HomeKit only has the ability to detect a single press on each button, but hopefully that may be fixed by Apple or Philips at a later date.
My use case for this is to control a floor standing lamp in a room that already has a Hue bulb in the main ceiling light, with a dimmer switch on the wall. The floor lamp doesn’t use standard bulbs so I turn it on and off with a TP-Link Wifi Smart Plug via HA (any other plug switch integrated into HA will work). I turn this lamp on and off using the middle two buttons on the Hue Dimmer Switch seeing as I never used those to control the main light anyway, preferring to just cycle through the 5-preset light modes using the top button.
The link between it all goes like this:
Hue Dimmer switch -> Hue Bridge -> Apple HomeKit -> Homebridge -> Home Assistant -> TP-Link Plug Switch
This has only recently been possible due Philips Hue integrating their accessories into HomeKit: https://9to5mac.com/2017/10/03/philips-hue-homekit-tap-dimmer-switch-motion-sensor/
It works by having Homebridge present HASS switches (such as the TP-Link plug) as a switch within HomeKit. It is then simple to link the Hue Dimmer switch buttons to the TP-Link switch to turn it on and off.
As a bonus, if your switch names are descriptive enough, you can turn the switches on and off using Siri, e.g.
“Hey Siri, turn bedroom two plug light on”
Prerequisites
- HomeKit with either an iPad or Apple TV to act as the hub - see here for more details: https://support.apple.com/en-us/HT207057
- You need to have integrated Hue devices (or the switch at least) into HomeKit using the official Hue app, via Settings -> HomeKit & Siri (make sure there’s a tick mark next to the dimmer switch under Accessories)
- Check that the Hue switch appears in the HomeKit app
- Homebridge installed and configured - see Homekit/iPhone Multi-user Presence Detection Using Homebridge
- A pluggable wall switch such as the above mentioned TP-Link
- Philips Hue latest firmware and confirm that Hue Dimmer switch appears within HomeKit
How-to
- First of all, make sure you have “switch” in “supported_types” within the config.json file so that Homebridge passes on any switch configured in HASS to HomeKit.
"supported_types": [
"input_boolean",
"switch"
],
- My TP-Link switch is configured like this in configuration.yaml
switch:
- platform: tplink
host: 192.168.0.9
name: bedroom one plug light
- platform: tplink
host: 192.168.0.10
name: bedroom two plug light
- If you add the switch after configuring Homebridge, you will need to restart the Homebridge service.
a. If installed on Hassbian and you followed my instructions linked in the prerequisites:
sudo systemctl restart homebridge
b. Check the logs using (use shift+g to jump to the bottom of the log):
journalctl -u homebridge
c. Look out for this line confirming accessory was added:
Nov 05 16:28:48 hassbian homebridge[5612]: [2017-11-5 16:28:48] [HomeAssistant] Initializing platform accessory 'bedroom two plug light'...
-
Check the new switch now appears in HomeKit on an iPhone or iPad. Test it by pressing the icon to turn on/off.
-
To configure the dimmer switch, you first need to remove the actions for the buttons you want to use. For example, I use the middle two dimming buttons for on/off, leaving the other two for the main room light. Remove the actions from the desired buttons in the Hue app.
-
Within HomeKit, find the Hue Dimmer switch that you wish to use.
a. Press and hold the icon of the dimmer switch to bring up the accessory summary
b. Press Details
c. Press Add next to Button 2 Single Press (if you wish to use this button to turn on)
d. Select the HASS switch and press Next
e. The switch will be off by default, so press to indicate you want it to turn on.
f. Do the same for Button 3 -
Everything should now be set up, however bear in mind it seems to take at least 6-12 hours for the dimmer buttons to work with HomeKit! I’ve no idea why they don’t work straight away, and it doesn’t seem to be a homebridge issue either because I assigned a Philips light to the button within HomeKit which didn’t work either. As long as you can turn the TP-Link switch off within HomeKit it should work eventually.