-
-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hue Dimmer Switch - any way to implement dimming behavior in HomeKit? Question. #222
Comments
No can do; you'd need push notification support from the Hue bridge for this to work reliably. Due to polling, there's a good change you'll miss one of the double presses. Best the v2 bridge seems to handle is polling once every two seconds.
The Hue app actually creates a CLIPGenericStatus companion sensor resource (actually more like a variable) for the Hue dimmer switch, to keep track of which mode it's in. homebridge-hue will expose this sensor to HomeKit (using a custom service and characteristic). While not supported by Apple's Home app, you can use this in other HomeKit apps (like Eve). I'd base the HomeKit automation on this status, instead of on the switch button action. The restore state is actually implemented by creating a Hue bridge / ZigBee scene on the fly with the current states, and restoring that scene later on. There's no similar functionality in HomeKit.
The Hue API offers commands to increase/decrease the brightness (or colour temperature or colour) relative from the current value. HomeKit only supports setting these to an absolute value.
I would strongly suggest to control your Hue connected lights from Hue bridge rules, and only control other HomeKit accessories through HomeKit automations. |
Thank you for the detailed response! I actually just read this thread as well - and together with your comments, I am now indeed onto something. Having a state is exactly what I need for a), I hope it will help me also cycling back to 'current' whatever it was. I need to look into this more. For b), it looks like I need to setup two GenericFlags in the Hue bridge: DimUp, DimDown and expose them to HomeKit. Again - awesome work here. Now I have to learn the Hue API... didn't expect that. |
That would work, but why go through HomeKit? You could create Hue bridge rules based on the buttonevent of the dimmer switch. If you want to use other HomeKit switches, this would be the pattern, although I'd use a single status with different values for the different actions. |
I want to control other HomeKit devices with it. The Hue lights are just a subset. I am using the Dimmer Switch as a generic remote control with 8 different gestures total. So if I attach Dim up and Dim down to the two single press events, I still have 6 more gestures left to play with!
Haven't fully familiarized myself with the types. If it's more than boolean, then of course. |
I got pretty far. I managed to add the GenericFlag to the Hue Bridge, homebridge exposes it to HomeKit. I now have the following setup: 1 Scene “CLIP On” that sets Integer to 1 Eve Automation: Dim Up triggers Clip On But now I realize I am back to square 1. Why? Simply because if I keep pressing the Dim Up button, it would not result in a change to the GenericState which means no rule will be triggered in the Hue bridge... |
Ok - I re-added the switch in Hue and restored the default behavior. Now I was able to study how these rules for cycle and dimming are implemented. They just use the state as an additional input condition! Now I know what to do, no questions for now. |
Note that unlike HomeKit, Hue bridge rules do not distinguish between triggers and conditions. Hue bridge rules fire when the “last” condition becomes true; (almost) any When you create a rule with a single condition, /sensors/xx/state/flag eq true, it only fires when the flag becomes (i.e. changes from false to true). Here the flag acts as trigger. When you create a rule with two conditions, /sensors/xx/state/flag eq true and /sensors/xx/state/lastupdated dx, it fires whenever the flag is set to true, regardlessof its previous value. Now lastupdatded acts as trigger and the flag as a condition. |
Is it possible to expose these commands to HomeKit through homebridge-hue, like dummy switch or something? It will be very useful to integrate with other HomeKit buttons or switches. |
Technically: yes, practically: no. I would need to define:
If you want this kind of functionality, create a CLIPGenericFlag sensor, expose it to homebridge as a switch, and use deCONZ or Hue bridge rules to change the light (and reset the sensor flag to false after a second or so). |
First of all, very great work on this hue plugin. Other than me spending hours finding my dimmer switch because I didn't add sensors = true, it worked right out of the box for me and it is well implemented.
The Hue Dimmer Switch is implanted with 2 actions per button - long press and short press. What a great improvement over how Hue imports it into HomeKit where it supports only a short press per button! I am actually trying to figure out if I can attach one more gesture like a double press to the buttons, wait for my pull request.
Nevertheless - I do experience some frustration. I am 90% sure this is related to HomeKit and cannot be solved with the homebridge-hue plugin but I want ask anyways!
My problem:
I want to use the Hue Dimmer Switch as a control within HomeKit to control scenes and other non-Hue accessories. For this, I have to detach or "free it up" within the Hue app.
The problem I have now is that I am losing some sophistication:
a) Hue supports a cycle mode 1-5 with the on button:
1st click = Restore last State, 2nd click = Warm, ...
I can partially implement this in HomeKit by utilizing the short and long click but I am still losing out on a full cycle mode and the restore state ability.
b) The Dimmer buttons are able to dim the lights up and down but retain their current color settings.
Instead of setting a precise seen after a click, Hue seems to be able to increment the current value (brightness) on every click. I am probably answering my own question here but it seems that the HomeKit app does not support this kind of action. I can only select a specific Scene or Accessory state which means I have to choose the light color and brightness.
Since no cycling is supported, this means I have to fall back to two gestures and fixed states associated to them.
I hope this problem description is clear enough... I will be trying to enhance a) by detecting more gestures for the button. But b) would require an 'increment/decrement' action on a specific accessory property and I think HomeKit does not support this unless I just haven't found it yet...
Any ideas would be welcome. The Dimmer Switch button is such a great tool.
The text was updated successfully, but these errors were encountered: