[RELEASE] Day Lights - an iteration of Circadian Daylight

Btw, looking at the code, the way to solve the "external dimming" issue I mentioned, would be to add a subscription to the device brightness in addition to power state. I meant to have a look through the Dev docs today, but haven't gotten around to it.

if (colorTemperatureDevices) {
        subscribe(colorTemperatureDevices, "switch.on", eventDeviceOn)
    }
    if (colorDevices) {
        subscribe(colorDevices, "switch.on", eventDeviceOn)
    }

So I can confirm that subscribing to the dim level (I’m not sure if I have this correct, but it works) does allow the app to ensure the right colour temp is applied when the brightness changes.

if (colorTemperatureDevices) {
        subscribe(colorTemperatureDevices, "switch.on", eventDeviceOn)
        subscribe(colorTemperatureDevices, "level", eventDeviceOn)
    }

I haven’t figured out how to send the hue and saturation values - I ran out of time today to investigate it.

I found an error in the OG code that calculates the HSV values and have updated the code on GitHub with the fix. Color devices should display much nicer now. Having said that I've been able to determine that my Tuya bulbs (using the community cloud driver) don't respond well to all the activity that this app generates for whatever reason. When I switched my test device to something that was directly paired with the hub the results were excellent.

While looking into this I took a bit of a dive into the world of HSV. I've got some ideas about implementing a Sunrise/Sunset scheme for color devices down the road.

I have also updated the settings page to clarify that "Color Temperature Devices" will work with CT values, and "Color Devices" will work with RGB/HSV values.

1 Like

Did you also add support for RGBW bulbs using my suggestions? I find it works really well.

So you're saying that the only way to get your bulbs into CT mode is to set hue and saturation to zero?

For every bulb that I have just setting a color temperature flips the bulb into CT mode. But if your answer is yes then I don't see why I couldn't add an option to set the hue and saturation to zero for all CT devices at initialization, device on, and start of day events. It would be up to the user to ensure that all the CT devices are RGBW as I would guess that sending that command to a tunable-white bulb would throw an error.

New version on GitHub with an option to attempt to force CT mode by setting the saturation to zero on a device in the Color Temperature group that is in RGB mode. This will happen any time a bulb is set to be updated, not just in the events I mentioned in my prior reply.

I found an old thread that discusses this very thing regarding LIFX bulbs. Based on that I went with the strategy to only set the saturation to zero. Let me know how it works for you.

And a special shoutout to @marktheknife for fixing a typo that I have been completely blinded to!

2 Likes

This is awesome!! Thank you for iterating on a classic.

@adamkempenich s work for circadian daylight is what started my smart home journey! I’m stoked to try what you’ve done

Have you considered getting your app into HPM so updates are easier?

2 Likes

Yep, seems to be a LIFX quirk.

Ah good, I’m glad I wasn’t imagining things.

Thank you, I’ll test it out today,

Btw, did you add the detection for brightness changes that I cobbled together?

I just tested this, and the level check line isn’t there. Can you please add this? Otherwise you get incorrect colour temps (at least on Lifx bulbs) until the next automated change takes place.

The other changes work great tho, thank you.

Ps I found a bug- if you go into the brightness options and don’t make a change, you can’t exit that section.

Got it, just updated github. It's a slightly different change than the one you came up with - I made it an option on the main page right below Dynamic Brightness, but the gist is the same. I put in a fix for the bug in brightness options as well.

It seems that I misunderstood both of your issues at the start of this, thanks for your patience!

1 Like

All good, I’m just happy you could make the changes I requested. This app allowed me to get rid of the homebridge app from my Hubitat hub.

:vulcan_salute:

Edit: lovely work, that works perfectly. :ok_hand:

1 Like

wondering if someone can help me - i've used the original for a while and found it to be exactly what i need - varies my lights to the right CT through the day - but i was 100% positive there was a mode override that meant it was disabled when my hub was in night mode. i recently added one of my bedroom lights to it (the one that comes on when i get up to go to the loo in the middle of the night to stop me tripping over and killing myself), but noticed as a result that it is running 24 hours a day.

has something changed, or have i mis-remembered how the original worked? also, does this new version allow for mode disablement?

thanks for all and any help

There a bunch of mode based overrides in here:

But for bedroom lamps, I turn off dynamic brightness.

hey, thanks for coming back to me. they're the options i recall, but this is what i have now: (app shows it's not been updated since 2022. am running latest version of hub software)

Go into the development section and apps code, then into the daylight driver. You’ll see an import option.

Paste this URL in:

https://raw.githubusercontent.com/OldChicagoPete/Hubitat/main/Apps/Day%20Lights/DayLights.groovy

Then click import. And then save.

You should noww have the latest and best version by @OldChicagoPete

done that and the page looks pretty identical to the last version. i'm sure there used to be an option that just disabled the whole app from running when the hub was in a given mode (in my case night mode). that way when i come downstairs at night all my lights go red, and stay red, so i can see where i'm going. with the circadian app running, they get reset to the last colour temp as soon as they come on.

As I remember from using Adam's app, at the end of the daylight hours it would "reset" the bulbs and I ended up using the mode overrides to keep the bulbs at a lower brightness after sunset and/or as the bulbs turned off and back on. In fact that was the driving factor for me to take a look at the code in the first place which led to me developing this version of it.

Having said all that, both apps have the option to disable via a switch. In your screenshot the Disable Circadian Daylight Options button will lead to another page with a section named "Disable Circadian Daylight when the following switches are on:" where you can choose a switch (or switches) that will stop the app from messing with your manual updates. All you'd need to do is turn the switch on in Night mode when you set the bulbs to red.

1 Like

aha, yes, of course, it's that simple. i can toggle an override to disable the flow at Night and toggle it off when the mode changes away from Night. that'll do it!

thanks for all your help, both

2 Likes

I'm new to all this so I don't really know the best way to address this. I have this app running on all my smart can lights on my living room but I realized that if I just turn a couple of them off, they are turned back on by the app during the next adjustment. Is it possible to have an option for the app to ignore lights that are turned off?

One option I figured was to set up every light on a separate instance of the app and add the override but I'm sure there's an easier way. Thought?