iBet uBet web content aggregator. Adding the entire web to your favor.
iBet uBet web content aggregator. Adding the entire web to your favor.



Link to original content: http://github.com/nebhale/teslamate-discovery
GitHub - nebhale/teslamate-discovery: Home Assistant MQTT Discovery for Teslamate Cars
Skip to content

Home Assistant MQTT Discovery for Teslamate Cars

License

Notifications You must be signed in to change notification settings

nebhale/teslamate-discovery

Repository files navigation

TeslaMate Discovery

If you're a fan of the very excellent TeslaMate and use it with Home Assistant, then this project is for you!

The TeslaMate + Home Assistant integration documentation shows a very long, manual configuration of each of the entities that TeslaMate sends messages for. While this works quite well (I used it for years) it has some shortcomings, the biggest of which is that they aren't all collected under a single Home Assistant Device. Unfortunately, devices cannot be created using purely manual end-user configuration, they can only be added with MQTT Discovery or a dedicated integration.

This application replaces most, if not all, of the documented TeslaMate + Home Assistant integration. In a single command, it synthesizes and publishes the MQTT Discovery configuration for commonly used entities converted to desired units and a device_tracker with precise coordinates that can also determine if the car is home (any geofence with "Home" in it).

Pre-requisites

The application assumes that you have a healthy TeslaMate installation sending messages to a Mosquitto MQTT broker and that Home Assistant can see those messages. The only other requirement is to have an account that can read messages from the /teslamate/# topic tree and send messages to the /homeassistant/# topic tree. This is often done by configuring /share/mosquitto/accesscontrollist as in the following example:

user homeassistant
topic readwrite homeassistant/#
topic read teslamate/#

user teslamate
topic write teslamate/#

user teslamate-discovery
topic write homeassistant/#
topic read teslamate/#

Installation

To install the application, navigate to the Releases page for the project and download the appropriate Asset for the platform you'll be running on (e.g. teslamate-discovery_2.0.2_Darwin_all.tar.gz for macOS). Unzip the package and within it you'll find the teslamate-discovery binary that you'll run.

Usage

Common usage might look like:

$ teslamate-discovery \
    --mqtt-host <HOST> \
    --mqtt-username <USERNAME> \
    --mqtt-password <PASSWORD>

Usage Options

Usage:
  teslamate-discovery [flags]

Flags:
      --ha-discovery-prefix string   home assistant discovery message prefix (default "homeassistant")
      --help                         help for teslamate-discovery
  -h, --mqtt-host string             mqtt broker host (default "127.0.0.1")
  -P, --mqtt-password string         mqtt broker password
  -p, --mqtt-port int                mqtt broker port (default 8883)
  -s, --mqtt-scheme string           mqtt broker scheme (default "ssl")
  -u, --mqtt-username string         mqtt broker username
      --range-type string            range type ["estimated", "ideal", "rated"] (default "rated")
      --tm-prefix string             teslamate message prefix (default "teslamate")
      --units-distance string        distance units ["imperial", "metric"] (default "imperial")
      --units-pressure string        pressure units ["imperial", "metric"] (default "imperial")
  -v, --version                      version for teslamate-discovery

License

Apache License v2.0: see LICENSE for details.