-
Notifications
You must be signed in to change notification settings - Fork 0
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
Issue with hue-scheduler taking over when triggering specific scene using smart switch. #10
Comments
Hi, thank you for your kind words and for opening the issue. I wasn't aware of this behavior. While you are correct that Hue Scheduler behaves as intended in such cases, it is indeed annoying to have to trigger scenes twice. I agree it would be nice to ignore turn-on events for the affected lights in such situations. I took a quick look at the available API events that could be used for this and found a possible solution. Unfortunately, it seems this is only possible when directly connecting to the Hue Bridge or when triggering scenes via Home Assistant. I was unable to detect scenes being activated when they were triggered via the Hue Bridge (i.e. smart switch or Hue app) while Hue Scheduler was connected to Home Assistant. This seems to be a limitation of the Hue integration in Home Assistant. I will take a closer look over the next few days on how to implement this for the supported setups and keep you posted. Thanks again for the feedback and for suggesting this improvement - it really helps make the tool better. |
Hey hey, Sorry for the late reply. It was midsummer here in Finland and I was away from home. Another difficult time for sun-based lights, as the sun never goes down... Anyway, as for the subject. Does the smart switch send out a "activate this scene" type of call and the scene is saved (and activated) on the bridge? If it is, I guess you could detect lights being turned on after X seconds after such a call was made and ignore those for scheduling. I do application architecture myself, so I know it sounds a bit bubblegum-ish of an approach to solving this issue though =/ The Kelvin application goes around this limitation by implementing a scene that you crate in your app. Be it "kelvin kitchen" or whatever. The app recognizes the kelvin keyword and constantly updates this scene with the scheduled values for each room and light. This way, when you turn on the lights using this scene, they are always at the right brightness and temperature from the get go. Seems like the Hue API reference guide requires a developer account. If I have some free time, I might give it a look as well and see if I could maybe come up with some ideas to help out. -Juha |
Hi, no worries! Sounds fascinating--I haven't yet personally experienced the sun never setting. Thank you for taking the time to share your thoughtful suggestions. The approach you suggested is exactly what I was working on (see #12), and I've successfully released an initial version of this logic in v0.11.0. In summary, Hue Scheduler now listens for "scene activated" events from either the Hue Bridge or Home Assistant. It identifies any lights or groups affected by the scene and then ignores any subsequent turn-on events for the next 5 seconds for them. Given that our observations are limited to API events, I believe this is the best approach we can take. As already mentioned, this does not work when Hue Scheduler is connected to Home Assistant and scenes are triggered by the Hue Bridge instead of HA directly. It seems that the relevant "scene activated" events are not forwarded to the HA event stream in such cases. Please let me know if v0.11.0 works with your setup. I'm open to further ideas. I believe there a still many cool features to implement. Updating special scenes like Kelvin also sounds interesting. Similarly, I was thinking about using scenes to control the expected schedules, e.g., "Kitchen (sunrise)", "Kitchen (09:00)", etc.. I also like to focus on creating conditional states--states that are activated only when certain conditions are met, such as other lights or devices being on or off, or when they have specific states, like a temperature above a certain level (when using Home Assistant). Best, |
It works great. Read you reply about the new version early in the morning and never got around testing it. Came back home late at night and figured the automatic update of running containers must have run on my home server and the scene should stay on when I just walk in to the office and press the scene button of my smart remote. And it did. I mean if it's stupid and it works, it's not that stupid. Wonderful work and thanks a bunch for the update to the app. Keep up the good work! My wife is gonna be amazed when I tell her that "oh, by the way, the reason the lights work like you want them to is because I talked to this guy online". God bless the internet =D -Juha |
One more idea, that might have some value if you plan on implementing constantly updating scenes like Kelvin. The config yaml shoud have one optional extra attribute per line "scene: XYZ " that is a string match to a scene the user has set up on their bridge (think "scheduler-livingroom", "scheduler-kitchen"). If there is a change for that scene at that point in the scheduling update (be it a schedule for another room, or the one for "kitchen" itself), it will update it thustly. Most of the time, I assume, people would just put in the scene they want to update on all the lines per room, if they want to use the functionality, but there might be some situation where you want a particular scene to update (so update your "scene" button on the smart remote according to associated "scene: something" schedule config lines), but your room "on" button to follow another schedule. Havent thought it quite through, but might work. -Juha |
Unfortunately I have to come back to this. After some further testing, it would seem I am an idiot. The functionality works great and it detects when a scene has been triggered and it will not activate scheduling in those cases. However, the issue is that from the smart switch, there is no "turn lights in room on" as you can do with the phone app. When you press the smart switch power on button, it always triggers some scene, which of course in turn disables scheduling. The only workaround I have found is to use the "scene cycle" behaviour for the smart switch on -button and have the first option to be the "last on state". This way, when you press the power button the lights turn on at their previous state, which is not a scene and the scheduling can take over. This is a bit of an inconvenience and I'm not sure if my suggestion for the solution was such a good one after all... I can get my home setup working with the workaround I mentioned, but other users that find your app might not realize that this is what you need to do to get it working as they wish. -Juha |
Thank you for the updates and the additional thoughts on the scene sync feature -- I will come back to that later, I have some ideas and also some questions on that. But first I would like to better understand the situation regarding the smart switches. I don't configure my switches through the official Hue app, but rather use iConnectHue, which features some more advanced configuration options. But I just had a look at the official app, and at first I was also a bit confused on how to simply turn on my lights, without setting a scene (the default seems to be now the new day-time dependent one). But after some trying, I figured out that I could just select the "Light off" setting for the "on" button. Which is not a great name, because it does not just turn-off your lights, but also turn them on again just fine. And in my tests, this works great with hue scheduler, as it takes over normally like it did before. Is this something that would work in your case? I only have the v2 Hue smart switches, but I think this should also be possible for the first generation. But I agree, it could be a bit confusing for new users of the app, since the default way for those buttons seems to be scene based now. |
What you described would be perfect, so I could set all the "on" buttons on my switches to default to the scheduling and have the lower "hue" button trigger scenes that I have set up. For whatever reason though, my v2 smart switches do not work as you described. If I define the "on" button behaviour to be turning lights off, it does that, of course, but never turns on the lights again, no matter how many times I press. I also tried it via a roundabout way of setting the "on" button behaviour to be single scene and that scene is "lights off". Same result. I will try and google if there is some documentation about this functionality and if there is perhaps some bridge -related setting that defines how the "lights off" call is handled. For now, it would seem our switches and bridge work slightly differently with no good explanation as to why. For the time being, my workaround is setting the "on" button to be scene cycle. The scenes in the cycle are "last off state" (which leads to scheduling like I want) and "lights off". So I press once -> I get scheduling. I press twice in a row -> lights turn off. This works perfectly fine for me, but it would be a bit nicer if the "lights off" functionality worked as you described. Easier to document and understand as well for new users. -Juha |
This is indeed rather strange; thanks for the follow-up. I can't explain why our smart switches are behaving differently here, but I'm glad you found a workaround. Regarding the scene sync feature: I believe it could also solve those issues and improve the overall turn-on behavior of lights. To clarify your proposal: you want to add a new optional "scene:" attribute to the configuration lines. If this attribute is present, Hue Scheduler would regularly update the scene configuration with the expected light states in the background. With such synced scenes, we could trigger the referenced scene via a smart switch or even a motion sensor, and the lights would immediately turn on with the correct light state according to the defined schedule, rather than Hue Scheduler updating the lights after a short delay. Hue Scheduler would, of course, disable its "ignore turn-on" feature for those synced scenes, ensuring the lights continue to be updated after being turned on this way. This way, you also wouldn't need to turn your lights off and on again for Hue Scheduler to take over. This sounds like a great idea and would solve some of the issues I have with my motion sensor in combination with Hue Scheduler. However, I'm still a bit unsure if I fully understand your example regarding multiple different schedules and the smart switch. Intuitively, I would implement such a feature like this: For every room or scene with an associated schedule in the configuration file, Hue Scheduler would automatically create a scene (e.g. "hue-scheduler" or another predefined name) and update it regularly in the background. This way, you wouldn't have to add the "scene:" property to each configuration line or create those scenes manually. What do you think? |
Based on what you wrote earlier, I think we are on the same page about the core functionality and how it would work. Like you said, if there is a scene that is controlled by hue-scheduler, it could be triggered by whatever you want and it would always be at the correct state in scheduling right from the moment of the light(s) being turned on. "For every room or scene with an associated schedule in the configuration file, Hue Scheduler would automatically create a scene (e.g. "hue-scheduler" or another predefined name) and update it regularly in the background. This way, you wouldn't have to add the "scene:" property to each configuration line or create those scenes manually." ^^ I like this idea. This way you don't have to create the scene in your bridge manually for a particular light or room, because it's being handled by scheduler. After that it's up to you if you want to associate that scene to some smart switch, movement sensor etc. actions in your app of choice. You could also make it a "create_scene: true/false" -attribute per room/light configuration for those people who really don't want anything to do with scenes. I was already thinking of how to implement it in the config file on my own, so I'll post it here anyway, although I think your suggestion would work better. My idea was to have the config work as follows: "" The functionality would be exactly the way it is with rooms and single lights, but you could distinguish updates to scenes with the scene. -prefix, followed by the name of the scene. If scheduler finds a scene with that name, it will update it accordingly. Whichever way you decide to go, I'm sure people will be happy with the new options and I think both options should also be possible to be made to be backwards compatible, so that if you don't want to use the scene updating functionality, your old config file will work just fine. -Juha |
Hi @Sepetto, sorry for the delay in getting back to you. I've finally released v0.12.0, which includes the new optional scene sync feature. You can enable it by using the With the scene sync feature enabled, Hue Scheduler now automatically creates synced scenes for all your rooms and zones affected by your schedules. This even works with schedules controlling single lights that are part of multiple nested zones. I'm still working on fully supporting overlapping schedules, which would make it easier to define general schedules for a room while overriding specific lights with custom schedules. Let me know if you'd like a more detailed explanation of how the sync is implemented. Thanks again for the great suggestion and your feedback on improving the scheduler -- really appreciate it! |
Hey Stefan, I was delighted to see last week one morning that my docker container for hue scheduler had automatically updated (via watchtower). I immediately opted in after having read the patch notes and went to try out the new feature. The way I have set up my smart switches now is that my "on" button triggers the HueScheduler scene for all my rooms and it works perfectly. Every time I turn on the lights, they are at the correct brightness and temperature. No more adjustments to either after having turned on the lights. Perfect. Also my scenes work without any issues and as far as I can tell, it's a wonderful update. Thank you for your work regarding this issue! -Juha |
Thank you for the great feedback and kind words—I'm really happy to hear that the update is working well with your setup! I'm also glad my lights have stopped blinding me at night, and the recent redesign of the smart switches to focus more on activating scenes fits in nicely. For the next release, I plan to add synchronization in the other direction as well. This would allow you to define schedules by creating scenes in the Hue app and naming them with the desired start time (e.g., "Sunrise" or "20:00"). Hue Scheduler would then automatically pick these up and adjust its schedule accordingly—essentially providing a GUI to easily define and update your schedules. Let me know if this is something you'd be interested in. As always, any feedback or suggestions are much appreciated! |
Hey hey, Very interesting idea. I didn't quite understand what the purpose was at first, but I assume you mean that I could create a new scene, say 'HS 20:00' and define the color temp and brightness for that scene and Hue Scheduler would notice that, import the adjustment to the HueScheduler scene and delete the 'input scene' that you used to make the change? I like it, although in all honesty, I'm probably not going to be using the feature too much. I have pretty much 'set in stone' the cycles I want to use and I'm very happy with the functionality as is. Also, if I DO have to make changes, I prefer command line or editing some yaml. But that's just me. Other people might prefer doing it by using the Hue app, so I do think it's a worthwhile addition to make. I can't come up with any kinds of other changes that I would need or recommend for you to implement, so as far as I'm concerned, this issue is resolved and if I come up with some new ideas or feature requests, I can open another issue and discuss things further. Again, thanks for the app. It really is the best one out there right now in my opinion! -Juha |
Thank you for your follow-up and feedback on the new feature idea! You got it mostly right, with just a small clarification: the scheduler wouldn't delete your created scene but would instead use it as an additional way to define schedules, alongside the text-based configuration file. One benefit of this approach is that you wouldn't need to restart the scheduler after updating a schedule (time as well as state), as it could automatically detect changes to scenes and adjust its behavior immediately. It would also make defining color states, including gradients, a lot simpler compared to using hex or RGB values in the text file. But I totally understand if you don't feel the need to update your schedules regularly. The text-based configuration will definitely stay if you prefer that over using scenes in the Hue app. Thanks again for all your input! |
Hello,
First off, big thanks for the application and the docker container, that you have recently released. Makes setting up a whole lot easier than working with Linux services etc.
I like the functionality a lot, along with the very granular configuration options and what not. My only issue is that when I am turning on e.g. my office "gaming" scene, hue-scheduler takes over after the light is turned on and changes the temperature and brightness according to the schedule. I understand that according to the documentation this is intended behaviour and I'm fine with triggering the scene twice at which point scheduler understands that I have "taken over control" and does not trigger any brightness/temperature changes for that particular light.
Now I don't know how the API works and what is possible, but my idea would be to try and recognize if a light was turned on due to a specific scene being triggered and at that point just ignore any schedules etc. Better yet, make that an attribute per room/light so that you could configure particular lights that you want to obey a schedule even when being part of a scene.
Again, I have no idea if this is even possible, but though I'd just throw this idea out there.
Thank you,
Juha
The text was updated successfully, but these errors were encountered: