[RELEASE] Stoplight for Children

smartapp_alerts
smartapp_lighting
project_lighting
project_alerts
project_nursery

(John) #1

I have a young child and we are trying to teach him to stay in his room in the morning until it’s time to get up. I wrote a SmartApp to manage schedules for a RGB bulb. The app allows you to create weekday and weekend schedules to switch the bulb to red/green. Additionally there’s settings for the hue, saturation and level of both red/green.

Code can be found here:
https://github.com/shadowjig/Stoplight

I kept the schedules basic for a few reasons. ST has mentioned in the past has mentioned that the number of schedules per SmartApps may be limited (this app creates 4). And the schedules are difficult to manage in the UI. and I didn’t see the reason for needing more than just weekday/weekend.

Let me know what you think and if you have any suggestions.

Thanks.


(MarkTr) #2

Awesome idea!

We bought an OK to wake clock for our daughter before I got into ST / HA. It works well enough for us but I’ve wondered about this alternative and it’s nice to see it’s both possible and already done! The obvious advantage of the more sophisticated control you have here is being able to set more than one schedule (she gets up at 6:15 no matter what day it is, because 10 minutes of futzing with the alarm to get an extra half hour of sleep isn’t worth it).

Does the app interfere with other smartapps controlling the color outside of the scheduled times? A cool feature for me, since we just have a table lamp in her room, would be to allow a button controller to turn the lamp on and off at a soft white color for task lighting, then start the “sleep” routine with another button push (our bedtimes aren’t consistent enough to have task lighting on a schedule), and once it’s gone green, allow the controller to turn the light “on/off” again. But since I don’t have an RGB bulb I’m not going to try to think about how that would be possible :slight_smile:

The other thing that I would try to add if I went this route is to add a nap timer that’s manually triggered - hit start and the bulb goes red for X minutes then turns green.


(John) #3

Absolutely not. And your use case is a perfect example of why this SmartApp is flexible. The SmartApp basically only schedules the light to turn to green or red and specific times (based on user input). Otherwise, the user is free to do anything with the bulb at any other time.

In my use case I use this as a red/green light, but it’s basically a night light as well. Then when we wake up and speak Good Morning to Alexa, she’ll turn this light off. So red/green happens when sleeping and off is when we all wake up and say good morning!!!

For your use case it sounds like you’d obviously need the RGB bulb and a button. But you’d use my SmartApp to setup the red/green schedules. Then separately setup the button to behave in it’s own way. The only thing you might need to figure out is how to set the bulb to red if you’ve used the button pasted it’s red scheduled time.


(Robin) #4

This is a great idea… the only thing I would change is the ability to choose different colors.

Sleeping / waking up to a red light is not very nice… I’d choose a purple and green personally (my little girl hates sleeping with her night light on red).


(John) #5

I looked for the input method to pick the color, but couldn’t figure it out. Can you point me to the right input method?

Also is there a slider method I could use for the level?


(Robin) #6
preferences {
    section("section title") {
        input(name: "color", type: "enum", title: "Color", options: ["Red","Green","Blue","Yellow"])
    }
}

(Robin) #7

And I almost forgot… ST pulled a huge list of colors out of the CoRE smartapp code last year, and started hosting it on their side, as CoRE had reached its max code base.

You can access the color list as follows:

input(name: "color", type: "enum", title: "Color1", options: colorUtil.ALL*.name)