Skip to content

pdxlocations/ha-entity-builder-for-meshtastic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Summary

This script converts all or some of the nodes in a node's nodedb into Home Assistant-compatible MQTT entities (in mqtt.yaml) and device tracker automations (in automations.yaml).

Connect and generate these files using the script as detailed below, then copy the resulting files into the corresponding files in Home Assistant.

If you don't have any other MQTT sensors configured in Home Assistant, you can simply replace the file (make sure that you have mqtt: !include mqtt.yaml in your main configuration.yaml); otherwise, copy starting at the second line and add to the end wherever you have your existing MQTT sensors and match indentation. With automations.yaml, add the generated automations to the end of your existing file (but replacing any automations previously generated by this script).

Examples

Screenshot 2024-06-29 at 6 43 09 PM Screenshot 2024-06-29 at 6 29 51 PM

Usage

usage: entity-builder.py [-h] [--port PORT | --host HOST | --ble BLE]
                         [--gateway GATEWAY] [--root-topic ROOT_TOPIC]
                         [--no-messages] [--fahrenheit] [--no-temperature]
                         [--no-humidity] [--no-pressure] [--gas-resistance]
                         [--power-ch1] [--power-ch2] [--power-ch3]
                         [--nodes [NODES [NODES ...]]]

optional arguments:
  --nodes [NODES [NODES ...]]
                        Only generate sensors for these nodes. If not
                        provided, all nodes in the NodeDB will be included.
                        Example: `"!XXXXXXXX", "!YYYYYYYY"`.

Help:
  -h, --help            Show this help message and exit.

Connection:
  Optional arguments to specify a device to connect to and how.

  --port PORT           The port to connect to via serial, e.g.
                        `/dev/ttyUSB0`.
  --host HOST           The hostname or IP address to connect to using TCP.
  --ble BLE             The BLE device MAC address or name to connect to.

MQTT:
  Arguments to specify the gateway node and root MQTT topics

  --gateway GATEWAY     The ID of the MQTT gateway node, e.g. !12345678. If
                        not provided, will use the ID of the locally connected
                        node.
  --root-topic ROOT_TOPIC
                        The root topic to use in MQTT for the generated files.
                        If not provided, will attempt to get the root path
                        from the local node and use all channels. Wildcard:
                        `+`. Example: to include all channels with the root
                        topic `msh/`, use `msh/2/json/+`. To include just
                        LongFast, use `msh/2/json/LongFast`

Includes:
  Arguments to specify what sensors to generate for each node.

  --no-messages         Don't include a sensor for messages from the node.
  --fahrenheit          Use Fahrenheit instead of Celsius.
  --no-temperature      Don't include a temperature sensor.
  --no-humidity         Don't include a humidity sensor.
  --no-pressure         Don't include a pressure sensor.
  --gas-resistance      Include a gas resistance sensor.
  --power-ch1           Include a power & voltage channel 1 sensor.
  --power-ch2           Include a power & voltage channel 2 sensor.
  --power-ch3           Include a power & voltage channel 3 sensor.

If no connection arguments are specified, we attempt a serial connection and
then a TCP connection to localhost.

Alt

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages