How to Show Your Tesla's Battery Level in Apple Home (Tesla Fleet, Home Assistant, and a Humidity Sensor Trick)
Apple Home has no tile for "how charged is the car". The Tesla app knows, Home Assistant knows, and with one small trick Apple Home knows too. Each car shows up as a percent reading in the Home app, and flips to Low Battery when it drops under 20%.
The trick: HomeKit has no plain battery accessory, and Home Assistant's HomeKit Bridge does not publish a battery sensor on its own. It does publish humidity sensors, which are a percentage. So a template sensor copies each car's charge into a humidity sensor, and the bridge links the real battery level to it for the Low Battery status.
The page is dressed like a 1998 personal site. The YAML is current. It only reads the cars. Nothing here sends a command or wakes a car.
1 Connect the cars with Tesla Fleet
Tesla Fleet is the built-in Home Assistant integration for the official Tesla Fleet API. Setup has more parts than most, and the Home Assistant docs walk through each one:
- Create a developer application at
developer.tesla.com/request. Grant type Authorization Code and Machine-to-Machine, your domain as the allowed origin, andhttps://my.home-assistant.io/redirect/oauthas the redirect URI. Tick Vehicle Information at least. - In Home Assistant, Add Integration, Tesla Fleet. Enter the Client ID and Client Secret, sign in to Tesla, and choose Select All, then Allow.
- Enter your domain. Upload the public key Home Assistant shows to
https://your-domain/.well-known/appspecific/com.tesla.3p.public-key.pem. - Scan the QR code with your phone to add the virtual key to each car in the Tesla app.
The private half of that key pair stays in your Home Assistant config folder. Keep it, the client secret, and the Tesla token out of git and screenshots.
2 Find each car's battery level sensor
Each car becomes a device with a long list of entities. The one you want is Battery level, a battery class sensor in percent. In this guide they are sensor.model_y_battery_level and sensor.model_3_battery_level. Yours take their names from what each car is called in the Tesla app.
Only add the cars you want in Apple Home. This house has a third Tesla that stays out of HomeKit, and that is just a matter of not listing it below.
3 Mirror the level as a percent sensor HomeKit can show
Home Assistant's HomeKit docs list the sensors it can publish. A sensor with device_class: humidity and unit % becomes a HomeKit humidity sensor. A battery sensor is not on that list by itself. So make a template sensor that copies the battery level into that shape.
template:
- sensor:
- name: "Model Y Battery"
unique_id: hk_model_y_battery
default_entity_id: sensor.model_y_battery
device_class: humidity
unit_of_measurement: "%"
availability: "{{ is_number(states('sensor.model_y_battery_level')) }}"
state: "{{ states('sensor.model_y_battery_level') | float(default=none) }}"
- name: "Model 3 Battery"
unique_id: hk_model_3_battery
default_entity_id: sensor.model_3_battery
device_class: humidity
unit_of_measurement: "%"
availability: "{{ is_number(states('sensor.model_3_battery_level')) }}"
state: "{{ states('sensor.model_3_battery_level') | float(default=none) }}"
The availability line matters. When the Fleet sensor is unavailable or not a number, the mirror goes unavailable too, instead of reporting 0%. Leave these mirrors off your dashboards. They exist only for the HomeKit layout.
4 A HomeKit Bridge for the cars
Put the bridge in the same package file. linked_battery_sensor adds a battery service to each accessory from the real battery level, and low_battery_threshold: 20 sets Status Low Battery under 20%. That is also the default.
homekit:
- name: Tesla Batteries
port: 21080
advertise_ip: 192.168.1.50 # your server's LAN IP
filter:
include_entities:
- sensor.model_y_battery
- sensor.model_3_battery
entity_config:
sensor.model_y_battery:
name: Tesla Y
linked_battery_sensor: sensor.model_y_battery_level
low_battery_threshold: 20
sensor.model_3_battery:
name: Tesla 3
linked_battery_sensor: sensor.model_3_battery_level
low_battery_threshold: 20
A separate bridge keeps the cars away from the lights and the fans, and its own port keeps it apart on the network. Check the configuration under Developer tools, YAML, then restart Home Assistant.
5 Pair it in the Apple Home app
Scan the QR code from the Home Assistant notification in the Home app, choose Add Anyway, and put both cars in a room such as Garage.
Open the Apple Home app
Add Accessory
Scan the QR code from the Home Assistant notification
Add Anyway (uncertified accessory)
Room: Garage
Done
Each car is a humidity sensor named Tesla Y or Tesla 3, reading the charge as a percent. The Home app lists it with the other climate sensors, so the label says humidity. That is the trade for having the number in Home at all. Siri can read it out: "What's the humidity of Tesla Y?"
6 Troubleshooting
The number looks stale
Tesla Fleet polls each car every 10 minutes while it is awake, to stay inside Tesla's monthly API credit. A sleeping car keeps its last reading. Do not add an automation that wakes the car just to refresh the tile.
A car shows No Response
The mirror sensor goes unavailable when the battery level is not a number, which is on purpose. Check the car's Battery level sensor in Home Assistant, and the Tesla Fleet integration's status.
There is no Low Battery status
HomeKit caches an accessory's services. If you added linked_battery_sensor after pairing, reset the accessory so it comes back with the battery service.
action: homekit.reset_accessory
target:
entity_id:
- sensor.model_y_battery
- sensor.model_3_battery
Comments
Loading comments…