Skip to content
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

Support V2 API in Hue Essentials #1015

Open
2 tasks
Thomas-Vos opened this issue May 23, 2024 · 4 comments
Open
2 tasks

Support V2 API in Hue Essentials #1015

Thomas-Vos opened this issue May 23, 2024 · 4 comments
Labels
Feature Request help wanted Help us fix these issues in progress Currently being worked on

Comments

@Thomas-Vos
Copy link
Contributor

Feature does not already exist?

I searched and did not find an existing feature request

Summarize feature

Before Hue Essentials can (primarily) use the V2 API, there need to be some changes to diyHue:

  • The Remote API in diyHue does not support the V2 API. This is due to the current URL endpoint https://remote.diyhue.org/bridge/ which forces to use the V1 API because locally it is /api/.

    To fix this, an additional URL endpoint needs to be added:
    https://remote.diyhue.org/route/
    This endpoint should locally be /. Which means Hue Essentials can use this URL like these examples:
    https://remote.diyhue.org/route/api/1234
    https://remote.diyhue.org/route/clip/v2/ (with hue-application-key header)

    Do not remove the /bridge/ endpoint as Hue Essentials is still using it. This is all in line with the Hue API, only difference is the diyhue.org host.

  • In the v1 api of diyHue, the endpoint /config contains two keys in the JSON object: Hue Essentials key and Remote API enabled. Hue Essentials uses these two keys to identify that this is a diyHue bridge, and also uses them for the remote api authentication.

    These need to be added to the v2 API so Hue Essentials does not need to load the V1 API everytime. I would suggest adding them to a special /resource/diyhue object. Preferably this would work the same as any other object, which means it is also returned on a call to /resource.

When these features are completed, I can enable the V2 API in Hue Essentials for diyHue. I really need to migrate the app to v2 as Philips Hue does not add anything to the V1 API anymore. To keep diyHue in line with the official hue api, this would be a nice addition.

@mariusmotea mariusmotea added the help wanted Help us fix these issues label May 24, 2024
@Thomas-Vos
Copy link
Contributor Author

Hue Essentials 3.0 will use the V1 API with diyHue for now. Only gradient light control in the colour picker and entertainment will use V2 API (and unsupported on remote API). All the other parts of the app still use V1 API.

Other V2 functionality will not work until this issue is resolved. Once resolved, I can enable the V2 API in Hue Essentials for diyHue after testing.

@Thomas-Vos Thomas-Vos reopened this Aug 5, 2024
@Thomas-Vos
Copy link
Contributor Author

Was closed automatically due to GitHub linking it to a (private) commit of mine. But this is still an issue.

@mariusmotea mariusmotea added the in progress Currently being worked on label Aug 6, 2024
@mariusmotea
Copy link
Member

mariusmotea commented Aug 6, 2024

Hi Thomas,

To understand correctly i need to clone the "bridge" part from here https://github.com/diyhue/diyHue/blob/master/RemoteApi/remoteApiServer.py#L79-L89

and change these:

        elif url_pices[1].startswith("route"):
----------------
                    bridges[apiKey]["action"] = {"method": "GET", "address": self.path.replace('/route/,'/')} 
GitHub
Main diyHue software repo. Contribute to diyhue/diyHue development by creating an account on GitHub.

@mariusmotea
Copy link
Member

@Thomas-Vos i implemented something:

rewrite = self.path.replace('/route/','/') if url_pices[1] == "route" else self.path.replace('/bridge','api')
                            bridges[apiKey]["action"] = {"method": "GET", "address": rewrite}

only concern i have is why for '/bridge" i route to "api" and not to "/api". I decided to route "/route/" to "/", hope this is ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request help wanted Help us fix these issues in progress Currently being worked on
Projects
None yet
Development

No branches or pull requests

2 participants