LEGO Nightstand Light Switch

I’ve been playing a lot with home automation recently, and in particular I’ve been installing a lot of cheap ESP8266-based Wi-Fi relays, such as the Sonoff Basic, Sonoff SV, Sonoff S31, Sonoff iFan02, and Shelly1, which have all been flashed to run the open-source Tasmota firmware. These communicate with Home Assistant through an MQTT message broker over Wi-Fi. Home Assistant, in turn, allows the devices to work with schedules, timers, voice-activated cylinders, and so on. With the exception of the Sonoff Basic, I would happily recommend these devices to anyone with some electrical knowledge and DIY skills.

One advantage of having automation-enabled lights in the kids rooms is being able to turn on their lights to help get them out of bed on school days. For that reason, I set up the ceiling fan in Lucas’s room with an iFan02 (replacing the Hunter RF control module), one of his floor lamps on an S31 and the other on a Basic.

Now he needed a convenient way to turn on/off the floor lamp and nightstand lamp without physically switching them off, which would prevent them from being turned on by automations.

Here is the result:

Lego Light Switch
The LEGO light controller (right), pictured with a Sonoff iFan02 remote (left)

Each of the buttons toggles the state of a different light. The LEGO parts were scavenged from a large parts bin. The buttons came from a local electronics shop. Inside is a Sonoff SV, powered by a re-purposed USB cable. The Sonoff SV was modified somewhat to make it fit in the small enclosure: I removed the relay and the side of the board carrying the relay outputs, and the header pins were bent at about a 45 degree angle to keep them out of the way of the pushbuttons. Power comes from an old iPhone USB charger.

Installing the buttons was probably the hardest part of the build, but that’s not to say it was difficult. I hit the center of the smooth-surface blocks with a punch and then drilled them handheld without any issues. The bore is slightly more than 1/2″, which required some extra trimming. The depth of the LEGO prevented use of the button mounting hardware, so I used hot glue to hold them in place.

Here you can see the Sonoff SV, trimmed to fit and relay removed.
Here you can see the Sonoff SV, trimmed to fit and relay removed. This was done to save space.

 

Internally, the buttons are connected to ground, with the other leg connected to a female header cable that plugs into the corresponding GPIO port. I used GPIO4, 5, and 14.

Inside the controller

 

 

The USB power cable is fed through a block with a hole in it. A zip tie is used internally for strain relief.

Here you can see the inside of the assembled unit. Everything barely fits.

Everything packed together
Everything packed together

 

Moving onto the software side, this is how I configured the Sonoff SV module with Tasmota 6.3.0.8:

Sonoff Module Configuration
Sonoff Module Configuration

Finally, I had to configure it to toggle the other modules on and off with button presses. This doesn’t use Home Assistant at all; I used Tasmota rules to publish MQTT messages to the other devices directly. Home Assistant correctly observes their changed states automatically.

Tasmota supports a bunch of active rules at once, but they all end up concatenated together on one line. Ignore the line wrap below! This is the configuration I ended up using:

switchtopic1 0
switchmode1 5
switchmode2 5
switchmode3 5
setoption32 20
rule on switch1#state=2 do publish cmnd/sonoff-3325/power 2 endon on switch2#state=2 do publish cmnd/sonoff-3443/power 2 endon on switch3#state=2 do publish cmnd/sonoff-2833/power 2 endon
rule 1

The other lights correspond to topics sonoff-3325, 3443, and 2833. (I’m still new at this, but so far I’m keeping with the pre-assigned names rather than friendly names.)

That’s it! I hope this helps someone.

This build was inspired by @mike2nl and @andrethomas on the Tasmota Discord channel. If you get stuck with Tasmota, I’ve found the channel to be very helpful.

Closing a Yahoo account

I terminated my Yahoo account on June 24. It was only used for Flickr. Flickr has been in a sad state for years, and is unlikely to improve under Verizon ownership.

Yahoo sent the following as a confirmation:

It’s strange that the final date is approximate. The 40 days concluded yesterday, August 3.

I’ve received several emails recently of spambots liking photos on Flickr, including one this morning (August 4):

Awesome photos, huh? Not so much.

I never received these notifications before asking Yahoo to terminate the account. It’s unclear why the Flickr content is still visible at all. In hindsight, I should have deleted the photos prior to terminating the account.

I could pessimistically conclude that this is a trick designed to get users to log back into their account and abort the termination process. I’m actually worried that my data will never get expunged.

For now, I’ve decided the best action is no action. Hopefully this all works out.

Disabling Wi-Fi on an LG Smart Refrigerator

Our LG LFXS30766S refrigerator is broadcasting an open Wi-Fi access point. I’m sure it’s doing that so LG’s Android app can connect to it and deliver pairing instructions for another AP. Sadly, there doesn’t seem to be any way to disable this feature. LG: If you’re listening, nobody asked for this garbage. Making the door shelves adjustable would be pretty great, though. A $2,300 fridge should have adjustable shelves.

I also see LG recently posted a firmware update for this fridge to their website. There are no release notes; You need proprietary hardware to install it, and it requires fridge disassembly. Seriously? I hope it’s not needed to close a gaping security hole in that open Wi-Fi access point… No, that would be silly. They’re never going to fix those security holes.

I may end up looking for a service manual so I can try to physically disable the Wi-Fi.

Welcome to the shitty future.

May 5, 2016 Update:

Forum discussion on refrigerator Wi-Fi
Video showing how to disable Wi-Fi on a Samsung refrigerator