Smart Home Journey

#homelab#automation

How I built a fully automated smart home with Alexa, Home Assistant, Broadlink, and Philips Hue — routines, integrations, and running Linux scripts from HA based on GPS location.

Note

This is the apartment setup, and it hasn’t changed much since I wrote it. When I move into my own house I’ll rebuild the whole thing and redo this post.

It started with wanting to turn the lights off from my phone. It ended with the blinds closing because I drove past a geofence.

What’s in it

Device Role
Amazon Alexa One per room. The voice layer, nothing more
Home Assistant A VM on the Dell. Where every decision actually gets made
Broadlink RM4 Pro RF/IR bridge — the blinds and anything without a radio in it
Philips Hue, Govee Mood lighting, tied to routines
Roborock, Resideo, AC units Vacuum, thermostat, climate

Cameras and a Yale lock are the next two.

Living Room Smart Setup

The split matters more than the device list: Alexa hears, Home Assistant thinks. Voice goes through Alexa because that’s what’s convenient to say out loud. Every automation with a condition in it lives in HA, where it can look at GPS, the outside temperature, and a shell script at the same time. Anything built entirely in Alexa routines hits a ceiling the first time you need “unless nobody’s home”.


The routines

Good Morning opens the blinds to a set level. Good Night kills the lights, closes the blinds, and sets up for sleep. Both are on a schedule — if I have to say them, they’ve failed.

Movie Time closes the living room blinds, turns the TV on to Netflix, puts the soundbar in cinema mode, starts the AC in summer, and drops the ambient lights around the TV. Gaming Time is the same routine with the input on the PS5 and different lighting.

Philips Hue

Leaving arms the motion sensors and closes every blind. Arriving opens them, sets the temperature against the outside reading, and lights the path through the apartment. Both are GPS-triggered, so there’s nothing to remember and nothing to press.

For security, the motion sensors only arm when I leave. Anything unusual after that — motion, a significant temperature swing — notifies through both Alexa and Home Assistant, because a notification path with one leg is not a notification path.


Getting the blinds onto Alexa

The RM4 Pro is what bridges everything that predates smart anything. Three steps, and the middle one is the only one that can go wrong.

Set it up in the Broadlink app first — Wi-Fi, registration, done. Then Add Remote → RF Appliance, put it in learning mode, press the button on the original remote, save the code. Test each code before saving the next one. RF learning fails silently, and a set of eight codes where one is wrong is much harder to debug than one bad code caught immediately.

Then enable the Broadlink skill in the Alexa app, link the account, let it discover. “Alexa, close the blinds” works from there with no further configuration.


Home Assistant running shell commands

The hardest part, and the one that made the rest worth it. Home Assistant SSHes into the Proxmox host and changes the server’s fan speed based on whether I’m home — quiet when I’m in the apartment, loud and cool when I’m not.

/root/homeassistant/configuration.yaml
#!/bin/bash
# Adjust server fan speed based on external temperature
shell_command:
set_fans_home: 'ssh -i /config/ssh/id_rsa -o StrictHostKeyChecking=no root@10.10.10.10 /usr/bin/ipmitool -I lanplus -H 10.10.10.200 -U root -P SuperSecretPassword raw 0x30 0x30 0x02 0xff 0x14'
set_fans_away: 'ssh -i /config/ssh/id_rsa -o StrictHostKeyChecking=no root@10.10.10.10 /usr/bin/ipmitool -I lanplus -H 10.10.10.200 -U root -P SuperSecretPassword raw 0x30 0x30 0x02 0xff 0x28'

0x14 is roughly 20%, 0x28 roughly 40% — the R720 fan table has the rest.

Caution

That’s an iDRAC password sitting in plaintext in a config file, on a machine that also holds an SSH key with root on the hypervisor. It works, and it is the weakest thing in this entire setup. If you copy this, at minimum put the key on its own restricted account and take the password out of the string.

Home Assistant Automation


More of it running

The automations nobody notices are the ones that worked. The ones that get commented on are the ones that fired at the wrong time.


References