DistHASS is a link between Home Assistant and DistKV.
It will
set up standard config for Home Assistant in DistKV
have command-line support to register (or not) devices
Principle of Operation
Home Assistant talks via MQTT. DistKV has a quite versatile MQTT adapter. Thus we can store Home Assistant’s entitiy configuration, plus their state, plus the commands Home Assisant issues to get things to change their state, in DistKV.
MQTT can only transmit binary data. DistHASS thus creates a few codecs that support binary data (translating them to on/off), integers/floats, and JSON.
Thus, bottom to top:
Mosquitto on port 51883
basic installation, does not need persistence or retained messages
Serf would work, but it imposes additional delays
DistKV, using Mosquitto as a backbone
a special user with conversion rules for JSON etc.
DistMQTT
retained messages are stored in DistKV
transparent channels to forward MQTT messages unmodified, if required
anything else is broadcast as a DistKV message
uses port 1883
Home Assistant, or anything else MQTTish for that matter
must use MQTT 3.11
If you have devices that only can use MQTT 3.1, you can teach them to talk directly to Mosquitto, via a transparent range.
Setup
Run distkv client hass init -i
Add a DistKV user for Home Assistant and set its conv parameter to hassco:
distkv client auth user param NAME conv hassco
Start DistMQTT:
distkv: server: host: '127.0.0.1' port: 27586 auth: "password name=NAME password=PASSWORD" topic: [mqtt, msg] transparent: - [home,ass,event] - [home,ass,state] retain: [home, ass] listeners: default: max-connections: 500 type: tcp local-tcp: bind: 127.0.0.1:1883 remote-tcp: bind: 10.107.3.18:1883 timeout-disconnect-delay: 2 plugins: ['auth_anonymous'] auth: allow-anonymous: trueIf you have devices that cannot talk via DistMQTT, modify the transparent list to include the MQTT prefixes you currently use.
Modify Home Assistant’s MQTT integration to do autodiscovery. If you’ve set it up via the GUI, the file you need is .storage/core.config_entries. Find the entry with "domain": "mqtt" and modify its data entry to read:
"data": { "broker": "127.0.0.1", "discovery": true, "discovery_prefix": "home/ass/dyn", "port": 1883, },Restart Home Assistant.
Run distkv client hass add light foo bar.
A new light should show up in the Home Assistant GUI.
You can try to turn it on, but it will go off by itself a second or two later because there’s no device yet.
Run distkv client hass state light foo bar True.
This command changes the state manually.
In Home Assistant, the light turns on.
Adding an actual device that monitors the light’s DistKV command entry / its [Dist]MQTT command topic, actually affects the hardware, and changes the state, is your job.
Release files for distkv-hass 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| distkv_hass-0.4.0.tar.gz | 8.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| distkv_hass-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.2 kB
Release files / distkv_hass-0.4.0.tar.gz
| Download URL | distkv_hass-0.4.0.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b60cf4b3c934b6106c78651e9a78d37b76997035b7613a1295dd11c686ac9b73
|
|
BLAKE2b-256 checksum How to use checksums |
42364a4b36989f508df39a5111b769262ed2ca477f610e6e76a644f187c58562
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.8.2 requests/2.25.1 setuptools/65.5.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.10.8
|
Release files / distkv_hass-0.4.0-py3-none-any.whl
| Download URL | distkv_hass-0.4.0-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49a17a00c6a3153c38603515ba5f3249e603f6c84280cdc2968aefc618a7df99
|
|
BLAKE2b-256 checksum How to use checksums |
e3cd2c06298e14279b7da0efd5f230e49abb4e632bb8ae3f68bfe5ca48c99f4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.8.2 requests/2.25.1 setuptools/65.5.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.10.8
|