Files
archived-hipudding-teslamate/website/docs/integrations/mqtt.md
JakobLichterfeld fdf8185ce2 ci: add treefmt as code formatting multiplexer, refactor CI to avoid duplication, reorg CI into DevOps workflow (#4219)
* ci: add treefmt as code formatting multiplexer

* style: linter findings in entrypoint.sh script

* style: linter findings for yaml and yml

* style: linter findings for json files

* style: linter findings for nix files

* style: linter findings for js files

* style: linter findings for dashboards.sh

* style: linter findings for md and mdx files

* chore: remove unused clang formatter in treefmt config

* style: linter findings for mdx files

* ci: exclude Grafana dashboard JSON files from prettier formatting

* Revert "style: linter findings for json files"

This reverts commit f40c2e175992f66f887a3f4fc5aa1a1a89393147.

* ci: exclude Grafana dashboard JSON files from all formatting as we use the grafana export style

* style: linter findings for json files

* doc: update changelog

* ci(refactor): use composite action to avoid duplication in elixir workflow

* doc: update changelog

* ci: prevent workflow runs for certain conditions and allow scheduled runs

* ci(refactor): use reusable workflow to check paths

* ci(fix): correct output syntax for check_paths workflow and setting base branch

* ci(refactor): use reusable workflows for streamlined DevOps pipeline

* ci(fix): add write permission for packages in DevOps workflow

* ci(test): test DevOps workflow

* ci(test): test DevOps workflow

* ci(fix): Update condition for spell_check, ensure_linting, elixir, and ghcr_build workflows to reflect empty result instead of false

* ci: revert test DevOps

* ci(refactor): allow ghcr_build parallel to elixir test

* ci(refactor): Remove redundant check_paths job from elixir.yml, elixir_test.yml, and spell_check.yml workflows, check is done in devops.yml

* feat: add treefmt-nix to nix flake (#4219 - @JakobLichterfeld)

* ci: ensure proper linting via treefmt

* ci(test): test ensure_linting workflow

* ci(fix): checkout code for spell_checker to access file to check

* ci(fix): allow impure in ensure_linting workflow

* Revert "ci(test): test ensure_linting workflow"

This reverts commit a67b17ec098a628a8b093ec20b34b0e2696811cc.

* ci(fix): correct use of flake-utils for formatter and checks

Co-authored-by: scottbot95 <scottbot95@gmail.com>

* ci(fix): correct use of flake-utils for treefmt

Co-authored-by: scottbot95 <scottbot95@gmail.com>

* refactor: Remove unnecessary imports in flake

* ci(fix): correct syntax in flake

* ci(refactor): Remove unused code in flake.nix

* style: standardised style for input url in flake

* ci(fix): treefmt-nix config with existing options

* ci(feat): Add Nix binary cache and update treefmt command in CI workflow

* ci(refactor): Remove unused code in flake.nix

* fix: include devShell packages only on supported platforms

* fix: update hash for mix-deps package in flake.nix

* ci(fix): Update treefmt command in CI workflow

* ci(test): test ensure_linting workflow

* feat: ensure mix deps are present in devShell

* ci(feat): use flake-parts to enable treefmt-nix

* feat: use flake-parts

* fix: correct use of flake-parts for package build

* doc: update CI badge URL for devops workflow

* ci(fix): handle empty path filter output

* ci: remove --impure flag from treefmt command in CI workflow

* fix: correct treefmt.config settings in formatter.nix

* fix: correct flake-parts inputs, avoid with in imports

* fix: correct program name for mix-format in formatter.nix

* feat: devenv via flake-parts

* fix: correct use of legacy nix code with flake-parts

* ci(fix): correct nix develop command in ensure_linting.yml

* refactor: list imports explicitly in flake, rename folder to flake-modules to be precise

* style: use tabs for indent size to format sh

* style: use nixfmt-rfc-style

* Revert "style: use nixfmt-rfc-style"

This reverts commit 082056159e611c2c0639f8b4dc509446f5308a92.

* style: use nixfmt style

* fix: remove glibcLocales from optional dependencies to avoid  "A definition for option `packages."[definition 4-entry 16]"' is not of type `package'."

* fix: remove inotify-tools from optional dependencies to avoid  "A definition for option `packages."[definition 4-entry 16]"' is not of type `package'."

* fix: Remove inotify-tools and glibcLocales from optional dependencie

* fix: correct file paths in flake.nix to version

* fix: add ELIXIR_ERL_OPTIONS to shell environment to force utf8 locale

* fix: add LOCALE_ARCHIVE to shell environment in flake.nix

* Revert "fix: add LOCALE_ARCHIVE to shell environment in flake.nix"

This reverts commit d45f6e32eea1fcaf55cd03733e648cda4dbb764b.

* ci(refactor): rename workflow to elixir_dep_verification_and_static_analysis.yml to better reflect the intention,, remove duplicate checks

* ci(debug): debug locale settings

* Revert "ci(debug): debug locale settings"

This reverts commit 9b402f3c5f9b41ff4716dc4fc99f711fc9ef8135.

* Revert "fix: add ELIXIR_ERL_OPTIONS to shell environment to force utf8 locale"

This reverts commit d02419cba44055d55978ad36d23493d8790ce21b.

* fix: add LOCALE_ARCHIVE to shell environment in flake.nix

* Revert "fix: add LOCALE_ARCHIVE to shell environment in flake.nix"

This reverts commit 761b437e699d8381a0726dd969052b1e85c3f08f.

* fix: add LANG=C.UTF-8 to shell environment in flake.nix

* fix: add mix local.rebar and mix local.hex commands to flake.nix

* fix: pin devenv to version without unix socket bug

* chore: update nixpkgs to nixos-24.05 and update dependencies

* doc: add treefmt config comments

* ci: do not expose treefmt formatter programs in devshell

* fix: correct use of module option to enable PostgreSQL server in flake.nix

* Revert "chore: update nixpkgs to nixos-24.05 and update dependencies"

This reverts commit a6ea3f25aa393c32d9c2494b21e6330de2482496.

* feat: consistent use of erlang 26 and elixir 1_16 in flake

* ci: switch to macOS runner for linting workflow

* Revert "ci: do not expose treefmt formatter programs in devshell"

This reverts commit 1ecfa451dcf4199554a5d96d241ee846601862d9.

* Revert "ci: switch to macOS runner for linting workflow"

This reverts commit 7b430667d8737e5adf91f5ba59bbf83eb15bcb7a.

* ci: Remove nixpkgs channel specification in ensure_linting workflow

* ci(debug): Add debug output for PATH and NIX_PATH in flake.nix

* Revert "ci(debug): Add debug output for PATH and NIX_PATH in flake.nix"

This reverts commit 07faec5ddf88195969f89f3e74791d030c980b03.

* fix: avoid the need for impure for devenv

see #4245

* fix: remove invalid custom build.check for formatter and use default

* style: linter findings

* fix: Add emptyTest to avoid nix flake check test execution on non-Linux systems

* chore: Remove LANG=C.UTF-8 from enterShell in flake.nix

* ci(fix): Remove --impure flag from treefmt command in CI mode

* ci(fix): avoid impure mode in ensure_linting workflow

* style: linter findings

* ci(debug): debug elixir version and locale

* chore: Update flake.lock dependencies

* feat: use newer devenv as unix socket bug is fixed in upstream

https://github.com/cachix/devenv/issues/1497

* fix: set rebar3 path in devenv

* Revert "ci(debug): debug elixir version and locale"

This reverts commit 7ecdc77c163cd6ef9c913689c1f75e86ce8587cb.

* ci: re-enable path check in DevOps workflow

* doc: update Development and Contributing guide with nix and treefmt

* ci: use PostgreSQL 17

* style: linter findings

* ci(fix): ensure cache name in build action does not contain invalid characters to avoid invalid reference format

* doc: update changelog

* Revert "ci(fix): ensure cache name in build action does not contain invalid characters to avoid invalid reference format"

This reverts commit 02abb0359db4f22e5a28283476b3ced0d99729ff.

* ci: remove branch restriction for check_paths workflow to increase sec

* ci(fix): run ghcr build workflow only for specific conditions

- Ensure workflow only run if there are no changes to the .github folder
- Allow workflow to run on workflow call or PRs from forks
- Prevent duplicate runs for PRs from non-forks
- Avoid invalid reference format for cache name in PRs from our repository

* doc: update changelog

* fix: update hash for mix-deps package in flake.nix

* fix: disable flakeCheck for formatter, as mix format need the dep to be fetched beforehand

* ci(fix): run ghcr build workflow only for specific conditions

* fix: move nixosModules.default to top-level attribute set

* refactor: remove unnecessary config nesting in formatter.nix

* ci(fix): ensure version for buildx is set to correct name

---------

Co-authored-by: scottbot95 <scottbot95@gmail.com>
2024-10-14 08:54:10 +02:00

119 lines
19 KiB
Markdown

---
title: MQTT Integration
sidebar_label: MQTT
---
The MQTT function within TeslaMate allows useful values to be published to an MQTT broker. This is useful in allowing other automation platforms to consume data from TeslaMate.
## MQTT Topics
Vehicle data will be published to the following topics:
| Topic | Example | Description |
| ------------------------------------------------------ | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| `teslamate/cars/$car_id/display_name` | Blue Thunder | Vehicle Name |
| `teslamate/cars/$car_id/state` | asleep | Status of the vehicle (e.g. `online`, `asleep`, `charging`) |
| `teslamate/cars/$car_id/since` | 2019-02-29T23:00:07Z | Date of the last status change |
| `teslamate/cars/$car_id/healthy` | true | Health status of the logger for that vehicle |
| `teslamate/cars/$car_id/version` | 2019.32.12.2 | Software Version |
| `teslamate/cars/$car_id/update_available` | false | Indicates if a software update is available |
| `teslamate/cars/$car_id/update_version` | 2019.32.12.3 | Software version of the available update |
| | | |
| `teslamate/cars/$car_id/model` | 3 | Either "S", "3", "X" or "Y" |
| `teslamate/cars/$car_id/trim_badging` | P100D | Trim badging |
| `teslamate/cars/$car_id/exterior_color` | DeepBlue | The exterior color |
| `teslamate/cars/$car_id/wheel_type` | Pinwheel18 | The wheel type |
| `teslamate/cars/$car_id/spoiler_type` | None | The spoiler type |
| | | |
| `teslamate/cars/$car_id/geofence` | 🏡 Home | The name of the Geo-fence, if one exists at the current position |
| | | |
| `teslamate/cars/$car_id/latitude` | 35.278131 | DEPRECATED: Last reported car latitude |
| `teslamate/cars/$car_id/longitude` | 29.744801 | DEPRECATED: Last reported car longitude |
| `teslamate/cars/$car_id/location` | <pre lang="json">\{<br /> "latitude": 35.278131,<br /> "longitude": 29.744801<br />\}</pre> | Last reported car location (json blob) |
| `teslamate/cars/$car_id/shift_state` | D | Current/Last Shift State (D/N/R/P) |
| `teslamate/cars/$car_id/power` | -9 | Current battery power in watts. Positive value on discharge, negative value on charge |
| `teslamate/cars/$car_id/speed` | 12 | Current Speed in km/h |
| `teslamate/cars/$car_id/heading` | 340 | Last reported car direction |
| `teslamate/cars/$car_id/elevation` | 70 | Current elevation above sea level in meters |
| | | |
| `teslamate/cars/$car_id/locked` | true | Indicates if the car is locked |
| `teslamate/cars/$car_id/sentry_mode` | false | Indicates if Sentry Mode is active |
| `teslamate/cars/$car_id/windows_open` | false | Indicates if any of the windows are open |
| `teslamate/cars/$car_id/doors_open` | false | Indicates if any of the doors are open |
| `teslamate/cars/$car_id/driver_front_door_open` | false | Indicates if the driver-side front door is open |
| `teslamate/cars/$car_id/driver_rear_door_open` | false | Indicates if the driver-side rear door is open |
| `teslamate/cars/$car_id/passenger_front_door_open` | false | Indicates if the passenger-side front door is open |
| `teslamate/cars/$car_id/passenger_rear_door_open` | false | Indicates if the passenger-side rear door is open |
| `teslamate/cars/$car_id/trunk_open` | false | Indicates if the trunk is open |
| `teslamate/cars/$car_id/frunk_open` | false | Indicates if the frunk is open |
| `teslamate/cars/$car_id/is_user_present` | false | Indicates if a user is present in the vehicle |
| | | |
| `teslamate/cars/$car_id/is_climate_on` | true | Indicates if the climate control is on |
| `teslamate/cars/$car_id/inside_temp` | 20.8 | Inside Temperature in °C |
| `teslamate/cars/$car_id/outside_temp` | 18.4 | Temperature in °C |
| `teslamate/cars/$car_id/is_preconditioning` | false | Indicates if the vehicle is being preconditioned |
| | | |
| `teslamate/cars/$car_id/odometer` | 1653 | Car odometer in km |
| `teslamate/cars/$car_id/est_battery_range_km` | 372.5 | Estimated Range in km |
| `teslamate/cars/$car_id/rated_battery_range_km` | 401.63 | Rated Range in km |
| `teslamate/cars/$car_id/ideal_battery_range_km` | 335.79 | Ideal Range in km |
| | | |
| `teslamate/cars/$car_id/battery_level` | 88 | Battery Level Percentage |
| `teslamate/cars/$car_id/usable_battery_level` | 85 | Usable battery level percentage |
| `teslamate/cars/$car_id/plugged_in` | true | If car is currently plugged into a charger |
| `teslamate/cars/$car_id/charge_energy_added` | 5.06 | Last added energy in kWh |
| `teslamate/cars/$car_id/charge_limit_soc` | 90 | Charge Limit Configured in Percentage |
| `teslamate/cars/$car_id/charge_port_door_open` | true | Indicates if the charger door is open |
| `teslamate/cars/$car_id/charger_actual_current` | 2.05 | Current amperage supplied by charger |
| `teslamate/cars/$car_id/charger_phases` | 3 | Number of charger power phases (1-3) |
| `teslamate/cars/$car_id/charger_power` | 48.9 | Charger Power |
| `teslamate/cars/$car_id/charger_voltage` | 240 | Charger Voltage |
| `teslamate/cars/$car_id/charge_current_request` | 40 | How many amps the car wants |
| `teslamate/cars/$car_id/charge_current_request_max` | 40 | How many amps the car can have |
| `teslamate/cars/$car_id/scheduled_charging_start_time` | 2019-02-29T23:00:07Z | Start time of the scheduled charge |
| `teslamate/cars/$car_id/time_to_full_charge` | 1.83 | Hours remaining to full charge |
| `teslamate/cars/$car_id/tpms_pressure_fl` | 2.9 | Tire pressure measure in BAR, front left tire |
| `teslamate/cars/$car_id/tpms_pressure_fr` | 2.8 | Tire pressure measure in BAR, front right tire |
| `teslamate/cars/$car_id/tpms_pressure_rl` | 2.9 | Tire pressure measure in BAR, rear left tire |
| `teslamate/cars/$car_id/tpms_pressure_rr` | 2.8 | Tire pressure measure in BAR, rear right tire |
| `teslamate/cars/$car_id/tpms_soft_warning_fl` | true | Indicates if the Tire pressure measure is soft warning, front left tire |
| `teslamate/cars/$car_id/tpms_soft_warning_fr` | false | Indicates if the Tire pressure measure is soft warning, front right tire |
| `teslamate/cars/$car_id/tpms_soft_warning_rl` | false | Indicates if the Tire pressure measure is soft warning, rear left tire |
| `teslamate/cars/$car_id/tpms_soft_warning_rr` | false | Indicates if the Tire pressure measure is soft warning, rear right tire |
| `teslamate/cars/$car_id/active_route_destination` | Home | DEPRECATED: Navigation destination name (or "nil") |
| `teslamate/cars/$car_id/active_route_latitude` | 35.278131 | DEPRECATED: Navigation destination latitude (or "nil") |
| `teslamate/cars/$car_id/active_route_longitude` | 29.744801 | DEPRECATED: Navigation destination longitude (or "nil") |
| `teslamate/cars/$car_id/active_route` | _See below_ | Navigation details (json blob) |
| `teslamate/cars/$car_id/center_display_state` | 0 | Center Display State |
:::note
`$car_id` usually starts at 1
:::
### `active_route` payload examples
Routing to a destination.
```json
{
"destination": "Home",
"energy_at_arrival": 73,
"miles_to_arrival": 6.485299,
"minutes_to_arrival": 23.466667,
"traffic_minutes_delay": 0.0,
"location": {
"latitude": 35.278131,
"longitude": 29.744801
},
"error": null
}
```
Not routing to a destination.
```json
{
"error": "No active route available"
}
```