vchlum / hue-lights

Gnome Shell extension for Philips Hue compatible lights controlled by the Philips Hue Bridge and for controlling Philips Hue HDMI sync box.
https://extensions.gnome.org/extension/3737/hue-lights/
MIT License
196 stars 14 forks source link

Sync lights with powersave mode (feature request) #38

Open tschuett68 opened 3 years ago

tschuett68 commented 3 years ago

It would be great if I could sync lights with scrensaver or powersave states. My desktop lights are hue contollable. It would be great, if they would switch off when the computer goes into power save and come back on, when I log in again. The signals seem to be a bit all over the place - so that could be a problem https://unix.stackexchange.com/questions/28181/how-to-run-a-script-on-screen-lock-unlock But checking for signal looks pretty straight forward in gdjs https://askubuntu.com/questions/170263/gnome-shell-js-listen-for-dbus-signal-on-an-interface-for-any-path

Love the extension. Keep up the great work.

vchlum commented 3 years ago

HI @tschuett68 !

I already wanted to add this feature.

I ended with the following issue so far: I wasn't able to reliable turn off the light on logout/screen lock/... The only suitable place is the destructor of the extension. The destructor is called on suitable occasions, but the extension is destroyed too early - before the asynchronous request can be issued/finished. So turning off the light(s) is problematic.

I will check out the link you have suggested. Thank you. Not sure if hooking up the screensaver is reliable. I will try it. Maybe there is some suitable signal, which I do not know about yet. I will try to search again.

Meanwhile, you can try the feature 'entertainment areas' - if you wish. This feature can work in the way you request. ..or in a similar way at least:-) You can create an entertainment area on the original mobile app. Once the entertainment area is created, you can enable the entertainment area to start on login/screen unlock. The lights will eg. synchronize your desktop. The entertainment areas use a stream, which means once you log out/lock the screen the stream will not continue. The extension is destroyed and the bridge will set the lights to preset settings - e.g.: lights can turn off. You need the Philips branded color lights for entertainment areas. Does it help?