Lightbulbs behaving badly

As many houses surely do, we have a few 'smart' lightbulbs dotted around the place. For the most part, they work as intended. They can do all the pretty colors, the can do dimming, and they don't do things unless you ask them to. There's one tiny issue with them though, they're so very noisy over the network. These things make about 4 'phones-home' a second and were sticking out a bit compared to the rest of our network.

Most of the smart home world runs on the ESP8266 chips (or sometimes their big brother the ESP32), and the sheer number of solutions that exist for that chipset is very nice to see. One of the most popular API providers is a company called Tuya, who provide whitelabelled apps for other companies to dress up and sell on with their own devices. That's one for the next post though, we had some fun with Tuya for sure. These wonderful little lamps though, they had to be different. They were purchased before I had an actual interest in the 'smart home', and do behave very well in isolation. But we run Home Assistant in this household, and they don't play well with the rest of the toys.

These lamps run a Broadlink chipset, which are notorious for being a bit of a pain to do anything more than their native app. They follow the same idea as Tuya in that they're the underlying provider, but for Broadlink, devices that use their services aren't always compatible with Broadlink's own apps like Tuya devices are. You're mostly chained to the providers' app development skills, and out of luck if you want to do anything else. Granted, the Magic Home app that these lamps use is very slick, but it was missing a key option to 'unlock' the lamp that would make it available over the local network for Home Assistant to pick up on. This option supposedly existed in the standard Broadlink app, so off I went.

Reseting this lamp is like some sort of digital morse code, it has to be toggled on and off 4 times, wait a few seconds, and then toggled 4 more times. My first attempt to re-pair the lamp with Broadlink's own app ended with the app refusing to acknowledge it was connected to any WiFi network at all. The second attempt was more promising though. I could discover the lamp, connect it to our WiFi, but then was told that the lamp used the wrong server location, at which point it was promptly removed from the list of devices. Not ideal.

Much reading and flicking of wall switches later, I came across a Python library (https://github.com/mjg59/python-broadlink) that looked very promising. One pip3 install broadlink later, and I could prod the network with broadlink.discover() and be told that the lamp did indeed exist, was connected to the right network, and could be found. Success! The only snag was that the bulb was happily reporting is_locked=True, and the whole aim of this re-pairing business was to unlock the lamp.

So one reset later and a last ditch attempt to pair using the broadlink python library (broadlink.setup('ssid', 'password', 3) ) ended in complete success, the lamp was now reporting is_locked=False! Then it was just a matter of using Home Assistant's standard Broadlink integration and it picked everything up as normal. One less noisy lamp on the net.