This repository contains CLI scripts for CRUD operations on MQTT entities that will be autodetected by Home Assistant.
It is a group of wrappers for the ha-mqtt-discoverable python module.
pip install ha-mqtt-discoverable-cli
will install the cli tools. If you prefer to keep your system python clear of extra modules, use the unixorn/ha-mqtt-discoverable-cli
docker image.
If you only need to use the command line tools, the simplest way is to use them with docker
or nerdctl
. It won't interfere with your system python and potentially cause you issues there.
You can use the unixorn/ha-mqtt-discoverable-cli image on dockerhub directly, but if you add $reporoot/bin
to your $PATH
, the hmd
script there will automatically run the command line tools inside a docker container with docker
or nerdctl
, depending on what it finds in your $PATH
.
The ha_mqtt_discoverable-cli
module installs the following helper scripts you can use in your own shell scripts.
Uses the gitlike-commands module to find and execute hmd
subcommands. Allows you to run hmd create binary sensor
and hmd
will find and run hmd-create-binary-sensor
and pass it all the command line options.
Create/Update a binary sensor and set its state.
Usage: hmd create binary sensor --device-name mfsmaster --device-id 8675309 --mqtt-user HASS_MQTT_USER --mqtt-password HASS_MQTT_PASSWORD --client-name inquisition --mqtt-server mqtt.unixorn.net --metric-name tamper --device-class motion --state off
Create/Update a device and set the state of multiple metrics on it.
Usage: hmd create device --device-name coyote --device-id 8675309 --mqtt-user HASS_MQTT_USER --mqtt-password HASS_MQTT_PASSWORD --mqtt-server mqtt.example.com --model 'Rocket Skates' --manufacturer 'Acme Products' --metric-data '{"name":"Left Rocket Skate","value":93}' --metric-data '{"name":"Right Rocket Skate","value":155}' --unique-id 'hmd-26536'
Please run black
on your code before submitting. There are git
hooks already configured to run black
and other checks before every commit, please run pre-commit install
to enable them.
Made with contributors-img.