Hue 4-button Dimmer Switch Instant On/Off - No Polling

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

  1. 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"
	      ],
  1. 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
  1. 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'...
  1. Check the new switch now appears in HomeKit on an iPhone or iPad. Test it by pressing the icon to turn on/off.

  2. 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.

  3. 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

  4. 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.

2 Likes

Neato!

I’m converting to another Zigbee gateway but this is a great solution!

Awesome!

I followed your prerequisites but I can not integrate my Hue dimmer into homekit, only the lights are working. I do have Homebridge up and running, latest philips hue firmware and the Hue Dimmer switch does appear within HomeKit just with an exclamation mark, it says in HomeKit: this accessory requires a home hub to be used with the Home app

Any ideas if this could work without the apple home hub?

Best, Ruud

Oh heck, this is the bit I couldn’t test as mentioned in my first post:

HomeKit (you should be able to configure this with just a single iOS device, but I haven’t been able to test this myself)

I had hoped it would work without a hub but it seems to be a requirement unfortunately. A hub is either an iPad or Apple TV 4th-gen. I’ll update the original post to indicate this.

It would be well worth picking up an Apple TV though (4th-gen - doesn’t have to be the recent 4k one) because you can then do multi-user Presence detection (if both users have iPhones).

I used a different approach to use those as well in HA.

I know nothing about what protocol the Apple think communicates with the Hue thing, but shouldn’t it be possible for Home Assistant to get the same access to the Hue tap/dimmer switches as Homekit does? I’ve been wanting to add physical buttons to my setup, but have found Z-Wave to be too expensive. Hue switches are cheaper, but would only work with the lights and not HA. Until now? (I refuse to use any Apple products, even as a single-purpose proxy such as this.)

If you’re after a cheap switch that integrates nicely with HA, I’d recommend Xiaomi products! Their gateway is cheap, and so are their sensors.

Link to which sensors are available and where to buy them can be found here: https://smarthomehobby.wordpress.com/xiaomi-gateway-sensors/