Presence detection, saving money, and control with IoT bulbs

September 17, 2023

Last month Shelly ran a sale on four packs of IoT light bulbs. The Duo version has both warm white and bright white LEDs that can mix and match to get the color and brightness you like. They advertise the devices are compatible with MQTT and even provide documentation for it on the web. It also offers brightness control.

I don’t really care about RGB for day to day lighting so the lack of the ability to turn my home into a disco wasn’t an issue.

I did want brightness control even though I don’t run them on dimmers. When LEDs were first manufactured (yes, I am that old) they had a rated lifetime to half brightness of 50,000 hours. That’s over five years when “burning” twenty four hours per day. They should fade away gradually and shouldn’t “burn out” unless hit by lightning. They do though.

So what’s the deal? If you look at the data sheet you see the lifetime and efficiency of the devices declines rapidly when pushed beyond the recommended current. If you tear down the bulbs you buy today you see they are almost all of identical design and all are over driven. They don’t last because the manufacturers don’t want them to. Here are two fun videos that talk about the issue. Big Clive tears down the special bulbs commissioned by the Sheik of Dubai: https://youtu.be/klaJqofCsu4?feature=shared, and here’s the history by Veritasim: https://youtu.be/j5v8D-alAKE?feature=shared. I was willing to pay extra for bulbs that I could permanently run at 80-90% brightness so I didn’t have to keep replacing them.

After receiving the Shelly devices I wasn’t terribly impressed. I was able to turn the bulbs on an off via MQTT with no issue. I read the documentation on setting the brightness and was completely confused. I decided to learn by experimentation and sent the JSON packet I thought was correct. It crashed the light bulb so hard I had to factory reset the bulb to control it again. The firmware was the latest version (last updated in December of 2019?). The support department copied and emailed me worthless advice without reading my email. The forums are full of horror stories.

The good news is doing a firmware update doesn’t require tearing the bulb apart. I could replace the buggy code by Shelly by something better tested and more feature rich. I just finished flashing them all with Tasmota.

With Tasmota I get telemetry from the bulbs so my Node-Red setup knows if they’re on or off. This also doubles as presence detection. If the bulb is powered on when the wall light switch is flipped that’s a pretty good indication a human is present (and you know which room they’re in).

Tasmota includes a group control function so I can easily control the devices in a room as a group. It includes encryption for the MQTT transport as well. All really good features.

A much more time consuming project than I wanted, but it was ultimately successful. I’m reserving judgement on the Matter standard. I remember the claims that internet browsers would follow standards and the same code would work on any browser (yeah, right…)


Getting IoT notifications on the Linux Desktop

August 12, 2023

If something important should happen with the IoT setup I’d like to know. I don’t want to spend my time on Earth checking up on machines though. I know, it’s less reliable, but I’d prefer to have the machines tell me when there’s a problem. I don’t want to be notified when things are going well.

I settled on using MQTT for device to device communications in my setup. It’s lightweight and I like the messaging model. So using it for notifications seems perfect.

Luckily the code for it was already written by David Lor. All I needed to do was create a service to run it in the background on my Linux Desktop. Here’s the script: mqtt2notifysend.sh

Linux Mint uses systemd so I used the instructions here: https://www.baeldung.com/linux/bash-daemon-script

I added a flow to my node-red setup to catch errors and send them via MQTT.

Thanks David! It works like a champ.