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 automatically detected by Home Assistant.

It is a set of wrapper scripts 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, you can use the unixorn/ha-mqtt-discoverable-cli docker image instead.

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.

ZSH Frameworks

You can load the tools with your ZSH framework of choice by referring to unixorn/ha-mqtt-discoverable-cli.

If you're using Zgenom:

  1. Add zgenom load unixorn/ha-mqtt-discoverable-cli to your .zshrc along with your other zgenom load commands.
  2. zgenom reset && zgenom save

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 --name mfsbinarysensor --mqtt-user HASS_MQTT_USER --mqtt-password HASS_MQTT_PASSWORD --client-name inquisition --mqtt-server mqtt.unixorn.net --device-class motion --state off --unique-id mfsbinarysensor_unique-id

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 ruff on your code before submitting. There are git hooks already configured to run ruff 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.23.0.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ha_mqtt_discoverable_cli-0.23.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file ha_mqtt_discoverable_cli-0.23.0.tar.gz.

File metadata

  • Download URL: ha_mqtt_discoverable_cli-0.23.0.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.11.0-1018-azure

File hashes

Hashes for ha_mqtt_discoverable_cli-0.23.0.tar.gz
Algorithm Hash digest
SHA256 85e5fd521fd7032148cfea40b61cce92f447044f396b60e45a77f736cfc9be79
MD5 9bf36e434f992d4768a0aba846a33f35
BLAKE2b-256 be3b3bc2b448cdc2bcb3cc13eeb816953001d2cfbce8a9c8be25c94d691ac9e2

See more details on using hashes here.

File details

Details for the file ha_mqtt_discoverable_cli-0.23.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ha_mqtt_discoverable_cli-0.23.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cccaa050515f7351767d31b9116ca52712fafbd2642cfffc2df3f86a59cde558
MD5 0cc4b02b12def9387cf503a901bc1978
BLAKE2b-256 dbdc0a064eca9235ecbfb81227438fc91bece1e6e36c5c71b2eb5007732919ca

See more details on using hashes here.

Supported by

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