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

Add scene support for scenes defined in Home Assistant #175

Open
finopsfuntimes opened this issue Jul 24, 2021 · 5 comments
Open

Add scene support for scenes defined in Home Assistant #175

finopsfuntimes opened this issue Jul 24, 2021 · 5 comments
Labels
confirmed We know what should be done to resolve the issue enhancement New feature or request

Comments

@finopsfuntimes
Copy link

Is your feature request related to a problem? Please describe.

I bought this light switch, which displays and allows you to activate Hue scenes for the chosen room.
Violet smart switch lite
It would be great to have this work natively with hass-emulated-hue !

Describe the feature that you would like to be added

Support for scenes:

  • Scenes defined in HomeAssistant should be exposed by the /scenes API route.
  • Scenes defined in HomeAssistant can can be recalled/activated by calls to the /groups/id/action route, specifying a scene ID in the request body as per the standard API.

Describe alternatives you've considered

I have used Postman to call the create scene API endpoint to define scenes manually, with some success.

Describe your use case for this feature

Exposing the scenes defined in home assistant will avoid having to create them manually and would be of benefit to all users, not just those who want to use the light switch I've mentioned!

Additional context

@finopsfuntimes finopsfuntimes added the enhancement New feature or request label Jul 24, 2021
@alexyao2015
Copy link
Member

One concern is that it wouldn't be modifiable through the hue API. The other major feature I would like to work on is the v2 api

@finopsfuntimes
Copy link
Author

The v2 api will be great to get implemented once we see the documentation for it :)

Could we just return an appropriate http error code if a user tried to edit a hass managed scene?

It would also be nice to have a config option to turn on the scene integration only if required.

@alexyao2015
Copy link
Member

The issue with error messages is that all apps won't necessarily respond correctly to it as its not something that is normally encountered with the normal hue bridge. While I'm not sure of the exact outcome, I would not be surprised if many if not all apps crash when trying to do that.

Regardless, will consider this for the future as development here has been slow.

@alexyao2015 alexyao2015 added the confirmed We know what should be done to resolve the issue label Jul 26, 2021
@finopsfuntimes
Copy link
Author

That's a good point about the crashes. I guess the other option is to discard the new values in the request and then return an OK response?

@finopsfuntimes
Copy link
Author

Made some changes in my own fork that have got this working for my use case - compare

All the existing scene functionality is retained, but now the hass scenes are exposed as well. Hass scenes are identified by the presence of an entity_id attribute in the scene config and as such, when the action to recall a scene is handled, the command is directed to hass to turn_on the scene instead of running the original code.

If a user deletes a hass scene through the api, the scene does not get deleted from hass and will therefore get recreated automatically the next time the /scenes endpoint is called.

If a user edits a hass scene through the api, the changes are not propagated to hass, so the changes have no effect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed We know what should be done to resolve the issue enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants