Circadian Daylight: SmartThings + Smart Bulbs

lighting
hue
smartapp_lighting
osram

(Clayton) #1

Use your SmartThings Hub to sync your color changing lights with natural daylight hues

https://github.com/claytonjn/SmartThingsPublic/tree/Circadian-Daylight

Circadian Daylight slowly synchronizes your color changing lights with local perceived color temperature of the sky throughout the day. This gives your environment a more natural feel, with cooler whites during the midday and warmer tints near twilight and dawn.

In addition, Circadian Daylight can set your lights to a nice cool white at 1% in “Sleep” mode, which is far brighter than starlight but won’t reset your circadian rhythm or break down too much rhodopsin in your eyes.

Circadian Daylight works better with Hue Advanced (Connect)!


Special thanks to @juano2310 for working through some of the internal Hue code :), and a very special thanks to @Kristopher, who started this project. This SmartApp was a large contributing factor in my decision to purchase the SmartThings hub and Hue lights. All credit goes to him for this project, and I am very grateful that he has given me his blessing to continue development.


Feature Request for Gentle Wake Up SmartApp
Use cases for color smart bulbs?
[BETA] Hue (Re)Connect - with scene handling
Hue natural light simulation?
Night time gradual dimming w/ Osram lightify?
Hue Advanced (Connect)
Osram/Sylvania Lightify (it works)
Motion Present/Not Present
Fake Window lighting Mimicing sunrise to sunset- Hue
Lightify Gardenspot sale $27
Osram/Sylvania Lightify (it works)
[UPDATED as of March 24, 2016] Hue Lights & Groups & Scenes (OH MY!)
#2

Interesting idea. I noticed the selection of a Hue Bulb is “//” commented out…
It wasnt working selecting the bulb as a switch. I removed the comment, and selected the bulb, but it just turned on from motion, It did not change the color to 1% since its night now. Also, it doesn’t ask my ZipCode, how is it getting the sunrise/sunset schedule?


(Jody) #3

This is really cool. I was already using IFTTT to set my bulbs to 2700k at sunset. For those of you who work with computer screens all day I highly recommend the f.lux app as well.


(Kristopher Kubicki) #4

Good catch about the device getting commented out – the simulator is broken and you have to comment out the Hue itself when you’re simulating. Maybe @juano2310 can help fix that (its in the Hue (Connect) somewhere)

Its hardcoded to dim to 1% if you are specifically in a mode called “Sleep”. I believe I can make that a selector in the next revision.

You Hub should already know your zip code from the global settings. That’s where its pulling sunrise / sunset from


#5

It seems to me you need to add some required:false statements to this, so if you only want to rely on motion, or only on a switch state.

It would also be nice to set which mode it uses for “sleep”.


(Adam Anderson) #6

So this is amazing. The only thing I don’t like about your code is that if you don’t have one of the 3 options (switch, motion sensor, etc), you technically can’t run the app, it errors out. I simply deleted what I didn’t have in the code and it worked fine.

But my question is, do the “colors” you have selected work with phillips hue lux lights? IE the white variations only ones? If that’s the case, because they are so much cheaper, I’m considering filling the rest of my house with them.


(Kristopher Kubicki) #7

I’ll see if I can get a version out today that handles both of those requests :slight_smile:


(Kristopher Kubicki) #8

Thank you for the kind words Adam!

Right now it should work with any bulb that has a “capability.colorControl” - which to my knowledge is only the Philips Hue lights (via the ST bridge or the Philips Bridge).

I am going to add support for dimmers so they can at least get the sleep schedule component. So Lux would work with that.

There is also a new bulb on the market called Osram Lightify. It specifically only can color change along the color temperature space – so its basically the perfect bulb for this application but half the price of a Hue. I just got some last night so I will get those supported as well :slight_smile:


(Adam Anderson) #9

Where could I go about buying these Osram bulbs online? Amazon only seems to have the starter pack and Osram itself doesnt seem to be selling them. Thanks!

Also, seeing as they aren’t native to ST support-wise, are you going to write a device type for them as well?


(Kristopher Kubicki) #10

Hey Adam,

The bulb is here. You can pair it directly with ST - its super easy.

Install this device type first!

Let me know if you have any trouble!


(Adam Anderson) #11

Kristopher,

And these bulbs will also allow for the starlight setting (that setting is a gem for eyes at night)? And, just to be clear, I do not need the Lightify gateway because it will pair directly with ST hub correct?

Thanks so much for your help!


(Kristopher Kubicki) #12

Yes and Yes. They dim well and you do not need their Hub – they will pair directly with ST Hub. Just turn the light on while the Hub is looking for new devices.


(Brian Smith) #13

Makes me want to get some bulbs. But, I’m a zwave switch house instead. Hue bulbs just don’t meet the approval factor in the house at the moment. Everyone likes switches. :smile:


(Adam Anderson) #14

Could always do both. Smart switches with smart bulbs. You get your motion sensor bulbs, they get their switches, and both sides are happy. (The wife is also a switch person, so this is what I did)


(Kristopher Kubicki) #15

I do both. Its a lot more complicated to manage, it is a lot cleaner to have both. I added code to make the Jasco blue LED light light up with motion which everyone likes too. Too bad those aren’t color adjustable, that would be awesome.


(Adam Anderson) #16

Having never dabbled much in updating smartapps, if I update your app by simply pasting your updated code, and selecting save and publish for me again, do I need to delete the old settings in my smartapp or can I just keep using the old one without creating a new instance of it? If that makes any sense, having a hard time elaborating what I mean.


(Kristopher Kubicki) #17

Since I kept the variables the same names, it should just work :slight_smile: I know exactly what you mean – you can just paste it in there.


(Adam Anderson) #18

Hey Kristopher,

Had a new issue arise the past few days, wondering if you could give me a hand. I have my kitchen and under bed lights set to turn on with motion, and turn off 1 min after motion stops. They are also on the Circadian Daylight Smartapp, with sleep mode at 10 pm every night. The last 3 nights in a row, for some reason, the lights turn on at 10 pm, even without prompting from motion. The problem is, they stay on. All night. Unless I remember to manually switch them off via smartthings. Any idea what’s causing this? Seemed like it was working before.


(Kristopher Kubicki) #19

Hey Adam,

I noticed the same thing too on my side even without changing any of the code. I think what’s happening is one of the two scenarios:

  • SmartThings is not aware of the state of the bulb. I’ve noticed this with my Osrams specifically which is a little annoying since they are connected directly to the ST Hub. If you have a Z-wave controller, I’ve noticed that someones the inbound infrastructure commands have trouble, and the only way to fix that is a cold reboot of the Hub. That doesn’t explain why your lights turned on (did they turn on at full capacity?), but it might be at least part of the problem
  • I’ve noticed with short turn off times, sometimes ST gets crazy overloaded on the cloud side and your off command can get so delayed that it effectively fires out of order. 10PM EST is close to the infamous ephemeral “California Sunset” when ST just grinds to a halt…

Let me know if either of those two scenarios might be playing out. Definitely try resetting your Hub and extending your turn off time by another minute. Hope that helps!

Kristopher


(Kristopher Kubicki) #20

Nice article about this from AAAS: