Adventures in automating unchangeable apartment lights
For the last year or so, all of my lamps have used Hue bulbs, which means I can use my phone (via HomeKit) or Alexa to turn them on or off, change their brightness, and so forth. However, my apartment has some overhead lights in the kitchen area that are not easily replaceable with anything standard. Though I did try:
Living in an apartment, I also can’t replace my light switches with any of those fancy electronic IoT-ish switches, so I just let the problem be.
I finally tired of having three lights that didn’t respond, so I set out to solve the problem My requirements were the ability to control my lights via both Alexa and HomeKit, like the rest of my lights.
As far as I can tell, there is exactly one product on the market that is compatible with the my lights: Switchmate. It completely avoids the problem of replacing lights, switches, or indeed anything at all by just physically actuating the existing light switch. It is, by far, the easiest thing to install:
Unfortunately, beyond being compatible with my lights, it solves none of my problems. It isn’t compatible with Alexa, and it isn’t compatible with HomeKit. It promises voice control, but what that really means is that you can tap a microphone button in the app and then speak to your phone. This isn’t really very useful. In fact, as advertised, this product is pretty useless — though it’d be pretty neat if it was the only approximation home automation I had. What it does offer by virtue of having a mobile app, though, was opportunity. They communicate with their mobile apps via Bluetooth LE, and we can emulate that and thereby control them. Conveniently, people have already done this.
So I ordered the parts I would need and set out to make it work:
Three Switchmate BLE switches (two of them the slim/”bright” versions, because the older ones won’t fit side by side on two-gang switches)
One Raspberry Pi 3 model B+ — though I’m pretty sure the Pi Zero W would’ve worked as well, it didn’t have same-day shipping, and I am impatient.
A micro-SD card to put in the Pi
And… that was it. Total cost around $140, but it could’ve been closer to $100 if I were more patient.
Once I received them, I upgraded their firmware to the latest version using the mobile app, snapped them over the relevant switches, and got to making the promised integration happen.
On the software side, I installed the latest Raspbian on the Raspberry Pi, then grabbed a handy Python switchmate tool someone had written (which as far as I can tell is the only up-to-date implementation) to see if it would talk to my switches — and it did! I could experience the joy of turning my kitchen lights on and off from the command line.
Excellent! So now I’m exactly where I was with the phone app, except everything is slightly more inconvenient. But I have my proof of concept, and I can get to work on integration.
For this, I turned to a wonderful project called Homebridge, which lets you add arbitrary devices to Apple’s HomeKit and basically do whatever you like in response to whatever devices you choose to present. There are actually multiple homebridge-switchmate type plugins… but they’re all outdated and won’t necessarily do anything on recent hardware. I instead used homebridge-cmdswitch2 to expose command invocations as HomeKit switches. I simply had it invoke the previous python switchmate tool with the appropriate arguments whenever I needed to throw the switch. This was fine, except that I it needed root permissions. Being lazy, and in flagrant violation of anything ever resembling good practice, I just ran homebridge as root, and everything was good.
This worked! Sometimes. Except when it didn’t. And then it would just stop working entirely no matter how much you tried. In the end, I ended up writing a (terrible, terrible) script that retried several times, and reset the bluetooth stack before each attempt. Apparently the Pi’s integrated BLE does not play nice. For those interested, the script I wrote is over here.
With these retries, the HomeKit integration became reliable, and so I could proceed to the final task: Alexa integration. Conveniently, this has also already been solved by a plugin called homebridge-alexa, which publishes your Homebridge devices for Alexa’s consumption. After setting that up, it worked!
The initial fade-in is the Hue lamps turning up, followed by the three binary switches being thrown. It’s certainly slower, but it beats them being uncontrollable. And you get very satisfying whirring and clicking noises!
Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
✓ Live Streaming✓ Interactive Chat✓ Private Shows✓ HD Quality✓ Free Actions
Free to watch • No registration required • HD streaming
Hardware Required
Raspberry Pi
MicroSD
SD Card Reader
Another computer/ Screen+Keyboard
Software Required
Etcher (Download)
Raspbian Lite (Download)
Process
Download latest version of Raspbian and write the image on the SD card using Etcher
Once SD card is ready, install it in the Raspberry Pi and boot the Raspberry Pi
The default username for Raspbian is pi and the password is…
I don't wanna buy new smart home stuff because that's expensive, but I really hate not having my doorbell cam in Apple's Home App. I'm tempted to give Homebridge a try... but forcing proprietary products to play nice with one another is scary, and idk if it'll be worth whatever difficulty ensures.
Compare the Pros and Cons of Homebridge VS Home Assistant through its features, Integration, User Interface, Compatibility, to connect, cont
Homebridge vs Home Assistant: Which One to Choose?
If you're diving into smart home automation, you’ve probably come across Homebridge and Home Assistant. Here's a quick breakdown:
✨ Homebridge is great if you're in the Apple ecosystem and just need to connect non-HomeKit devices to the Home app. It’s easy to set up and perfect for beginners looking for simple integration.
🌍 Home Assistant offers more flexibility and customization. It supports tons of devices and is perfect for advanced users who want full control over their smart home. It’s open-source and works with any ecosystem.
In short:
Homebridge = Simplicity + Apple compatibility
Home Assistant = Power, flexibility, and full control
Ok, it’s fix things Sunday, so here are the small things that I’ve been trying to fix and their status:
Apple Photos. On my OLCPed MacBook Pro 2014, when I run Apple Photos, I don’t see the first entry which is “All Photos”. It’s bizarre it started with Photos > For Your Shared Library, Memories, and the usual stuff, but there is no All Photos entry. I’ve tried to start a new Photo Library three…
Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
✓ Live Streaming✓ Interactive Chat✓ Private Shows✓ HD Quality✓ Free Actions
Free to watch • No registration required • HD streaming
We have a Windows PC that we mainly use for gaming on Steam. We are not everytime in the same location as the PC, so we want to be able to turn it on and off remotely.
As we already have Homebridge running in the location we wanted to make use of it. Here’s what we did.
Before getting started with the Homebrdige configuration, we made sure the PC gets assigned a static IP from the DHCIP Server. Also recorded the iP and MAC, we will need them later. There are also some Windows 10 specific configs that have to be done to enable WoL, but this is more about Homebridge.
Install the Homebridge WOL plugin. Just searched for WOL from the homebridge web UI and installed it form there. There were 5 configs shown, and we took them one by one:
Pinging configuration: this is where we needed the IP of the PC, and besides that we bumped the ping interval, as we didnt care for instant results. 200 was a good interval for us.
Wake configuration: this is where we needed the MAC and the broadcast IP. Besides that we bumped the wake grace time to 90 seconds.
Shutdown configuration: this is what gave us the most headaches. We used this command: “net rpc shutdown --ipaddress 192.168.1.42 --user username%password”
Logging and Miscellaneous we didnt change anything.
Now we tested, and wake up worked... surprisingly.
The part that was more tricky was adding the ability to shut down the PC as well. First problem was our Homebrew server didnt had the “net” command... you know, from “net rpc shutdown ...”.
That was fixed by installing `samba-common-bin`
$ sudo apt-get install samba-common-bin
Now, this is where errors started getting strange. Next one was:
Could not initialise pipe winreg. Error was NT_STATUS_OBJECT_NAME_NOT_FOUND
Googled that and found our it had to do with some serive not being started. On the PC, opened Terminal as Administrator and typed:
> sc config RemoteRegistry start= auto
> sc start RemoteRegistry
Tried again to shutdown, another weird error
result was: WERR_CALL_NOT_IMPLEMENTED
We fixed this with Registry Editor
Added 32 bit DWORD "LocalAccountTokenFilterPolicy" with a value of "1" to HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Policies/System in the registry.
Now shutdown works. We can turn on and off the Windows 10 PC from Apple’s Home from both iOS and MacOS.