Simple thermostat scheduler in Home Assistant

Ever since I moved, I wanted to replace my dumb heating thermostat with Home Assistant, because I would like to be able to turn the heating off when I go away for a few days, but mainly because it would be nice to be able to turn it on a few hours before coming back home.
The new Home Assistant's thermostat card

So, eventually I placed a few Xiaomi temperature sensors around the house, replaced the thermostat with a wifi relay, combined it all together with the Generic Thermostat component, but one important thing was missing: a way to schedule when the temperature should be set to high (comfort mode) or low (eco mode). In my dumb thermostat I was able to set an hourly schedule for each day of the week, since I don't want the heating to be running 24/7. Unfortunately, there is no component to do this in Home Assistant, but since we do have the Python Scripts component, I decided to write a simple Python script to handle my scheduling, along with a simple automation that runs it every 10 minutes:

At the beginning of the script there are two lists: one for weekdays and another for weekends. Each element on those list contains an hour interval where the thermostat target temperature should be set to high. Outside of those intervals, the temperature should be set to low.

If you want to use the script, just change the schedule according to your needs, set the correct TEMP_HIGH and TEMP_LOW values, and set the climate_entity with the entity_id of your thermostat in Home Assistant. No need for external calendars, AppDaemon (although it is great) or external services, just a simple Python script!


  1. These guidelines for maintaining your thermostat to get the most out of it. I am feeling relieved by reading your thoughts on this. Heating and Cooling Toronto

  2. This article is nicely written. A very well written guide to take care of your furnace.
    Heating and Cooling Mississauga

  3. Nice informartion share,thanks admin.Keep it up

  4. This comment has been removed by a blog administrator.


Post a Comment

Popular posts from this blog

How to trigger Alexa routines from Home Assistant

Home Assistant: Notify when a light was left on and no one is at home