Skip to main content

CLI tools for the ha-mqtt-discoverable module

Project description

ha-mqtt-discoverable-cli

License Code style: black GitHub last commit (branch) Downloads

Table of Contents

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.

Installing

Native install

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.

Docker

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.

Scripts Provided

The ha_mqtt_discoverable-cli module installs the following helper scripts you can use in your own shell scripts.

hmd

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.

hmd create binary sensor

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

hmd create device

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'

Contributing

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.

Contributors

Made with contributors-img.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ha_mqtt_discoverable_cli-0.5.0.tar.gz (8.6 kB view hashes)

Uploaded Source

Built Distribution

ha_mqtt_discoverable_cli-0.5.0-py3-none-any.whl (11.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page