-
-
Notifications
You must be signed in to change notification settings - Fork 117
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
Added support for entertainment api v2 (hue gradient strips) #471
Conversation
As another note, it seems that the light ids no longer appear to match up to a single light. This may be because I have multiple gradient lights, but they seem to affect different zones instead of the individual lights. This makes placing light locations much more difficult. |
That's what I've been using to try to place them the best I can. The issue I'm having is that a single light id is affecting multiple separate lights. I'd 0 will blink my play strip, my gradient floor lamp, and table lamp. As a result I can't separate each light segment into its own channel . |
|
The only way that will happen is if you have multiple lights on the same channel. Would you mind making an api call and sharing the response here? I can prepare it and send to you if you are interested. |
Sure, happy to help. May take me a day or two to run it but I'm more than happy to. |
curl --location --request GET 'https://{{HUE_IP_ADDRESS}}/clip/v2/resource/entertainment_configuration' \
--header 'hue-application-key: {{HUE_USERNAME}}' curl --location --request GET 'https://{{HUE_IP_ADDRESS}}/clip/v2/resource/entertainment' \
--header 'hue-application-key: {{HUE_USERNAME}}' |
I am on it |
Running the commands with https gives me root@LGwebOSTV:~# curl --location --request GET 'https:/(IP_Address)/clip/v2/resource/entertainment_configuration' --header 'hue-application-key: (HUE_KEY)' removing https and placing http gets me (Apologies for the photo. it wouldn't post the code without turning to links) Did I do something wrong on the install? |
HI, I have added the curl --insecure --location --request GET 'https://{{HUE_IP_ADDRESS}}/clip/v2/resource/entertainment_configuration' \
--header 'hue-application-key: {{HUE_USERNAME}}' curl --insecure --location --request GET 'https://{{HUE_IP_ADDRESS}}/clip/v2/resource/entertainment' \
--header 'hue-application-key: {{HUE_USERNAME}}' |
Enertainment zone is called Game Zone. I am aslo getting the same messages with the --insecure tag. |
Was able to get the files. Turns out I just needed to change the port to 443 in the curl command. Entertainment zone is called Game_Zone. |
You have multiple lights in a channel. I suspect this is due to how you positioned your lights in the entertainment configuration so there is some overlap. This means that when you click that identification button, whichever device that lights up have channels that will show the same color. If you could send a screenshot of your game zone light placements from the hue app, that will help me confirm or disprove my hypothesis. If I am correct about the above, In the meantime, I will update this PR to identify channels instead of lights for v2 (only the channels will light up instead of the entire light). |
It seems I have too many lights for the placement workaround to work. Is there a way to seperate the channels back to lights in the v2 api?. |
Did you try placing them very far apart even towards the couch in the image above? Please note that this issue you are experiencing is just for initial placement. Just complete the wizard, everything should work as usual. If the placements are off, you can correct this in the "led layout" tab in HyperHDR. Please try that and let us know the outcome. I will update this PR so that it's just the channels (segments) of gradient strips/lamps that flash not the entire light/lamp. This should cause less confusion than flashing the entire device |
If you complete the wizard and start syncing, what behavior do you experience? |
Same as before unfortunately. Multiple lights light up when testing channels |
@awawa-dev I just pushed up an update to the identify for v2 api. This update flashes the channels (segments) of a gradient strip for instance instead of the entire light. This should help with Identification. Please review @dbell669 Please update to the latest push and let us know what you experience. |
Will take a look. I have pushed up adding an identify to led layout tab. Now, this is expected to work with other led devices please take a look. I had to update the signature of some other files. I am happy to change it if you have any issues |
As far as global signals go, I don't plan any changes there just for the single API method which doesn't need to be propagated further than the single instance: just add new method to the HyperHdrInstance to set some new properties like index of the LED to blink and timeout (please use internal timers, you have direct communication from JsonAPI/API to HyperHdrInstance each running on different thread, preferably set new properties asynchronously instead of the blocking invoke) and later include them both in HyperHdrInstance ->updateResult processing which already includes similar solution for disabled LEDs. |
I think to use new identifyLed from HyperHdrInstance for that purpose. |
This line I tested out the identify you just pushed and it works well on v2. If I comment out the line above, I am able to identify only if I have an existing Philips hue v2 configuration and I select the same entertainment configuration (group). I also made some adjustments to workaround the lightscount errors. I think a combination of this and the other one that initialized the UDP connection in identify should give us a working solution. |
Thanks for the fix. This need to be investigates further in such case, cant reproduce it on my system...maybe some differences between our configurations and I tested it for API v1 (moved that part to v1 section in same function and changed caller id for the Identify) I will take a look tomorrow. Which browser do you use ? |
OK, I think I have fixed it. |
Any other tests needed from my end before I start tinkering with the other types of led strips? |
I have confirmed they both work for my setup |
Yes, but @dbell669's configuration is/was more problematic and started these numerous changes in the wizard ;) It would be good to know the final result. |
Ok. Just tested. It seems like the lag issues on identification are gone, and the identify button in the led layout page works well. The channels are still blending though. Is that just how the V2 API operates? |
Thanks @dbell669 for the feedback. @gibahjoe I refactored the code reducing shared code between 2 Philips Hue classes (finally ~550 new lines instead of ~1700 in single class, it will be easier for me in future to maintain that driver) and fixed some minor issues e.g. saving/restoring state when V2 is used. You've done a really great job 👍 I have reviewed and refactored all the code and have no plans to make any further changes on my part. I'm wondering whether to include this PR in v19 or in the next v20. I freeze v19beta2 ahead of final release, but we still have some time to test this PR. What do you think? |
Thank you. I think releasing earlier rather than later is better so we can get feedback from a wide range of users. So, v19. |
OK, merged into the master branch |
works really good for me, thanks! |
@gotschi did you try to use the context menu later in the LED layout designer to correct it later? You can resize them and change their position as you want. Usage: #379 In the wizard where you configure the hue options, the lamp position & size options are limited. I can add later few predefined lamps but I must know their size/location...beside the list is long and it's hard to find a proper element already. |
oh yes, changing the values in the properties menu works, I think it glitched out earlier for me |
@gibahjoe I post a short post on my blog for each version. May I use your photos(https://user-images.githubusercontent.com/9147147/209718749-43eb2d07-2d36-4db5-9120-86ae0ed60f06.png) in the description of the API v2 feature that you implemented in version 19? |
@awawa-dev Yes that's fine. Sorry just saw this. |
Summary
This PR adds support for Philips hue entertainment API version 2. Version 1 of the API does not support the gradient light strip showing multiple colors of light. In the entertainment API v2, the concept of channels was introduced. This means that a hue light could have multiple channels (e.g the gradient light strip)and a channel could have multiple lights and it's these channels that are addressed when coloring the lights. This feature can be enabled as described in the attached image.
What kind of change does this PR introduce? (check at least one)
If changing the UI of web configuration, please provide the before/after screenshot:
Before
** After **
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing setups:
The PR fulfills these requirements:
To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.
Other information:
Power off on black
has been removed when using API v2Disclaimer
This is the first time I have programmed in c++ since the days of BlackBerry 10 OS. So if there are any issues, let me know.