Home Assistant: Scheduling the car heater

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

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:

    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

entity_id: switch.car_heater

This switch is the main switch entity that connects the car heater to the power socket.

Car heater power consumption

entity_id: sensor.car_heater_power

This is the power consumption sensor used to verify, that the power cable is physically connected.

Temperature sensor

entity_id: weather.home.attributes.temperature

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.

Notification entity

service: notify.mobile_app_samsung_s10

Service id to send notification, if the power cable is unplugged.

…and restarting

Finally after changing entities and devices it’s time to verify the config and restart the Home Assistant configuration interface.

Example UI

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.

12 Replies to “Home Assistant: Scheduling the car heater”

  1. Awesome!
    I was googling this today on the 25th so the timing could not have been better!

  2. Hi,

    I have 6 of those Nedis plugs with flashed Tasmota’s from Puuilo and Motonet and now one for the Car heater just got this automation! Thanks.

    Too sad that new ones has that Beken chip.

    The old patch of the Nedis WIFIPO120FWT devices are still in sale. Working ones has that “works with Amazon Alexa and Google Assistant” in the Circle.

    Non working devices has fancy Alexa and Google logos at the right bottom corner of the package.

  3. Great automation, Toni! A couple of questions from a Home Assistant newbie:

    -Where do I find the Device ID to use for receiving notifications?
    -The calculated run time is always 2.5h regardless of the outside temperature, some examples of what I’ve tried so far:

    value: ‘{{ states.sensor.temperatur_ute }}’
    value: ‘{{ sensor.temperatur_ute }}’
    value: ‘{{ states.weather.********.attributes.temperature }}’


    Jesper from Sweden

    1. Hi!

      An excellent first question! I snooped around, but could not actually find the device_id anywhere anymore.. a long time ago it was visible in Home Assistant Companion app, but could not find it anymore. (I’ve been just copy pasting the device_id from another automations so far).

      You can replace the notification sending by changing it to call entity instead like this:
      – service: notify.mobile_app_samsung_s10
      message: Car heater
      title: Car heating power cable is not connected!

      For the second question I’d suggest to use the developer tools template editor to find the proper outside temperature sensor and it’s value. (You can also use developer tools ‘states’ view to find the proper entity first).

      My outside temperature works with value:
      {{ states(‘sensor.temperature_outdoor’) }}

      ..and through the weather integration:
      {{ states.weather.home.attributes.temperature }}

      However, that is totally dependant of your entity or weather integration you are using.
      Point is to get numeric decimal value out of outside temperature value.

      Ps. I will update the automation template from GitHub to support this new style notification sending in few days. Thanks for mentioning this issue 🙂

  4. Thanks a lot for the reply! I managed to fix error no 2, but the notification problem is still there, so I’ll wait until you update it on GitHub!

    1. Hi,

      Finally had time to make the changes.
      So the notification service is now changed on the GitHub code and also fixed one small issue in the same automation block (had extra ‘ slipped in accidentally).

      Feel free to try it out now and please send me some feedback if it works properly now 🙂

  5. Thank you so much!

    Works perfectly fine with notifications and all. I would just want to modify one thing and that is to make the run time a little bit longer. What should i change and to what to extend every activation with say 30 minutes or so?

    1. Hi and thanks for the feedback!

      Runtime calculation can be found from car_heater.yaml line 194:
      {{(states(‘input_number.car_heater_3h_before_temp’)|float * (-0.05) + 1)|round(1)}}

      As mentioned in this article the formula is: (temperature * -0.05 ) + 1
      So if you like to add static 30min (1/2 hours) to all calculated values you could modify the formula like: (temperature * -0.05 ) + 1 + 0.5

      Changing the line 194 as below should do the trick:
      {{(states(‘input_number.car_heater_3h_before_temp’)|float * (-0.05) + 1 + 0.5)|round(1)}}

        1. I have to correct myself. It doesn’t work as I thought. I seem to have the same issue as Jesper above, but for me the calculated run time is fixed at 1.8 hours (without the addition of the 30 minutes from the previous question). I have tried all variants with both weather- and sensor attributes and if I use the developer template the correct value is displayed. I just can’t get that part to work.

          1. Can you send me your car heater package (with your entities in place) and I’ll check the validity of it and try to reproduce the issue on my own environment?
            If yes, please send it to creatingsmarthome (at) gmail.com and I’ll have a look on it.

  6. Thanks for the automation, just what i was looking for! There will be cold in Finland soon!

Leave a Reply

Your email address will not be published. Required fields are marked *