Winter is coming once again and pre-heating car is needed when the temperature drops below five degrees. This automation is something that I wrote to a friend of mine and he has been using it for a year now for two cars, so I’d say it’s usable since I’ve had no complaints about it 🙂
Full package can be downloaded from my GitHub repository at https://github.com/kotope/ha_car_heater
(Note 10.12.2021: The old version automation will break with Home Assistant release 2021.12, since time format changes on the Home Assistant end. Fixed version of the automation is available at GitHub link above (basically just changing all timestamp_local -> timestamp_custom)
This is automation is based on existing automation, but this has quite many tweaks compared to the original. Original can be found from here (thanks to the original author as well).
What does it do?
The grand idea is to make pre-heating car as simple as possible. You set departure time from Home Assistant UI and the automation handles the rest.
Of course below the hood there’s more logic:
- User sets the departure time from UI
- Automation calculates how long should the heating be on using current temperature
- Will run only if temperature drops < 10
- Formula: temperature * -0.05 + 1
- Summary: -30c = 2.5h; -20c = 2h; -10c = 1.5h; 0c=1h; +5c=0.8h
- 3 hours before departure automation re-checks the temperature and does adjustments to heating time
- At calculated heater start time checks the power comsumption of the plug
- If power consumption stays at zero, send push notification to user to check if power cable is connected
- Stop heating at departure time
Also there’s also a text included that shows the current status of the automation.
Required and optional hardware for this to work:
- Home Assistant supported outdoor plug with power consumption support (e.g. Nedis Outdoor plug flashed with Tasmota. Note: latest Nedis plugs might contain other than ESP8266 and cannot be flashed to use Tasmota)
- Home Assistant supported Outdoor temperature sensor (OPTIONAL)
Automation is created as a package, because it includes input components, helpers and automations. Download the car_heater.yaml package from https://github.com/kotope/ha_car_heater/blob/main/car_heater.yaml and copy to Home Assistant configuration directory. The package can be set up by adding it to configuration.yaml like this:
homeassistant: packages: car_heater: !include car_heater.yaml
After including the package in the configuration file, we should setup proper entities in the package file. Entities that needs to be added are: (All changed entities are marked as #CHANGE-ME in the car_heater.yaml file).
Car heater power switch
This switch is the main switch entity that connects the car heater to the power socket.
Car heater power consumption
This is the power consumption sensor used to verify, that the power cable is physically connected.
Outside temperature sensor that is used to calculate proper heating times. This can be used from local weather service integration or some separate temperature sensor.
Service id to send notification, if the power cable is unplugged.
Finally after changing entities and devices it’s time to verify the config and restart the Home Assistant configuration interface.
For the UI, I’m trying make it as simple as possible. In stock Home Assistant there’s not a very usable time picker car so with this UI I’m using a custom card called time-picker-card (also installable using HACS).
Example UI has time picker for scheduled departure, enable only weekdays switch, enabling/disabling the scheduler, manually controllable car heating plug, run time length and start time. Also some status information along with current outside temperature.
Example UI can be also downloaded directly from GitHub: https://github.com/kotope/ha_car_heater/blob/main/sample_lovelace_ui.yaml.