I don’t have much experience with Python. A few years ago, I created a few fairly simple lead collector websites using Flask and that was pretty much it.
Then a few weeks ago I bought couple TP-Link smart light bulbs and quickly realized that Home Assistant’s built-in functionality does not serve my needs. I had to modify python-kasa Python library.
The library is using a poetry dependency management tool. It took me a few hours to understand the basics of it, so below I will summarize how to get started with it. The below guide is for Windows.
Make sure you have Python installed and you checked during the installation checkbox for updating the path environment variable. This will enable Python and Pip to work from any Windows folder.
First, you need to install poetry. Run the following in Windows PowerShell:
Then you need to initialize it:
I assume you want to modify the source code, so open Visual Studio Code at the root of the project. Open any Python file to trigger an installation of the Python extension.
Then in the VS Code terminal (PowerShell) run:
In VS Code command prompt (Shift+Ctrl+p), type “Python: Select Interpreter”. Select the line which refers to Poetry at the right.
You are all set. Optionally you can open the Testing sidebar and configure the Python testing framework. Then run tests to confirm that your dev environment is fully functional.
A lot of things changed since my last post about home automation. I moved to a single-family house. IFTTT decided to charge people for their service and limit the number of free integrations. Nobody uses Skype anymore for video calling. Harmony remotes are no longer supported by the manufacturer. So, what am I using in 2023 for home automation?
The heart of everything is my old NUC from Google Home condo automation, Part 1 Hardware.
I have Home Assistant running it on VM though VirtualBox.
I still use google home for voice integrations. Now I have four of them plus two Chromecasts and several Android phones.
I have 20 Z-Wave devices mostly from Zooz brand. All of them talk to Home Assistant through ZST-10 S2 stick. Home Assistant exposes those to Google Assistant through local integration.
The main garage door opens using Meross WiFi Garage Door Opener, which is connected to both Home Assistant and Google Assistant.
The shed door uses Genie Aladdin WiFi Smart Garage Door Opener, which also integrates with both Home Assistant and Google.
HVAC is controlled by Ecobee thermostat. I like that it has remote temperature sensors.
For the home security system, I’ve chosen Ring Alarm Kit. Ring Alarm System is a DIY home security system that allows users to self-monitor their homes from anywhere. It includes a base station, keypad, door/window sensors, motion detector, and a range extender. Users can control their system through the Ring app, receive alerts, and customize their settings to fit their needs. The Ring Alarm System is easy to install and it is expandable, making it a popular choice for those who want a simple, affordable home security solution without monthly fees, although if you want there is an option for professional monitoring for the monthly fee.
Ring Alarm is integrated into Home Assistant and I am using its sensors for automation even when I am in the house. Ring Alarm is paired with a couple of Amcrest cameras and one Reolink camera. I integrated Amcrest cameras into Home Assistant through Frigate. The NUC is powerful enough to handle object recognition, so I can get notifications when there is somebody in my backyard. Reolink camera covers the front yard. It has built-in object recognition, so I don’t integrate it in Frigate and use as is, although it is still integrated with Home Assistant for eventing.
Also, I have a few z-wave First Alert smoke alarms. Those are easily integrated into Ring Alarm system, which is a huge bonus.
I replaced Harmony remote with Broadlink WiFi Rm Mini 3. It has wide community support and easy integration with Home Assistant.
One of my house windows faces the front yard, so I bought Zemismart WiFi Roller Shade Motor and ordered custom shades for that window. Zemismart is based on Tuya and easily integrated into Home Assistant. Simple automation closes the window shade at sunset.
I still own a few Lutron Caseta switches, although most junction boxes have neutral wire and Lutron switches are not a necessity.
Lawn watering is done with the help of couple B-Hyve hose bib controllers. Those are really difficult to setup, but I don’t there are any good budget friendly smart watering alternatives.
I also have a few Kasa switches. I highly recommend those if you don’t want to invest a lot in home automation. This is a great way to start.
Door lock from Yale.
Monitor backlight based on ESP Home, has a motion sensor and a light sensor.
Some of my devices had Home Assistant integration that I was not even aware of when I bought them. For example, my LG OLED TV was automatically discovered by Home Assistant.
When TV is powered on, switch the ambient light on and the soundbar to turn on as well. The soundbar has a standby mode, but that mode does not power off the wireless subwoofer. Since subwoofer, ends up being on all the time at some point it fails. My previous one failed in about a year of use. This is why it is beneficial to turn subwoofer off, when it is not used. When TV is powered off, the soundbar, subwoofer and ambient light powers off as well.
I have several Zooz leak sensors. If a leak is detected then I get a voice notification on all Google devices as well as a push notification on the phone. About three months ago my sump pump failed and that notification alerted me just in time.
The smart lock is on the door to the garage. That door automatically locks for the night. In the morning that door unlocks automatically when the first person goes out to the garage.
The Ring arm mode automatically locks the door to the garage.
The Ring motion sensor can be reused for automation. In my case, it turns a hall light on when motion is detected.
The hall light turns on when the person arrives home after sunset.
The garage door opens and closes when the car arrives and leaves.
The shade for the front window opens with sunrise and closes with sunset.
The monitor backlight turns on if it gets dark in the office, there is motion and the computer is turned on.
The speakers around the house announce when Amazon or other shipping companies leave packages at the front door.
The garage and shed light turn off if there is no movement for 10 minutes.
The garage light turns off, when the internal door from the garage opens.
The lawn gets watered when there were no rain and it is not expected in 12 hours.
One of google homes plays the latest news at a certain time in the morning during work days.
Get a phone reminder to close the garage or shed door.
Most lights in the house can be turned on / off by voice or by phone. Some lights have a predefined schedule, e.g. the light in the kid’s bedroom room.
Google Assistant can be directly integrated with a variety of devices and services. However, it is not always convenient to say something like “Ok Google, ask Harmony to turn the TV on”, Luckily Google has shortcuts, so you can assign a short command and say something like “Ok Google, turn a TV on”. Lately, Google even added an ability to add up to two commands to one shortcut. Unfortunately with works only for basic scenarios. Here are some advanced scenarios that it is not possible to automate using built-in services:
- Add items to Google Keep shopping list
- Have a nighttime scene (dimmed lights, the specific song playing with a certain volume level)
- Skype parents
- Turn PC on/off
This is where IFTTT comes into the picture. IFTTT supports a lot of services and can be integrated with Google Assistant easily. IFTTT Platform can chain an unlimited number of services as well as the ability to send HTTP requests. I used the ability to send HTTP requests to solve all of the above-advanced scenarios. In the next part, I’ll describe how I automated a Google Keep scenario.