Installing TeslaMate

Followed instructions here:

Log shows:

2021-04-24 11:50:12 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: tesla
2021-04-24 11:51:12 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: tesla
2021-04-24 11:52:12 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: tesla

It looks like it’s trying to use the Tesla integration, which is broken. Any suggestions on how to make TeslaMate work in HA?

I have it working via MQTT. You obviously need MQTT running on HomeAssistant, but that is pretty straight forward to setup. Once that is done, you’ll need to create a user for teslamate.

After that, you’ll need to update your .env’ file on teslamate with the following variables:

MQTT_HOST=
MQTT_PORT=
MQTT_USERNAME=
MQTT_PASSWORD=

and then update your docker-compose.yml and add the MQTT variables to the environment section like this:

- MQTT_HOST=${MQTT_HOST}
- MQTT_PORT=${MQTT_PORT}
- MQTT_USERNAME=${MQTT_USERNAME}
- MQTT_PASSWORD=${MQTT_PASSWORD}

Restart teslamate and it should start to publish messages to your HomeAssistant.

The teslamate HomeAssistant integration doc ( https://docs.teslamate.org/docs/integrations/home_assistant ) then gives examples of how to set up the various sensors etc.

Working on a blog article to have a bit more detail, but this should get you going in the right direction.

Did you write that blog article in the meantime?
Not sure on how to install teslamate on my HAos

1 Like

@Chacsam Teslamate is likely installed outside of HAos. An option is to use Docker. Teslamate has templates to setup everything required with support of mqtt. Once Teslamate is all setup, I believe HAos should be able to integrate with “Teslamate’s mqtt service”.

I’ve been trying to move away from an old Docker hass installation to a vm (HAos) on a newer Synology. I wish “HAos mqtt integration” could expose the network port outside of HAos, it doesn’t seem possible.

Resurrecting this older post. I’ve had Teslamate working perfectly via MQTT but am now getting a warning that the use of platform: mqtt in configuration.yaml is being deprecated.

How do I move to the ‘proper’ method of having HA’s MQTT listen to the topics teslamate/cars/1/***

And how do I add the name and icon as per the Teslamate guide linked above?

Thanks!

I’d love some help setting this up, I have Teslamate, the DB, Grafana, and Mosquitto running on a NAS. Home Assistant is on a Pi. Can’t seem to find a good walkthrough to getting it all integrated into HA. Thanks

1 Like


Maybe I can help you,

2 Likes
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: tpms_pressure_fl
      unique_id: "tpms_pressure_fl"
      device_class: pressure
      state_topic: "teslamate/cars/1/tpms_pressure_fl"
      unit_of_measurement: bar
      icon: mdi:car-tire-alert
      value_template: "{{ value | float  | round (2) }}"
    - name: tpms_pressure_fr
      unique_id: "tpms_pressure_fr"
      device_class: pressure
      state_topic: "teslamate/cars/1/tpms_pressure_fr"


  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



template:
  - sensor:
      - name: tesla parking brake
        icon: mdi:car-brake-parking
        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
        icon: mdi:counter
        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
        icon: mdi:counter
        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
        icon: mdi:counter
        state: >
         {{ ((states.sensor.tesla_ideal_battery_range_km.state | default(0)) | float / 1.609344) | round(2) }}
      - name: Tesla Ideal Range (km)
        unique_id: "tesla_ideal_range_km"
        unit_of_measurement: km
        icon: mdi:counter
        state: >
         {{ ((states.sensor.tesla_ideal_battery_range_km.state | default(0)) | float / 1) | round(0) }}
      - name: Tesla Odometer (mi)
        unique_id: "tesla_odometer_mi"
        unit_of_measurement: mi
        icon: mdi:counter
        state: >-
         {{ ((states.sensor.tesla_odometer.state | default(0)) | float / 1.609344) | round(2) }}
      - name: Tesla Odometer (km)
        unique_id: "tesla_odometer_km"
        unit_of_measurement: km
        icon: mdi:counter
        state: >-
         {{ ((states.sensor.tesla_odometer.state | default(0)) | float * 1) | round(0) }}
      - name: Tesla Speed (MPH)
        unique_id: "tesla_speed_mph"
        device_class: speed
        unit_of_measurement: mph
        icon: mdi:speedometer
        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
        icon: mdi:elevation-decline
        state: >-
         {{ ((states.sensor.tesla_elevation.state | default(0)) | float * 3.2808 ) | round(2) }}

Just like this


full backup, May be able to help you

Hi, thanks, first thing is figuring out MQTT and Home Assistant grabbing the data from Teslamate. What do I have to configure on the Teslamate side and what needs to be done on the Home Assistant side.

1、edit your teslamate docker-compose.yml , ,like this, and restart teslamate docker.

2、check your 1883 port whether it can be accessed, like “telnet ip:1883" in your windows CMD
3、Add integration in home assistant ,with your user&password

OK, thanks, I configured the docker.compose.yml file with the updated MQTT info, as well as the port information. From Home Assistant I added MQTT and entered the IP, port, user, and pass, and it said it was successful. I added the sensors, binary sensors, mqtt sensors, and mqtt binary sensors to my configuration.yaml. I created a test dashboard and copied/pasted the lovelace ui, the entities mostly appear, but status is unknown/unavailable for all. I don’t think the data is coming over from Teslamate and I don’t know how to test for sure.

I tried going to the MQTT configuration to Listen to a topic manually and hit start listening, but no data comes back. How do I know if the MQTT server is publishing the data to Home Assistant?

Thanks

Hi, I figured I would power the car up to see if that forced some data and sure enough it started populating some of the dashboard entities. So it looks like the basic setup is complete. I have a couple of missing entities that I need to check on as they are not working. Thanks for pointing me in the right direction to get this working. Next is to figure out how to control things from HA back to the Tesla.

What information do you want to bring to the Home assistant?
If your teslamate is installed correctly then MQTT should have many topics from teslamate.
the official documentation helped me set it up in Home Automation. Here is the link

Start with mqtt_sensor.yaml section of the document.

Where do you create this yaml and which name?

I couldn’t find a better way to add all the sensor data from Teslamate so I created an autodiscovery script for Home Assistant. It’s just a YAML script that will bring in all the Teslamate MQTT topics as sensors and put them under a single device, which is something that can’t be accomplished with manually-created MQTT sensors. Since it’s a YAML script you can easily edit/add/remove any sensors you like. This includes renaming them, setting the preferred units and the conversion factors, changing the icons, etc.

Edit: screenshot of device:

3 Likes

In MQTT a few of the topics are missing compared to what is stated in the TeslaMate MQTT documentation.

I have in total 42 topics published but for example is Model, Version and Trim_Badging missing.

And all of these three is mandatory for the automatic script by @mekaneck to work if I am correct.

Restarting the TeslaMate addon solved this.

Is this add-on still maintained?
As it is now im using a seperate PI4 for TeslaMate, but it feels like a waste of hardware if this add-on is still maintened.