I have wanted to violate intellectual property in star trek since my youth. It’s not like the federation has copyright issues.

There is just something cool about barking orders at your computer just to have them executed.
home-butler source

VOSK setup

Voice script used for the video:
The way I went about setting up a smart home was with home assistant. There is a bit more to learn than with the other home hubs, but nothing comes close to the flexibility and coolness you can get with home-assistant.
To get started, I found it best to install on an X86 computer. You’ll want to install the full OS or the .deb as this will allow you to install addons. For the Librem Mini, I went with the .deb install as the full OS requires a UEFI BIOS.
After you have a base install of home assistant, you can add devices. I’m still undecided which protocol standard is best. But for now, I’m using Zigbee devices with this Zigbee hub attached to the computer. As for wifi devices, connecting proprietary small computers to your home network that is controlled by software/hardware and people outside your network is dumb. (especially if you have unsecured API calls bouncing around your network all the time) I have yet to test Zwave devices, but I think it has licensing issues like Zigbee. All three of the common smart home standards suck and need free software badly.
If someone can point out WIFI smart devices that use open source software, please let me know. I think wifi will be the way forward, just not this privacy nightmare we have going on right now.
One issue with Zigbee is it’s kinda slow.
This is my wake-up automation.

You can see each light as it changes color and brightness. I bet if these were wifi, the change would be much more in sync with each other and much less, one at a time, just because wifi is fast.
The next part in my home automation setup is the listening part. I use a simple VOSK script to constantly listen for any words it can make out. The script uses curl to send the words to my core home program I’m calling home-butler. Home butler is a flask program that takes these words and builds them into a sentence, each time looking for a trigger word. If a trigger word is found, it runs the automation program for that trigger word.
To make a new automation, you add a script with the trigger word as its name in the voice commands folder. If the command needs multiple voice triggers, you can use an underscore between the voice commands. The script themselves can import a few convenient functions if they need it.
This makes it stupid simple to call a home assistant command; just look up the device entity id, and find the JSON data you want to send.
You will need to set up the API key in settings.py, which can be found here, in-home assistant.

This means home assistant connects to all the devices. Vosk listens for words and sends them to home-butler. Home butler executes scripts when trigger words are spotted.
I also added basic API triggers for making it easy to call scripts from home assistant. This is handy if you need to trigger an automation in home-butler from home assistant.
To add a new API call, you’ll want to install this file editor plugin. Then edit the config with a new command to call your home-butler url ending with the script name you want to run.
Then you just need to add a script with that name in the API folder.

While my food replicator is still an early prototype, This model can already print nice-looking inedible items. This door sensor can tell when I close the door, which triggers a home assistant automation that calls an URL running on home-butler, which then sends a command to my Octoprint server to reprint the last print.

In case you want to push a button instead of talking, I started work on a web interface for home butler, It’s early days, but I want to make it look somewhat startrecky.
Anyway, I hope this came in handy for someone; like always, my code is GPL and can be found below.


Leave a Reply

Your email address will not be published. Required fields are marked *