Also - look in to Schedy which runs in AppDaemon and is much better for this stuff, especially heating stuff.
https://hass-apps.readthedocs.io/en/stable/apps/schedy/
Here is an example of stuff I use Schedy to do with my heating:
weather:
- x: "Add(+0.125) if is_on('binary_sensor.spring_season') else Next()"
- x: "Add(-0.25) if is_on('binary_sensor.summer_season') else Next()"
- x: "Add(+0.125) if is_on('binary_sensor.autumn_season') else Next()"
- x: "Add(+0.250) if is_on('binary_sensor.winter_season') else Next()"
- x: "Add(-0.1) if is_on('input_boolean.heating_eco_mode') else Next()"
- x: "Add(-0.1) if is_off('input_boolean.home_state_home') else Next()"
- x: "Add(+0.1) if float(state('sensor.cc_30_min_gust')) > 15 and (state('sensor.wind_dir_cardinal')[:1] == 'N' or state('sensor.wind_dir_cardinal')[:1] == 'E') else Next()"
# - x: "Add(+0.025) if (float(state('sensor.cc_outside_temperature')) < 15.1 and float(state('sensor.cc_rain_rate')) > 0) else Next()"
- x: "Add(+0.025) if float(state('sensor.cc_outside_temperature')) < -9.9 else Next()"
- x: "Add(+0.025) if float(state('sensor.cc_outside_temperature')) < -4.9 else Next()"
- x: "Add(+0.025) if float(state('sensor.cc_outside_temperature')) < 0.1 else Next()"
- x: "Add(+0.025) if float(state('sensor.cc_outside_temperature')) < 5.1 else Next()"
- x: "Add(+0.025) if float(state('sensor.cc_outside_temperature')) < 10.1 else Next()"
- x: "Add(+0.025) if float(state('sensor.cc_outside_temperature')) < 14.1 else Next()"
- x: "Add(-0.2) if float(state('sensor.cc_outside_temperature')) > 30.1 else Next()"
- x: "Add(-0.2) if float(state('sensor.cc_outside_temperature')) > 24.9 else Next()"
- x: "Add(-0.2) if float(state('sensor.cc_outside_temperature')) > 22.9 else Next()"
- x: "Add(-0.2) if float(state('sensor.cc_outside_temperature')) > 21.9 else Next()"
- x: "Add(-0.2) if float(state('sensor.cc_outside_temperature')) > 20.9 else Next()"
- x: "Add(-0.1) if float(state('sensor.cc_outside_temperature')) > 16.8 else Next()"
- x: "Add(+0.025) if (float(state('sensor.cc_outside_temperature')) < 15.1 and float(state('sensor.openweathermap_forecast_precipitation_probability')) > 75) else Next()"
- x: "Postprocess(lambda result: round(result, 1))"
This adjusts the final temperature based on external weather conditions
And then in the actual rules for the house (lower) -
friendly_name: House
schedule:
- v: 18.5
rules:
- x: "IncludeSchedule(schedule_snippets['weather'])"
- x: "Add(-0.2) if is_on('input_boolean.heating_night_mode') else Next()"
- x: "Add(+0.1) if is_on('binary_sensor.livingroom_presence') else Next()"
- x: "Add(+0.1) if (float(state('sensor.livingroom_temperature_temperature')) < 17.8 and is_on('binary_sensor.livingroom_presence')) else Next()"
- { v: 16.5, start: "23:00", end: "07:00" }
- { v: 17.8, start: "07:00", end: "09:00" }
- { v: 17.9, start: "09:00", end: "10:00" }
- { v: 18.0, start: "10:00", end: "10:30" }
- { v: 18.1, start: "10:30", end: "11:00" }
- { v: 18.2, start: "11:30", end: "12:00" }
- { v: 18.3, start: "12:00", end: "12:30" }
- { v: 18.4, start: "12:30", end: "13:00" }
- { v: 18.5, start: "13:00", end: "14:00" }
- { v: 18.6, start: "14:00", end: "15:00" }
- { v: 18.7, start: "15:00", end: "16:00" }
- { v: 18.8, start: "16:00", end: "18:00" }
- { v: 18.9, start: "18:00", end: "20:00" }
- { v: 18.8, start: "20:00", end: "21:00" }
- { v: 18.7, start: "21:00", end: "22:00" }
- { v: 18.6, start: "22:00", end: "23:00" }
I can add and subtract from the final temperature based on whether the house is occupied