Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: Upcoming breaking change for Homeassistant mqtt sensor definition #2888

Closed
1 task done
feichtner opened this issue Sep 9, 2022 · 28 comments
Closed
1 task done
Labels

Comments

@feichtner
Copy link

Is there an existing issue for this?

  • 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

@Mosibi
Copy link

Mosibi commented Sep 11, 2022

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.

@bogie
Copy link

bogie commented Nov 25, 2022

@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"

@Mosibi
Copy link

Mosibi commented Nov 25, 2022

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
Copy link

Mosibi commented Nov 25, 2022

@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.

@bogie
Copy link

bogie commented Nov 26, 2022

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

@Mosibi
Copy link

Mosibi commented Nov 26, 2022

@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.

@bogie
Copy link

bogie commented Nov 26, 2022

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

@ybizeul
Copy link

ybizeul commented Nov 30, 2022

@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.

@Mosibi
Copy link

Mosibi commented Nov 30, 2022

@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)

@ybizeul
Copy link

ybizeul commented Nov 30, 2022

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) }} ?

@Mosibi
Copy link

Mosibi commented Nov 30, 2022

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

@ybizeul
Copy link

ybizeul commented Nov 30, 2022

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

@Mosibi
Copy link

Mosibi commented Nov 30, 2022

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

@ybizeul
Copy link

ybizeul commented Nov 30, 2022

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

@Mosibi
Copy link

Mosibi commented Nov 30, 2022

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!!

@ybizeul
Copy link

ybizeul commented Nov 30, 2022

String it is !
image

@Mosibi
Copy link

Mosibi commented Nov 30, 2022

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

@mkaatman
Copy link

mkaatman commented Jul 15, 2023

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

@florian-asche
Copy link

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.

@t3hk0d3
Copy link
Contributor

t3hk0d3 commented Nov 29, 2023

Should be fixed by #3344

@mkaatman
Copy link

mkaatman commented Dec 6, 2023

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

Copy link

github-actions bot commented Feb 5, 2024

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.

@matbor
Copy link

matbor commented Feb 21, 2024

Just wondering if #3344 fixed this issue?

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

@t3hk0d3
Copy link
Contributor

t3hk0d3 commented Feb 21, 2024

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

Copy link

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 github-actions bot added the Stale label Mar 23, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 31, 2024
@kid1412621
Copy link

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?

@brianmay
Copy link
Collaborator

brianmay commented Apr 8, 2024

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

@florian-asche
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests