Connect a TeslaMate instance to Home Assistant, using MQTT

Related tags

Hardwareteslabuddy
Overview

TeslaBuddy

Connect a TeslaMate instance to Home Assistant, using MQTT. It allows basic control of your Tesla vehicle via Home Assistant (currently, just starting and stopping charging, and changing the charge limit). GPS/location information is also shown in Home Assistant.

All devices are auto-discovered via Home Assistant using MQTT Auto-Discovery - no manual configuration is required.

This is designed to be run in Docker (like TeslaMate), but can be run standalone if desired using command line arguments.

Configuraiton

Configuration can be given via the OS environment (or via the command line).

The full list of options can always be viewed by running the script with -h. To set an option via the OS environment, convert the command line long option to uppercase, and replace "-" with "_", for example, the "--database-host" option would be:

DATABASE_HOST=postgres.local

Example docker-compose.yml

This example assumes you have built TeslaBuddy as follows:

docker build -t teslabuddy .

This is a snippet from a docker-compose.yml file, this would typically be along side the TeslaMate configuration, and assuming you are running Home Assistant in the same file. Note that the DATABASE_* values can match identically the same values used for TeslaMate (you can also create a dedicated user in Postgres with read-only access).

  teslabuddy:
    image: teslabuddy
    depends_on:
      - homeassistant
      - teslamate
      - postgres
      - mqtt
    restart: always
    environment:
      - DATABASE_USER=teslamate
      - DATABASE_PASS=securepassword
      - DATABASE_NAME=teslamate
      - DATABASE_HOST=postgres
      - MQTT_HOST=mqtt
      # - DEBUG=true
    volumes:
      - "/etc/localtime:/etc/localtime:ro"

If you are not running TeslaMate as part of the same docker-compose or swarm or have a different name for it, you will also need to include the TESLAMATE_URL to match your configuration, eg:

      - TESLAMATE_URL=https://teslamate.my.domain/

If your TeslaMate configuration also has several vehicles associated with it, you will also need to include the VIN of the desired vehicle, eg:

      - VIN=5Y123456789123456

Home Assistant "Device Tracker"

An important component of a Home Assistant Device Tracker (I have figured out from trial and error as the docs don't cover this), is the state component should always be either home or not_home. To configure the home location, in TeslaMate create a Geo-Fence (configured via the web interface), and name it "Home". When the vehicle enters this area, it will set the state attribute to home. If not set, the vehicle will always be not home. Home Assistant does not use it's configured home location to set this for device trackers via MQTT (I'm not sure about other devices).

ToDo

Currently this only supports charging actions, and is very much focused on that. However if you are interested in supporting more actions, please raise an issue and I can include it. I will likely add further controls about what options are exposed via MQTT if going down this path.

Additionally, not all items from TeslaMate are surfaced in Home Assistant, please raise an issue if you want more to come through as well.

Finally, the configuration is fairly limited, so if something is not supported that you need (eg: MQTT over TLS), please also raise an issue.

If this becomes at all popular, I'll also look to deploy it to Docker Hub (so you don't have to build it yourself).

Implementation Notes

This implementation uses the vehicle VIN as as identifier for everything to make sure it remains unique. This means that should a vehicle be move to/from another account, things should remain the same in Home Assistant, even if TeslaMate needs updating.

I use this to manage when my car will charge, to make the most of home solar generation and cheap grid prices (adjusting how much the vehicle will charge based on the current value).

New armachat based on Raspberry Pi PICO an Circuitpython code

Armachat-circuitpython New Armachat based on Raspberry Pi PICO an Circuitpython code Software working features: send message with header and store to

Peter Misenko 44 Dec 24, 2022
Интеграция Home Assistant с ЛК "Интер РАО"

ЕЛК ЖКХ «Интер РАО» для Home Assistant Предоставление информации о текущем состоянии ваших аккаунтов в ЕЛК ЖКХ. Введение @ TODO @ Установка Посредство

Alexander Ryazanov 27 Nov 05, 2022
LifeSaver automatically, periodically saves USB flash drive data into the PC

LifeSaver automatically, periodically saves USB flash drive data into the PC. Theoriticaly it will work with any any connected drive ex - Hard Disk ,SSD ... But, can't handle Backing up multipatition

siddharth dhaka 4 Sep 26, 2021
A Python script to monitor the latest block on an LCD.

PiHole-Monitoring A Python script to monitor the latest block on a lcd display. The first number represents the dns queries from the last 24h, the sec

Maxi 4 Dec 05, 2022
A script for performing OTA update over BLE on ESP32

A script for performing OTA update over BLE on ESP32

Felix Biego 18 Dec 15, 2022
Home Assistant integration for energy consumption data from UK SMETS (Smart) meters using the Hildebrand Glow API.

Hildebrand Glow (DCC) Integration Home Assistant integration for energy consumption data from UK SMETS (Smart) meters using the Hildebrand Glow API. T

Aniket 153 Dec 30, 2022
Raspberry Pi Pico as a Rubber Ducky

Raspberry-Pi-Pico-as-a-Rubber-Ducky Kurulum Raspberry Pi Pico cihazınız için CircuitPython'u indirin. Boot düğmesine basılı tutarken cihazı bir USB ba

Furkan Enes POLATOĞLU 6 Dec 13, 2022
Designed a system that can efficiently sort recyclables and transfer them to corresponding bins using Python, a Raspberry Pi, and Quanser Labs.

System for Sorting and Recycling Containers - Project 3 Table of contents Overview The challenge Screenshot My process Built with Code snippets What I

Mit Patel 2 Dec 02, 2022
Final-project-robokeeper created by GitHub Classroom

RoboKeeper! Jonny Bosnich, Joshua Cho, Lio Liang, Marco Morales, Cody Nichoson Demonstration Videos Grabbing the paddle: https://youtu.be/N0HPvFNHrTw

Cody Nichoson 1 Dec 12, 2021
An arduino/ESP project that can play back G-Force data previously recorded

An arduino/ESP project that can play back G-Force data previously recorded

7 Apr 12, 2022
PlatformIO development platform for GSM modules

PlatformIO development platform for GSM modules Supported Modules Quectel M66 OpenCPU Arduino - TODO other - in progress... Supported Boards Comet M66

Georgi Angelov 5 Aug 06, 2022
Raspberry Pi Pico and LoRaWAN from CircuitPython

Raspberry Pi Pico and LoRaWAN from CircuitPython Enable LoRaWAN communications on your Raspberry Pi Pico or any RP2040-based board using CircuitPython

Alasdair Allan 15 Oct 08, 2022
Example for Calculating Robot Dynamics Using Pinocchio Library

A Example for Calculating Robot Dynamics Using Pinocchio Library Developed by: Xinyang Tian. Platform: Linux + Pinocchio. In this work, i use Pinocchi

Rot_Tianers 33 Dec 28, 2022
A circle of LEDs

This repository contains all the design files, production files and example code for a simple circular LED display.

Pim de Groot 15 Aug 21, 2022
What if home automation was homoiconic? Just transformations of data? No more YAML!

radiale what if home-automation was also homoiconic? The upper or proximal row contains three bones, to which Gegenbaur has applied the terms radiale,

Felix Barbalet 21 Mar 26, 2022
[unmaintained] WiFi tools for linux

Note: This project is unmaintained. While I would love to keep up the development on this project, it is difficult for me for several reasons: I don't

Rocky Meza 288 Dec 13, 2022
A Python program that makes it easy to manage modules on a CircuitPython device!

CircuitPython-Bundle-Manager-v2 A Python program that makes it easy to manage modules on a CircuitPython device! The CircuitPython Bundle Manager v2 i

Ckyiu 1 Dec 18, 2021
Get input from OLED Joystick, Runs command, Displays output on OLED Screen (Great for P4wnP1)

p4wnsolo-joyterm Gets text input from OLED Joystick Runs the command you typed Displays output on OLED Screen (Great for P4wnP1 - even better on Raspb

PawnSolo 7 Dec 19, 2022
E-Ink Magic Calendar that automatically syncs to Google Calendar and runs off a battery powered Raspberry Pi Zero

E-Ink Magic Calendar that automatically syncs to Google Calendar and runs off a battery powered Raspberry Pi Zero

2.8k Dec 30, 2022
DOS-like OS for RP2040 basic microcontroller boards

Micropython DOS-like OS for RP2040 microcontroller boards. Check out the demo video at https://www.youtube.com/watch?v=Az_oiq8GE4Y To start the OS typ

RetiredWizard 58 Dec 27, 2022