Automate your toddler with an RGB lightbulb

November 28, 2018

Automate your child with the Sonoff B1 Bulb

Today on the hookup we’re going to look at using an RGB smart bulb like the sonoff B1 to help your toddler develop a healthy nighttime and morning routine, and help you get more sleep.

When my daughter was a little over two years old she graduated from her crib to a toddler bed.  This meant a lot of extra freedom for her, but also extra trouble for me and my wife.  A two year old can’t tell time and doesn’t have a great internal clock yet, but they do know their colors!

The concept is simple, at night she uses the light as a night light.  It’s pretty common knowledge today that blue light isn’t good for sleep patterns, so we wanted to choose something with a low amount of blue.  Luckily it was pretty easy to convince our two and a half year old girl that she wanted a pink night light.  Another added benefit of using this bulb as a night light is that you can gradually decrease the brightness as they get older to make them less dependent on the night light.

In the mornings her night light changes colors a few times.  The first change, to the color yellow happens at the minimum time you think it is acceptable for your child to wake up.  We explained to her that when her light is yellow she is allowed to get out of her bed and play with toys in her room, but she is not supposed to leave her room and she is not supposed to wake me or her mother up.

The next change, to the color green, happens when you decide it is acceptable for your child to come and wake you up.  For me and my wife this basically acted as our alarm clock since my daughter was always ready to come get us as soon as her light turned green.  The light remains green for an hour before turning back to the pink night light color.

As my daughter has gotten older the light has remained functional.  Now it signifies the time when she is allowed to turn on her ipad on weekend mornings.  We still monitor the on and off times for the ipad just to make sure she is following the rules, but she has only ever turned it on before she was supposed to one time, and now that she knows that we know, she hasn’t done it again.

Now that we’ve talked about the concept, lets talk about the products.  I am an avid user of home assistant and smart home products, but my daughter’s night light bulb isn’t in home assistant, or even connected to the internet.  It’s a Bluetooth low energy bulb with a phone app called “magic light”.  The scheduling is all done via the app and stored directly on the bulb.  These bulbs have some major upsides but also a few drawbacks.

Lets start with the good stuff:

They never crash, I’ve got some other smart bulbs in my house made by TP-link and every few days I see them turn off momentarily and then lose their brightness information, this thing has been on 24 hours a day for 4 years and has never needed tech support.

They don’t care about the internet, if your wifi goes down they aren’t going to reboot or become useless, you connect to them with Bluetooth with you need to and they work on their own the rest of the time.

You can set up as many different on of schedules as you want, we’ve got a weekend and a weekday schedule, but you could set up more if needed.

Unfortunately, the lack of constant connectivity comes with one major drawback: Power loss causes the schedules to be lost, sort of.  After power loss the bulb loses its schedules, but the app remembers them.  To reactivate the schedules you just need to connect to the bulb with Bluetooth to allow the schedules to be uploaded to the light.  The biggest problem is that it’s impossible to know whether the light has lost power since it always comes back on with the last color that it was set to

After the first few times my daughters schedule didn’t function due to random power outages we put her bedside lamp on the smallest battery backup we could find and it has worked like a champ… It’s also nice that her nightlight doesn’t turn off during a power outage.

If you are looking for a simple solution that works, look no further, buy the Flux Bluetooth bulb from amazon and don’t look back.

However, If you really want to integrate this bulb into your home automation platform you’re going to need another bulb since the flux bulb is BLE and doesn’t have a published API. There are lots of smart RGB bulbs on the market, but the cheapest and easiest to integrate into existing smart home is the sonoff B1.  Like other sonoff products, the B1 works by default with the Ewelink app, but in addition to many other shortfalls the scheduling option in the ewelink app doesn’t allow for color selection.  In order to change colors on a schedule you’ll need to flash the custom tasmota firmware.  It’s a pretty quick and painless process, but it does require some simple soldering.  DrZzs has a good video on exactly this subject, so I’m not going to go through all the steps here.

Once you have tasmota uploaded you can use your automation platform of choice to change the color using MQTT messages on the topic cmnd/[SONOFF_NAME]/Color with a  payload of a 10 digit HEX color code.  This code controls the 5 pixel types that are in sonoff B1:  The first two digits are the red pixel, the second set is the green pixel, the third set is the blue pixel, the fourth is the cool white pixel, and the fifth is the warm white pixel.  To send pure red you would send FF,00,00,00,00.  If you want to know how to send a specific color you can use google’s color picker to find the hex code, and then just add four zeroes at the end.

No doubt the B1 is a more connected bulb, but it’s got a few downsides.

First, it’s not going to be nearly as bright as the Flux bulb since the B1 only has 3 RGB pixels and mostly focuses on being a white bulb.

Second, it’s not really user friendly.  Just to achieve the same functionality of the Flux bulb you’ll need to solder, flash custom firmware, and set up MQTT automations, it also wifi to follow the schedule so if your network goes down your color changes won’t happen, because there’s no option to save the schedules locally.

In fact, I’m just going to say it.  If you’re planning on using this light to automate your toddler, go ahead and buy the flux light, the B1 will work, but it is unnecessarily difficult.  I own and use Sonoff B1s, but they just don’t make a lot of sense for this application.

Thank you to all of my wonderful patrons from patreon, if you’re curious about how I use my sonoff B1s and sync their color with my outdoor LEDs I do share all of my node-red flows and my configuration.yaml file with my patrons via dropbox.

If you enjoyed this video, please consider subscribing, and as always, thanks for watching the hookup.

Flux Bluetooth Bulb:
Sonoff B1 Bulb:
Visit my website:
Follow me on Twitter: @TheHookUp1
Support my channel:
Music by

Related Posts