Difference between revisions of "Home Assistant: Configuring "Salt Sentry" using MQTT protocol"
From falz.net
(Created page with "Category:Dev Category:Unix ===Background=== About a week ago I had never heard of Home Assistant, Salt Sentry, nor MQTT. Just before that, I replaced a water softene...") |
(No difference)
|
Revision as of 16:01, 28 January 2023
Contents
[hide]Background
About a week ago I had never heard of Home Assistant, Salt Sentry, nor MQTT.
Just before that, I replaced a water softener. This reminded me that you also have to add salt to said water softener. This reminded me that I never remember, and would like to know, automatically, what the level is and if I need to add more.
A bit of googling revealed a few home dev style solutions (buy some parts, solder some things) but the most complete of these appeared to be a product called "Salt Sentry"
It works by using a small software development board which contains a VL53L0X sensor which is some magical device that can measure distance with accuracy of 2mm when just pointing it into the ether. 🤷 cool.
To use this, you need to integrate it with something else, there are a few options, but the most popular one seemed to be called "Home Assistant". While I was waiting for the Salt Sentry to arrive, i thought I'd get ahead of things and install Home Assistant.
Home Assistant
Home Assistant (wikipedia) is something one can run on a Raspberry Pi or other similar hardware. I happened to have a few Pi's laying around unused so i thought I'd give it a shot:
"Home Assistant is free and open-source software for home automation designed to be a central control system for smart home devices with a focus on local control and privacy."
I ended up installing this by downloading and using `dd` to image it to an SD card.
dd if=haos_rpi3-64-9.4.img of=/dev/sdb bs=4M && sync
Plug it in, boot it up, and i highly recommend creating a local DNS record for 'homeassistant.local' as most of the docs use that and may even link to it. Configuring it is outside of the scope of this page but it's pretty simple.
On its own with no config it auto discovered some Devices, which it calls "Integrations" on its own:
- Ecobee thermostat + remote sensor
- ROKU
- Onkyo A/V receiver
- Outdoor Weather
- Mobile phone (once app installed)
All of this was super easy, didn't require any CLI changes, it just was clicky clicky from a quick web UI. Cool, that'll be the same with MQTT too? no.
MQTT
MQTT (wikipedia stands for "MQ Telemetry Transport". What does MQ stand for? Apparently it came from IBM thing called "MQSeries" where it stood for Message Queing, wikipedia says it stands for nothing. We're off to a great start.
If you go to Settings -> Devices and Services -> Integrations and choose to add MQTT, it just asks for your broker and you're just kinda stuck.
To use MQTT with Home Assitant, you must use something called "Mosquitto Broker". Why? I don't know, but you need it. Install it from Settings -> Add-Ons -> Add-on store. It will take several minutes to install. I would recommend rebooting after as well.
Once it's installed.. this is where you hit question marks. What's next? The docs just say that it should show up as a discovered integraiton, but it didn't for me. So I rebooted Home Assistant, and then MQTT appeared as discovered after a bit.