ebaauw / homebridge-hue

Homebridge plugin for Philips Hue
Apache License 2.0
900 stars 91 forks source link

Hue entertainment areas/Hue Sync #496

Closed sejoki closed 5 years ago

sejoki commented 5 years ago

Hey! I have a suggestion or rather the question if it's possible at all.

I just got two hue play bars to put behind my monitor and set up an "entertainment area" for them to work with hue sync (I'm surprised by how well it works, but not the point…) The problem is that whenever they're synced to the monitor, any input from HomeKit is just ignored. While it looks great, it's kind of a home automation nightmare, because now they've become the only lights that I have to turn of "manually" and can't turn off in a group.

From the hue app, it's possible to stop the synchronisation which turns the bars into a regular light again. Is there anything in the hue API to integrate this "killswitch" in homebridge-hue?

ebaauw commented 5 years ago

I haven’t looked into Hue Entertainment myself, but I think you can enable and disable it by setting the light state.mode through the API. To implement a kill-switch, you would have to ceate a Hue bridge rule with an action per light, to reset state.mode to ”homeautomation”. Create a CLIPGenericFlag sensor to trigger the rule; homebridge-hue can expose the flag as switch to HomeKit.

Hm, looks like state.mode is readonly. However, the entertainment area is a group (of type "Entertainment"), and you can stop the stream from there:

$ ph put /groups/2 '{"stream":{"active": false}}'

I can add a (custom) characteristic Streaming to entertainment groups to do this. You would have to configure homebridge-hue to expose the group to HomeKit, by setting "groups": true in config.json, or by whitelisting the group. Also, you would have to use Eve to stop the streaming (or to create a HomeKit scene, which can be recalled from Home).

ebaauw commented 5 years ago

In v0.11.29.

sejoki commented 5 years ago

Though I wasn't able to figure out how the whitelisting works (not a big issue, I don't use groups in the Hue app, so only the entertainment group shows up) the "streaming" characteristic does show up.

Thank you for the quick fix and the heads up with the Eve app.

IMG_0472

The only issue is, it's not possible to stop streaming and turn off the device at the same time, like it would happen when you trigger a scene. The route I went right now is create a dummy switch with a dummy motion sensor and two scenes to turn off streaming and turn off the light. Now in my scene to turn all lights off, I turn on the dummy switch (which turns itself off after 5 seconds) which fakes to sense motion for 5 seconds. In a rule, I trigger the scene to turn off streaming when it senses motion and when it stops sensing motion, turn off the light. It's as stupid as it sounds, but hey, if it looks stupid and it works, it's not stupid :P

It made me once again realise how limited HomeKit (and especially the Home app) is and how Apple needs to get their sh*t together with their own app. Having a third party app be able to control more in a framework they created than their own app is just ridiculous and embarrassing.

ebaauw commented 5 years ago

Though I wasn't able to figure out how the whitelisting works

You need to create a resourcelink on the Hue bridge through the API, see: https://github.com/ebaauw/homebridge-hue#configuration

The only issue is, it's not possible to stop streaming and turn off the device at the same time, like it would happen when you trigger a scene.

Did you try and put both the Streaming and Power characteristics in a single HomeKit scene? If the light Power doesn’t work, you might try the group Power and the other way round. You might try and increase waitTimeUpdate in config.json to delay the sending of the Power off command by more than the default 20ms, giving the light some time to snap out of entertainment mode.

Having a third party app be able to control more in a framework they created than their own app is just ridiculous and embarrassing.

While I’m not happy about it, I can understand the choice not to support custom services and characteristics. It might actually be a differentiator for the device manufacturer’s app. I really don’t understand why they don’t support all standard characteristics in Home, though.