studioimaginaire / phue

A Python library for the Philips Hue system
Other
1.53k stars 267 forks source link

add initial scene support #73

Closed sdague closed 7 years ago

sdague commented 7 years ago

The following adds some basic scene support, including a Scene base object, the ability to list all scenes. The ability to activate a scence by group_id and scene_id, and a convenience method to activate a scene based on scene name and group name.

It is intended to be the basis for making automation rules in home assistant be easier to write.

Addresses https://github.com/studioimaginaire/phue/issues/50

natcl commented 7 years ago

Thanks !

DarioBernardo commented 5 years ago

This is no longer working, the property scene on the bridge is not working anymore. If you do b.scenes you'll get return [Scene(k, **v) for k, v in self.get_scene().items()] TypeError: __init__() got an unexpected keyword argument 'type' it looks like the scene returns a new parameter type that the Scene constructor is not using

natcl commented 5 years ago

This works with my setup, can you give more details on your setup, is it with the new version of the Bridge ?

Cazfri commented 5 years ago

@DarioBernardo are you using version 1.0 (the version on PyPA via pip install phue)? You need to download or clone the source code to get the most recent fixes. The version on PyPA is out of date.

DarioBernardo commented 5 years ago

Yes, I have installed phue through pip, so probably that's the problem. I tried to clone the repository and use the script there, but that way I get another problem return json.loads(decodeString(response)) File "/usr/lib/python3.4/json/__init__.py", line 312, in loads s.__class__.__name__)) TypeError: the JSON object must be str, not 'bytes' Basically the JSON loads function expects a string and instead receive bytes. I am using python 3.4. Should create a new issue for this? thanks

natcl commented 5 years ago

What are you calling exactely when this error occurs ?

Le mar. 8 janv. 2019, à 05 h 41, Dario Bernardo notifications@github.com a écrit :

Yes, I have installed phue through pip, so probably that's the problem. I tried to clone the repository and use the script there, but that way I get another problem return json.loads(decodeString(response)) File "/usr/lib/python3.4/json/init.py", line 312, in loads s.class.name)) TypeError: the JSON object must be str, not 'bytes' Basically the JSON loads function expects a string and instead receive bytes. I am using python 3.4. Should create a new issue for this? thanks

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/studioimaginaire/phue/pull/73#issuecomment-452253830, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEu9HrjjYV3H8zE58E2g6OON9Gfn27Kks5vBHXggaJpZM4KfPpe .

DarioBernardo commented 5 years ago

any operation on the Bridge, I've tried b.get_light_objects() and b.get_group(). It works with the pip installed version.

natcl commented 5 years ago

Do you have a .python_hue file in your home directory? I can't seem to reproduce here using Python 3.6 Do you have another version of Python you could test with?

-- lecaude.com studioimaginaire.com

Le 8 janv. 2019 à 10:00, Dario Bernardo notifications@github.com a écrit :

any operation on the Bridge, I've tried b.get_light_objects() and b.get_group(). It works with the pip installed version.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.

natcl commented 5 years ago

Any updates on this? I'd like to do a release and need to know if it works, wasn't able to reproduce on my side.

DarioBernardo commented 5 years ago

Hey sorry, the error is still there, unfortunately I haven't been able to look into it further. I'd suggest to do the release and I will try to look into it more one of these weekends. Thanks

DarioBernardo commented 5 years ago

Hey, I finally had time to dig into this. Apologies, it was my mistake, as you said, it works with the git version (doesn't work with the pip version). I had a clean installation and it worked, I may have messed up something when i tried the first time. Thanks

natcl commented 5 years ago

Thanks for the follow up, will prepare a release then!

-- lecaude.com studioimaginaire.com

Le 19 janv. 2019 à 16:31, Dario Bernardo notifications@github.com a écrit :

Hey, I finally had time to dig into this. Apologies, it was my mistake, as you said, it works with the git version (doesn't work with the pip version). I had a clean installation and it worked, I may have messed up something when i tried the first time. Thanks

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.