teslamate icon indicating copy to clipboard operation
teslamate copied to clipboard

Documentation: Upcoming breaking change for Homeassistant mqtt sensor definition

Open feichtner opened this issue 2 years ago • 24 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

What happened?

HA will update the configuration format for its mqtt configuration. Please find the new format below: https://www.home-assistant.io/integrations/sensor.mqtt/#new_format The following integration page requires an update: https://docs.teslamate.org/docs/integrations/home_assistant/

Expected Behavior

No response

Steps To Reproduce

No response

Relevant log output

-

Screenshots

No response

Additional data

No response

Type of installation

Docker

Version

v124

feichtner avatar Sep 09 '22 05:09 feichtner

I adopted to the changes in Home Assistant and placed all the teslamate related configurations in one file, so that I could include it as a package:

In configuration.yaml:

homeassistant:
  packages:
    tesla: !include includes/tesla.yaml

File includes/tesla.yaml:

---

automation:
  - alias: Update Tesla location as MQTT location updates
    initial_state: on
    trigger:
      - platform: mqtt
        topic: teslamate/cars/1/latitude
      - platform: mqtt
        topic: teslamate/cars/1/longitude
    action:
      - service: device_tracker.see
        data_template:
          dev_id: tesla_location
          gps:
            [
              "{{ states.sensor.tesla_latitude.state | default(0) }}",
              "{{ states.sensor.tesla_longitude.state | default(0) }}",
            ]


proximity:
  home_tesla:
    zone: home
    devices:
      - device_tracker.tesla_location
    tolerance: 10
    unit_of_measurement: km


template:
  - sensor:
      - name: Tesla Parking Brake
        unique_id: "tesla_parking_brake"
        state: >
         {% if is_state('sensor.tesla_shift_state', 'P') %}
           ON
         {% else %}
           OFF
         {% endif %}
      - name: Tesla Estimated Range (mi)
        unique_id: "tesla_estimated_range_mi"
        unit_of_measurement: mi
        state: >
         {{ ((states.sensor.tesla_est_battery_range_km.state | default(0)) | float / 1.609344) | round(2) }}
      - name: Tesla Rated Range (mi)
        unique_id: "tesla_rated_range_mi"
        unit_of_measurement: mi
        state: >
         {{ ((states.sensor.tesla_rated_battery_range_km.state | default(0)) | float / 1.609344) | round(2) }}
      - name: Tesla Ideal Range (mi)
        unique_id: "tesla_ideal_range_mi"
        unit_of_measurement: mi
        state: >
         {{ ((states.sensor.tesla_ideal_battery_range_km.state | default(0)) | float / 1.609344) | round(2) }}
      - name: Tesla Odometer (mi)
        unique_id: "tesla_odometer_mi"
        unit_of_measurement: mi
        state: >
         {{ ((states.sensor.tesla_odometer.state | default(0)) | float / 1.609344) | round(2) }}
      - name: Tesla Speed (MPH)
        unique_id: "tesla_speed_mph"
        unit_of_measurement: mph
        state: >
         {{ ((states.sensor.tesla_speed.state | default(0)) | float / 1.609344) | round(2) }}
      - name: Tesla Elevation (ft)
        unique_id: "tesla_elevation_ft"
        unit_of_measurement: ft
        state: >
         {{ ((states.sensor.tesla_elevation.state | default(0)) | float * 3.2808 ) | round(2) }}

mqtt:
  sensor:
    - name: tesla_display_name
      state_topic: "teslamate/cars/1/display_name"
      unique_id: "tesla_cars_1_display_name"
      icon: mdi:car
    - name: tesla_state
      state_topic: "teslamate/cars/1/state"
      unique_id: "tesla_cars_1_state"
      icon: mdi:car-connected
    - name: tesla_since
      state_topic: "teslamate/cars/1/since"
      unique_id: "tesla_cars_1_since"
      device_class: timestamp
      icon: mdi:clock-outline
    - name: tesla_version
      state_topic: "teslamate/cars/1/version"
      unique_id: "tesla_cars_1_version"
      icon: mdi:alphabetical
    - name: tesla_update_version
      state_topic: "teslamate/cars/1/update_version"
      unique_id: "tesla_cars_1_update_version"
      icon: mdi:alphabetical
    - name: tesla_model
      state_topic: "teslamate/cars/1/model"
      unique_id: "tesla_cars_1_model"
    - name: tesla_trim_badging
      state_topic: "teslamate/cars/1/trim_badging"
      unique_id: "tesla_cars_1_trim_badging"
      icon: mdi:shield-star-outline
    - name: tesla_exterior_color
      state_topic: "teslamate/cars/1/exterior_color"
      unique_id: "tesla_cars_1_exterior_color"
      icon: mdi:palette
    - name: tesla_wheel_type
      state_topic: "teslamate/cars/1/wheel_type"
      unique_id: "tesla_cars_1_wheel_type"
    - name: tesla_spoiler_type
      state_topic: "teslamate/cars/1/spoiler_type"
      unique_id: "tesla_cars_1_spoiler_type"
      icon: mdi:car-sports
    - name: tesla_geofence
      state_topic: "teslamate/cars/1/geofence"
      unique_id: "tesla_cars_1_geofence"
      icon: mdi:earth
    - name: tesla_latitude
      state_topic: "teslamate/cars/1/latitude"
      unique_id: "tesla_cars_1_latitude"
      unit_of_measurement: °
      icon: mdi:crosshairs-gps
    - name: tesla_longitude
      state_topic: "teslamate/cars/1/longitude"
      unique_id: "tesla_cars_1_longitude"
      unit_of_measurement: °
      icon: mdi:crosshairs-gps
    - name: tesla_shift_state
      state_topic: "teslamate/cars/1/shift_state"
      unique_id: "tesla_cars_1_shift_state"
      icon: mdi:car-shift-pattern
    - name: tesla_power
      state_topic: "teslamate/cars/1/power"
      unique_id: "tesla_cars_1_power"
      device_class: power
      unit_of_measurement: W
      icon: mdi:flash
    - name: tesla_speed
      state_topic: "teslamate/cars/1/speed"
      unique_id: "tesla_cars_1_speed"
      unit_of_measurement: "km/h"
      icon: mdi:speedometer
    - name: tesla_heading
      state_topic: "teslamate/cars/1/heading"
      unique_id: "tesla_cars_1_heading"
      unit_of_measurement: °
      icon: mdi:compass
    - name: tesla_elevation
      state_topic: "teslamate/cars/1/elevation"
      unique_id: "tesla_cars_1_elevation"
      unit_of_measurement: m
      icon: mdi:image-filter-hdr
    - name: tesla_inside_temp
      state_topic: "teslamate/cars/1/inside_temp"
      unique_id: "tesla_cars_1_inside_temp"
      device_class: temperature
      unit_of_measurement: °C
      icon: mdi:thermometer-lines
    - name: tesla_outside_temp
      state_topic: "teslamate/cars/1/outside_temp"
      unique_id: "tesla_cars_1_outside_temp"
      device_class: temperature
      unit_of_measurement: °C
      icon: mdi:thermometer-lines
    - name: tesla_odometer
      state_topic: "teslamate/cars/1/odometer"
      unique_id: "tesla_cars_1_odometer"
      unit_of_measurement: km
      icon: mdi:counter
    - name: tesla_est_battery_range_km
      state_topic: "teslamate/cars/1/est_battery_range_km"
      unique_id: "tesla_cars_1_est_battery_range_km"
      unit_of_measurement: km
      icon: mdi:gauge
    - name: tesla_rated_battery_range_km
      state_topic: "teslamate/cars/1/rated_battery_range_km"
      unique_id: "tesla_cars_1_rated_battery_range_km"
      unit_of_measurement: km
      icon: mdi:gauge
    - name: tesla_ideal_battery_range_km
      state_topic: "teslamate/cars/1/ideal_battery_range_km"
      unique_id: "tesla_cars_1_ideal_battery_range_km"
      unit_of_measurement: km
      icon: mdi:gauge
    - name: tesla_battery_level
      state_topic: "teslamate/cars/1/battery_level"
      unique_id: "tesla_cars_1_battery_level"
      device_class: battery
      unit_of_measurement: "%"
      icon: mdi:battery-80
    - name: tesla_usable_battery_level
      state_topic: "teslamate/cars/1/usable_battery_level"
      unique_id: "tesla_cars_1_usable_battery_level"
      unit_of_measurement: "%"
      icon: mdi:battery-80
    - name: tesla_charge_energy_added
      state_topic: "teslamate/cars/1/charge_energy_added"
      unique_id: "tesla_cars_1_charge_energy_added"
      device_class: energy
      unit_of_measurement: kWh
      icon: mdi:battery-charging
    - name: tesla_charge_limit_soc
      state_topic: "teslamate/cars/1/charge_limit_soc"
      unique_id: "tesla_cars_1_charge_limit_soc"
      unit_of_measurement: "%"
      icon: mdi:battery-charging-100
    - name: tesla_charger_actual_current
      state_topic: "teslamate/cars/1/charger_actual_current"
      unique_id: "tesla_cars_1_charger_actual_current"
      device_class: current
      unit_of_measurement: A
      icon: mdi:lightning-bolt
    - name: tesla_charger_phases
      state_topic: "teslamate/cars/1/charger_phases"
      unique_id: "tesla_cars_1_charger_phases"
      icon: mdi:sine-wave
    - name: tesla_charger_power
      state_topic: "teslamate/cars/1/charger_power"
      unique_id: "tesla_cars_1_charger_power"
      device_class: power
      unit_of_measurement: kW
      icon: mdi:lightning-bolt
    - name: tesla_charger_voltage
      state_topic: "teslamate/cars/1/charger_voltage"
      unique_id: "tesla_cars_1_charger_voltage"
      device_class: voltage
      unit_of_measurement: V
      icon: mdi:lightning-bolt
    - name: tesla_scheduled_charging_start_time
      state_topic: "teslamate/cars/1/scheduled_charging_start_time"
      unique_id: "tesla_cars_1_scheduled_charging_start_time"
      device_class: timestamp
      icon: mdi:clock-outline
    - name: tesla_time_to_full_charge
      state_topic: "teslamate/cars/1/time_to_full_charge"
      unique_id: "tesla_cars_1_time_to_full_charge"
      unit_of_measurement: h
      icon: mdi:clock-outline
  binary_sensor:
     - name: tesla_healthy
       state_topic: "teslamate/cars/1/healthy"
       unique_id: "tesla_cars_1_healthy"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:heart-pulse
     - name: tesla_update_available
       state_topic: "teslamate/cars/1/update_available"
       unique_id: "tesla_cars_1_update_available"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:alarm
     - name: tesla_locked
       device_class: lock
       state_topic: "teslamate/cars/1/locked"
       unique_id: "tesla_cars_1_locked"
       payload_on: "false"
       payload_off: "true"
     - name: tesla_sentry_mode
       state_topic: "teslamate/cars/1/sentry_mode"
       unique_id: "tesla_cars_1_sentry_mode"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:cctv
     - name: tesla_windows_open
       device_class: window
       state_topic: "teslamate/cars/1/windows_open"
       unique_id: "tesla_cars_1_windows_open"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:car-door
     - name: tesla_doors_open
       device_class: door
       state_topic: "teslamate/cars/1/doors_open"
       unique_id: "tesla_cars_1_doors_open"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:car-door
     - name: tesla_trunk_open
       device_class: opening
       state_topic: "teslamate/cars/1/trunk_open"
       unique_id: "tesla_cars_1_trunk_open"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:car-side
     - name: tesla_frunk_open
       device_class: opening
       state_topic: "teslamate/cars/1/frunk_open"
       unique_id: "tesla_cars_1_frunk_open"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:car-side
     - name: tesla_is_user_present
       device_class: presence
       state_topic: "teslamate/cars/1/is_user_present"
       unique_id: "tesla_cars_1_is_user_present"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:human-greeting
     - name: tesla_is_climate_on
       state_topic: "teslamate/cars/1/is_climate_on"
       unique_id: "tesla_cars_1_is_climate_on"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:fan
     - name: tesla_is_preconditioning
       state_topic: "teslamate/cars/1/is_preconditioning"
       unique_id: "tesla_cars_1_is_preconditioning"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:fan
     - name: tesla_plugged_in
       device_class: plug
       state_topic: "teslamate/cars/1/plugged_in"
       unique_id: "tesla_cars_1_plugged_in"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:ev-station
     - name: tesla_charge_port_door_open
       device_class: opening
       state_topic: "teslamate/cars/1/charge_port_door_open"
       unique_id: "tesla_cars_1_charge_port_door_open"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:ev-plug-tesla

I also fixed some templating issues in case of a missing source, which mostly happens when HA is starting.

Mosibi avatar Sep 11 '22 15:09 Mosibi

@Mosibi Thanks! Did you also include the known_devices.yaml code linked in the official documentation? Because that gives me errors, namely "missing devices section"

bogie avatar Nov 25 '22 15:11 bogie

The known_devices.yaml file is deprecated, but still working. So I still have a small known_devices.yaml file with only the tesla_location entry in it.

$ cat known_devices.yaml 

tesla_location:
  name: tesla_location
  mac:
  icon:
  picture:
  track: true

Mosibi avatar Nov 25 '22 18:11 Mosibi

@bogie I took a second look and I have it working with the know_devices.yaml file. This is the change I made

diff --git a/includes/tesla.yaml b/includes/tesla.yaml
index ebb7fd4..eaf8a05 100644
--- a/includes/tesla.yaml
+++ b/includes/tesla.yaml
@@ -13,11 +13,8 @@ automation:
         data_template:
           dev_id: tesla_location
           gps:
-            [
-              "{{ states.sensor.tesla_latitude.state | default(0) }}",
-              "{{ states.sensor.tesla_longitude.state | default(0) }}",
-            ]
-
+            - "{{ states.sensor.tesla_latitude.state | default(0) }}"
+            - "{{ states.sensor.tesla_longitude.state | default(0) }}"

Edit: Aha!!! Home Assistant creates the know_devices.yaml for this entry.

Mosibi avatar Nov 25 '22 18:11 Mosibi

On my end there is an error in known_devices.yaml:

"Missing property "devices"."

I have the same entry in there as you do and my configuration.yaml has:

device_tracker: !include known_devices.yaml

bogie avatar Nov 26 '22 22:11 bogie

@bogie the file known_devices.yaml is created when a device_tracker is configured. In your case, you should probably remove the ‘device_tracker’ line. Device tracker configuration should not be placed in that file.

Mosibi avatar Nov 26 '22 22:11 Mosibi

@Mosibi got it, my bad. I misread the documentation on the wiki. Not sure how I came up with that idea :D

bogie avatar Nov 26 '22 23:11 bogie

@Mosibi This is fabulous, it should be what's in the documentation, which currently use deprecated syntax and is all over the place. One remark though, I changed all deault(0) with a float(0) in the next statement, so that unknown values don't throw an exception. It is my understanding that default() is handled for nullvalues, but not unknown values, which is what I actually get initially.

ybizeul avatar Nov 30 '22 07:11 ybizeul

@ybizeul See https://jinja.palletsprojects.com/en/latest/templates/#jinja-filters.default

If you change it to float(0), it will apply the float filter on the value before the pipe. If that value is not defined you will get an error, so it should be default(0)

Mosibi avatar Nov 30 '22 08:11 Mosibi

Ok, so with your template I'm getting :

{{ ((states.sensor.tesla_speed.state | default(0)) | float / 1.609344) | round(2) }}

ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ ((states.sensor.tesla_speed.state | default(0)) | float / 1.609344) | round(2) }}' but no default was specified

states.sensor.tesla_speed.state is unknown

Should it be {{ ((states.sensor.tesla_speed.state | default(0)) | float(0) / 1.609344) | round(2) }} ?

ybizeul avatar Nov 30 '22 09:11 ybizeul

I tried to reproduce the error you have, but I failed. You could use float(0) indeed, that's feeding (also) a default value of 0 when it is not set.

Btw, maybe you know or not, but these templates are easy to check in HA self using the http://:8123/developer-tools/template

Mosibi avatar Nov 30 '22 10:11 Mosibi

It could be that since reinstalling teslamate I didn't move the car, it seems elevation and speed messages were not sent yet

ybizeul avatar Nov 30 '22 11:11 ybizeul

But still the default should catch that. But anyway, a double default does not harm 😄

Mosibi avatar Nov 30 '22 12:11 Mosibi

I might be on to something. Is it possible the result is the actual "unknown" string ? image

ybizeul avatar Nov 30 '22 12:11 ybizeul

Can you wrap the output like this, output: ##{{ states.sensor.tesla_speed.state }}##. If the output is ##unknown##, then it is indeed a string.

Good finding!!

Mosibi avatar Nov 30 '22 13:11 Mosibi

String it is ! image

ybizeul avatar Nov 30 '22 13:11 ybizeul

And that is solved by the float(0). At least we know it now. Cool!

Mosibi avatar Nov 30 '22 14:11 Mosibi

Is there updated guidance on doing it without known_devices.yaml? I was able to duplicate what you've got but I get entity not available for proximity.home_tesla.

Edit: When in doubt, restart HA.

The docs still don't quite make sense in the example automation. image

My device_tracker doesn't have a simple "home" or "not_home", instead it returns:

source_type: gps
latitude: <scrubbed>
longitude: <scrubbed>
gps_accuracy: 0
heading: 66
speed: null
attribution: Data provided by Tesla
friendly_name: Tesla Location tracker

https://www.home-assistant.io/integrations/device_tracker/ Based on the docs, I should have a location_name

Edit: Here's what I ended up with if it's useful for anyone in the future.

alias: Tesla Arrival/Departure
description: Open/Close Garage Based on if Tesla is coming or going
trigger:
  - platform: zone
    entity_id: device_tracker.tesla_location_tracker
    zone: zone.approaching_home
    event: leave
    id: tesla_leaving
  - platform: zone
    entity_id: device_tracker.tesla_location_tracker
    zone: zone.approaching_home
    event: enter
    id: tesla_arriving
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: tesla_arriving
        sequence:
          - device_id: 42e0694050f8b1542dce99a147629cd2
            domain: cover
            entity_id: cover.ratgdo_41084
            type: open
      - conditions:
          - condition: trigger
            id: tesla_leaving
        sequence:
          - device_id: 42e0694050f8b1542dce99a147629cd2
            domain: cover
            entity_id: cover.ratgdo_41084
            type: close
    default: []
mode: single

mkaatman avatar Jul 15 '23 19:07 mkaatman

Hi everyone, today i used most of the existing config from https://docs.teslamate.org/docs/integrations/home_assistant/#automationyaml. Everything is working, but yeah some stuff is deprecated. The known_devices was already mentioned here, what is the new way? Will HA create the device automatically?

By the way, data_template is also deprecated in the automation.yaml. It should be replaced by data.

florian-asche avatar Sep 05 '23 00:09 florian-asche

Should be fixed by https://github.com/teslamate-org/teslamate/pull/3344

t3hk0d3 avatar Nov 29 '23 14:11 t3hk0d3

My automation stopped working on Dec 3rd. I'm still trying to troubleshoot to figure out why.

mkaatman avatar Dec 06 '23 01:12 mkaatman

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Feb 05 '24 01:02 github-actions[bot]

Just wondering if https://github.com/teslamate-org/teslamate/pull/3344 fixed this issue?

Noticed the documentation still lists proximity https://docs.teslamate.org/docs/integrations/home_assistant#configurationyaml

matbor avatar Feb 21 '24 09:02 matbor

@matbor i think this is different issue. At moment of #3344 proximity wasn't deprecated yet.

t3hk0d3 avatar Feb 21 '24 10:02 t3hk0d3

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Mar 23 '24 01:03 github-actions[bot]

I adopted to the changes in Home Assistant and placed all the teslamate related configurations in one file, so that I could include it as a package:

In configuration.yaml:

homeassistant:
  packages:
    tesla: !include includes/tesla.yaml

File includes/tesla.yaml:

---

automation:
  - alias: Update Tesla location as MQTT location updates
    initial_state: on
    trigger:
      - platform: mqtt
        topic: teslamate/cars/1/latitude
      - platform: mqtt
        topic: teslamate/cars/1/longitude
    action:
      - service: device_tracker.see
        data_template:
          dev_id: tesla_location
          gps:
            [
              "{{ states.sensor.tesla_latitude.state | default(0) }}",
              "{{ states.sensor.tesla_longitude.state | default(0) }}",
            ]


proximity:
  home_tesla:
    zone: home
    devices:
      - device_tracker.tesla_location
    tolerance: 10
    unit_of_measurement: km


template:
  - sensor:
      - name: Tesla Parking Brake
        unique_id: "tesla_parking_brake"
        state: >
         {% if is_state('sensor.tesla_shift_state', 'P') %}
           ON
         {% else %}
           OFF
         {% endif %}
      - name: Tesla Estimated Range (mi)
        unique_id: "tesla_estimated_range_mi"
        unit_of_measurement: mi
        state: >
         {{ ((states.sensor.tesla_est_battery_range_km.state | default(0)) | float / 1.609344) | round(2) }}
      - name: Tesla Rated Range (mi)
        unique_id: "tesla_rated_range_mi"
        unit_of_measurement: mi
        state: >
         {{ ((states.sensor.tesla_rated_battery_range_km.state | default(0)) | float / 1.609344) | round(2) }}
      - name: Tesla Ideal Range (mi)
        unique_id: "tesla_ideal_range_mi"
        unit_of_measurement: mi
        state: >
         {{ ((states.sensor.tesla_ideal_battery_range_km.state | default(0)) | float / 1.609344) | round(2) }}
      - name: Tesla Odometer (mi)
        unique_id: "tesla_odometer_mi"
        unit_of_measurement: mi
        state: >
         {{ ((states.sensor.tesla_odometer.state | default(0)) | float / 1.609344) | round(2) }}
      - name: Tesla Speed (MPH)
        unique_id: "tesla_speed_mph"
        unit_of_measurement: mph
        state: >
         {{ ((states.sensor.tesla_speed.state | default(0)) | float / 1.609344) | round(2) }}
      - name: Tesla Elevation (ft)
        unique_id: "tesla_elevation_ft"
        unit_of_measurement: ft
        state: >
         {{ ((states.sensor.tesla_elevation.state | default(0)) | float * 3.2808 ) | round(2) }}

mqtt:
  sensor:
    - name: tesla_display_name
      state_topic: "teslamate/cars/1/display_name"
      unique_id: "tesla_cars_1_display_name"
      icon: mdi:car
    - name: tesla_state
      state_topic: "teslamate/cars/1/state"
      unique_id: "tesla_cars_1_state"
      icon: mdi:car-connected
    - name: tesla_since
      state_topic: "teslamate/cars/1/since"
      unique_id: "tesla_cars_1_since"
      device_class: timestamp
      icon: mdi:clock-outline
    - name: tesla_version
      state_topic: "teslamate/cars/1/version"
      unique_id: "tesla_cars_1_version"
      icon: mdi:alphabetical
    - name: tesla_update_version
      state_topic: "teslamate/cars/1/update_version"
      unique_id: "tesla_cars_1_update_version"
      icon: mdi:alphabetical
    - name: tesla_model
      state_topic: "teslamate/cars/1/model"
      unique_id: "tesla_cars_1_model"
    - name: tesla_trim_badging
      state_topic: "teslamate/cars/1/trim_badging"
      unique_id: "tesla_cars_1_trim_badging"
      icon: mdi:shield-star-outline
    - name: tesla_exterior_color
      state_topic: "teslamate/cars/1/exterior_color"
      unique_id: "tesla_cars_1_exterior_color"
      icon: mdi:palette
    - name: tesla_wheel_type
      state_topic: "teslamate/cars/1/wheel_type"
      unique_id: "tesla_cars_1_wheel_type"
    - name: tesla_spoiler_type
      state_topic: "teslamate/cars/1/spoiler_type"
      unique_id: "tesla_cars_1_spoiler_type"
      icon: mdi:car-sports
    - name: tesla_geofence
      state_topic: "teslamate/cars/1/geofence"
      unique_id: "tesla_cars_1_geofence"
      icon: mdi:earth
    - name: tesla_latitude
      state_topic: "teslamate/cars/1/latitude"
      unique_id: "tesla_cars_1_latitude"
      unit_of_measurement: °
      icon: mdi:crosshairs-gps
    - name: tesla_longitude
      state_topic: "teslamate/cars/1/longitude"
      unique_id: "tesla_cars_1_longitude"
      unit_of_measurement: °
      icon: mdi:crosshairs-gps
    - name: tesla_shift_state
      state_topic: "teslamate/cars/1/shift_state"
      unique_id: "tesla_cars_1_shift_state"
      icon: mdi:car-shift-pattern
    - name: tesla_power
      state_topic: "teslamate/cars/1/power"
      unique_id: "tesla_cars_1_power"
      device_class: power
      unit_of_measurement: W
      icon: mdi:flash
    - name: tesla_speed
      state_topic: "teslamate/cars/1/speed"
      unique_id: "tesla_cars_1_speed"
      unit_of_measurement: "km/h"
      icon: mdi:speedometer
    - name: tesla_heading
      state_topic: "teslamate/cars/1/heading"
      unique_id: "tesla_cars_1_heading"
      unit_of_measurement: °
      icon: mdi:compass
    - name: tesla_elevation
      state_topic: "teslamate/cars/1/elevation"
      unique_id: "tesla_cars_1_elevation"
      unit_of_measurement: m
      icon: mdi:image-filter-hdr
    - name: tesla_inside_temp
      state_topic: "teslamate/cars/1/inside_temp"
      unique_id: "tesla_cars_1_inside_temp"
      device_class: temperature
      unit_of_measurement: °C
      icon: mdi:thermometer-lines
    - name: tesla_outside_temp
      state_topic: "teslamate/cars/1/outside_temp"
      unique_id: "tesla_cars_1_outside_temp"
      device_class: temperature
      unit_of_measurement: °C
      icon: mdi:thermometer-lines
    - name: tesla_odometer
      state_topic: "teslamate/cars/1/odometer"
      unique_id: "tesla_cars_1_odometer"
      unit_of_measurement: km
      icon: mdi:counter
    - name: tesla_est_battery_range_km
      state_topic: "teslamate/cars/1/est_battery_range_km"
      unique_id: "tesla_cars_1_est_battery_range_km"
      unit_of_measurement: km
      icon: mdi:gauge
    - name: tesla_rated_battery_range_km
      state_topic: "teslamate/cars/1/rated_battery_range_km"
      unique_id: "tesla_cars_1_rated_battery_range_km"
      unit_of_measurement: km
      icon: mdi:gauge
    - name: tesla_ideal_battery_range_km
      state_topic: "teslamate/cars/1/ideal_battery_range_km"
      unique_id: "tesla_cars_1_ideal_battery_range_km"
      unit_of_measurement: km
      icon: mdi:gauge
    - name: tesla_battery_level
      state_topic: "teslamate/cars/1/battery_level"
      unique_id: "tesla_cars_1_battery_level"
      device_class: battery
      unit_of_measurement: "%"
      icon: mdi:battery-80
    - name: tesla_usable_battery_level
      state_topic: "teslamate/cars/1/usable_battery_level"
      unique_id: "tesla_cars_1_usable_battery_level"
      unit_of_measurement: "%"
      icon: mdi:battery-80
    - name: tesla_charge_energy_added
      state_topic: "teslamate/cars/1/charge_energy_added"
      unique_id: "tesla_cars_1_charge_energy_added"
      device_class: energy
      unit_of_measurement: kWh
      icon: mdi:battery-charging
    - name: tesla_charge_limit_soc
      state_topic: "teslamate/cars/1/charge_limit_soc"
      unique_id: "tesla_cars_1_charge_limit_soc"
      unit_of_measurement: "%"
      icon: mdi:battery-charging-100
    - name: tesla_charger_actual_current
      state_topic: "teslamate/cars/1/charger_actual_current"
      unique_id: "tesla_cars_1_charger_actual_current"
      device_class: current
      unit_of_measurement: A
      icon: mdi:lightning-bolt
    - name: tesla_charger_phases
      state_topic: "teslamate/cars/1/charger_phases"
      unique_id: "tesla_cars_1_charger_phases"
      icon: mdi:sine-wave
    - name: tesla_charger_power
      state_topic: "teslamate/cars/1/charger_power"
      unique_id: "tesla_cars_1_charger_power"
      device_class: power
      unit_of_measurement: kW
      icon: mdi:lightning-bolt
    - name: tesla_charger_voltage
      state_topic: "teslamate/cars/1/charger_voltage"
      unique_id: "tesla_cars_1_charger_voltage"
      device_class: voltage
      unit_of_measurement: V
      icon: mdi:lightning-bolt
    - name: tesla_scheduled_charging_start_time
      state_topic: "teslamate/cars/1/scheduled_charging_start_time"
      unique_id: "tesla_cars_1_scheduled_charging_start_time"
      device_class: timestamp
      icon: mdi:clock-outline
    - name: tesla_time_to_full_charge
      state_topic: "teslamate/cars/1/time_to_full_charge"
      unique_id: "tesla_cars_1_time_to_full_charge"
      unit_of_measurement: h
      icon: mdi:clock-outline
  binary_sensor:
     - name: tesla_healthy
       state_topic: "teslamate/cars/1/healthy"
       unique_id: "tesla_cars_1_healthy"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:heart-pulse
     - name: tesla_update_available
       state_topic: "teslamate/cars/1/update_available"
       unique_id: "tesla_cars_1_update_available"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:alarm
     - name: tesla_locked
       device_class: lock
       state_topic: "teslamate/cars/1/locked"
       unique_id: "tesla_cars_1_locked"
       payload_on: "false"
       payload_off: "true"
     - name: tesla_sentry_mode
       state_topic: "teslamate/cars/1/sentry_mode"
       unique_id: "tesla_cars_1_sentry_mode"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:cctv
     - name: tesla_windows_open
       device_class: window
       state_topic: "teslamate/cars/1/windows_open"
       unique_id: "tesla_cars_1_windows_open"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:car-door
     - name: tesla_doors_open
       device_class: door
       state_topic: "teslamate/cars/1/doors_open"
       unique_id: "tesla_cars_1_doors_open"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:car-door
     - name: tesla_trunk_open
       device_class: opening
       state_topic: "teslamate/cars/1/trunk_open"
       unique_id: "tesla_cars_1_trunk_open"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:car-side
     - name: tesla_frunk_open
       device_class: opening
       state_topic: "teslamate/cars/1/frunk_open"
       unique_id: "tesla_cars_1_frunk_open"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:car-side
     - name: tesla_is_user_present
       device_class: presence
       state_topic: "teslamate/cars/1/is_user_present"
       unique_id: "tesla_cars_1_is_user_present"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:human-greeting
     - name: tesla_is_climate_on
       state_topic: "teslamate/cars/1/is_climate_on"
       unique_id: "tesla_cars_1_is_climate_on"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:fan
     - name: tesla_is_preconditioning
       state_topic: "teslamate/cars/1/is_preconditioning"
       unique_id: "tesla_cars_1_is_preconditioning"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:fan
     - name: tesla_plugged_in
       device_class: plug
       state_topic: "teslamate/cars/1/plugged_in"
       unique_id: "tesla_cars_1_plugged_in"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:ev-station
     - name: tesla_charge_port_door_open
       device_class: opening
       state_topic: "teslamate/cars/1/charge_port_door_open"
       unique_id: "tesla_cars_1_charge_port_door_open"
       payload_on: "true"
       payload_off: "false"
       icon: mdi:ev-plug-tesla

I also fixed some templating issues in case of a missing source, which mostly happens when HA is starting.

where to set the MQTT url? or configuration_url property in the official doc?

kid1412621 avatar Apr 08 '24 09:04 kid1412621

Ideally somebody needs to update the docs to use the new teslamate/cars/$car_id/location topic for the location (json encoded). https://docs.teslamate.org/docs/integrations/mqtt

brianmay avatar Apr 08 '24 10:04 brianmay

Not sure how to handle the proximity which is now in the ui.

florian-asche avatar Apr 08 '24 22:04 florian-asche