What conditions do you want to change them on? I use a boolean-input that I set via an automation and then scheddy watches that and activates the appropriate rule.
You can use date
, which is a datetime.date
object, directly:
- x: "state('input_number.seg1_temp') if time.hour >= float(state('input_number.seg1_starthour')) and time.hour <= float(state('input_number.seg1_endhour')) and date.day == float(state('input_number.seg1_day')) and date.month == float(state('input_number.seg1_month')) else Next()"
EDIT: Fixed an error in the expression.
It’s true, I know, you’re right, it was just to make a joke with the title.
When I discovered scheduler-card that is simpler and easier to use, I stopped using schedy but I recognize that schedy does so much more
If you are searching for dynamic schedules, specified by Lovelace GUI items, you can inpire yourself at my solution:
The link is to Schedy config file but even the rest of HASS config files (sensors, automations, etc.) are available in the repo.
Thanks a lot!
Also big thanks!!!
Added vacation as binary based on Google calendar message
Modified heating season to binary based on week numbers from previous years
Modified input numbers for on off hour minutes to input datetime
In lovelace I use state switch card to display current schedule workday vs free day
Still need to work on
-
add value template away more than 12 hours to vacation mode
-
climate state assess current vs setpoint in order to trigger switch boiler (BlitzWolf) together powering up my telnet home automation unit.
Hi!
Could someone please help me work out the syntax to control an input_number value from Schedy?
I’ve set my actor type to generic2:
actor_type: generic2
I’ve defined a default actor template as follows:
actor_templates:
default:
attributes:
- attribute: state
values:
- value: [*]
calls:
- service: input_number.set_value
data:
param1: "{attr1}"
ignore_case: true
I cannnot now get my head around how this maps to the ACTUAL input_number I want to control for the room? Is is as simple as the actor defintion in the room maps to the input_number name? So in the below snippet, any change the value ‘v’ will be applied to input_number.living_room_set_temp in HomeAssistant?
rooms:
living:
actors:
generic2.living_room_set_temp:
Either way, it’s not working!
Hello, i’m sorry but i’m a dummy to install Schedy !!!
i’m using Hass.io
i installed Appdeamon 4 module
i configured Appdeamon like this :
python_packages:
- hass-apps
I copied “hass-apps” master branch from github to the “appdaemon/apps” folder
I have my “schedy.yaml” file in the folder :
appdeamon/apps/hass_apps
I also have config file for sensors, binary, etc … as canaletto shared us.
But it doesn’t seems to work.
Can someone help me ?
here is my appdaemon log :
2021-11-11 20:42:58.616916 WARNING AppDaemon: App 'values' missing 'class' or 'module' entry - ignoring
2021-11-11 20:42:58.624845 INFO HASS: Startup condition met: hass state=RUNNING
2021-11-11 20:42:58.625114 INFO HASS: All startup conditions met
2021-11-11 20:42:58.626053 WARNING AppDaemon: App 'attributes' missing 'class' or 'module' entry - ignoring
2021-11-11 20:42:58.626299 WARNING AppDaemon: App 'short_values' missing 'class' or 'module' entry - ignoring
2021-11-11 20:42:58.633788 WARNING AppDaemon: App 'actor_type' missing 'class' or 'module' entry - ignoring
2021-11-11 20:42:58.634102 WARNING AppDaemon: App 'actor_templates' missing 'class' or 'module' entry - ignoring
2021-11-11 20:42:58.635226 INFO AppDaemon: App 'hello_world' added
2021-11-11 20:42:58.636079 INFO AppDaemon: App 'schedy' added
2021-11-11 20:42:58.636628 INFO AppDaemon: Found 2 total apps
2021-11-11 20:42:58.636969 INFO AppDaemon: Starting Apps with 2 workers and 2 pins
2021-11-11 20:42:58.637750 INFO AppDaemon: Running on port 5050
2021-11-11 20:42:58.677481 INFO AppDaemon: Got initial state from namespace default
2021-11-11 20:43:00.642651 INFO AppDaemon: Scheduler running in realtime
2021-11-11 20:43:00.645255 INFO AppDaemon: Reading config
2021-11-11 20:43:00.667659 WARNING AppDaemon: Error loading configuration
2021-11-11 20:43:00.668140 WARNING AppDaemon: parser says
2021-11-11 20:43:00.668518 WARNING AppDaemon: in "<unicode string>", line 181, column 6:
bureau_etage:
^
2021-11-11 20:43:00.669008 WARNING AppDaemon: expected <block end>, but found '<block mapping start>' while parsing a block mapping
2021-11-11 20:43:00.670063 WARNING AppDaemon: File '/config/appdaemon/apps/schedy_heating.yaml' invalid structure - ignoring
2021-11-11 20:43:00.688843 WARNING AppDaemon: File '/config/appdaemon/apps/hass-apps/docs/apps/schedy/actors/common-config.yaml' invalid structure - ignoring
2021-11-11 20:43:00.692448 WARNING AppDaemon: File '/config/appdaemon/apps/hass-apps/docs/apps/schedy/actors/thermostat/config.yaml' invalid structure - ignoring
2021-11-11 20:43:00.704837 WARNING AppDaemon: App 'attributes' missing 'class' or 'module' entry - ignoring
2021-11-11 20:43:00.705315 WARNING AppDaemon: App 'values' missing 'class' or 'module' entry - ignoring
2021-11-11 20:43:00.712635 WARNING AppDaemon: App 'attributes' missing 'class' or 'module' entry - ignoring
2021-11-11 20:43:00.713087 WARNING AppDaemon: App 'short_values' missing 'class' or 'module' entry - ignoring
2021-11-11 20:43:00.717231 WARNING AppDaemon: App 'actor_type' missing 'class' or 'module' entry - ignoring
2021-11-11 20:43:00.717644 WARNING AppDaemon: App 'actor_templates' missing 'class' or 'module' entry - ignoring
2021-11-11 20:43:00.718230 INFO AppDaemon: /config/appdaemon/apps/schedy_heating.yaml added or modified
2021-11-11 20:43:00.718613 INFO AppDaemon: /config/appdaemon/apps/hass-apps/docs/apps/schedy/actors/common-config.yaml added or modified
2021-11-11 20:43:00.718980 INFO AppDaemon: /config/appdaemon/apps/hass-apps/docs/apps/schedy/actors/thermostat/config.yaml added or modified
2021-11-11 20:43:00.719334 INFO AppDaemon: /config/appdaemon/apps/hass-apps/docs/apps/schedy/actors/custom/config.yaml added or modified
2021-11-11 20:43:00.719690 INFO AppDaemon: /config/appdaemon/apps/hass-apps/docs/apps/schedy/actors/generic2/config.yaml added or modified
2021-11-11 20:43:00.720047 INFO AppDaemon: /config/appdaemon/apps/hass-apps/docs/apps/schedy/actors/generic/config.yaml added or modified
2021-11-11 20:43:00.720381 INFO AppDaemon: /config/appdaemon/apps/hass-apps/docs/apps/schedy/actors/switch/generic2-config.yaml added or modified
2021-11-11 20:43:00.722650 INFO AppDaemon: Found 2 total apps
2021-11-11 20:43:00.724000 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2021-11-11 20:43:00.724458 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps to module import path
2021-11-11 20:43:00.724921 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps/docs to module import path
2021-11-11 20:43:00.725327 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps/docs/apps to module import path
2021-11-11 20:43:00.725763 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps/docs/apps/schedy to module import path
2021-11-11 20:43:00.726214 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps/docs/apps/schedy/tips-and-tricks to module import path
2021-11-11 20:43:00.726633 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps/docs/apps/schedy/statistics to module import path
2021-11-11 20:43:00.727059 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps/docs/apps/schedy/schedules to module import path
2021-11-11 20:43:00.727468 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps/docs/apps/schedy/schedules/expressions to module import path
2021-11-11 20:43:00.727918 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps/docs/apps/schedy/schedules/expressions/helpers to module import path
2021-11-11 20:43:00.728338 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps/docs/apps/schedy/actors to module import path
2021-11-11 20:43:00.728756 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps/docs/apps/schedy/actors/thermostat to module import path
2021-11-11 20:43:00.729190 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps/docs/apps/schedy/actors/custom to module import path
2021-11-11 20:43:00.729591 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps/docs/apps/schedy/actors/generic2 to module import path
2021-11-11 20:43:00.730008 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps/docs/apps/schedy/actors/generic to module import path
2021-11-11 20:43:00.730399 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps/docs/apps/schedy/actors/switch to module import path
2021-11-11 20:43:00.730710 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps/hass_apps to module import path
2021-11-11 20:43:00.731062 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps/hass_apps/schedy to module import path
2021-11-11 20:43:00.731396 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps/hass_apps/schedy/actor to module import path
2021-11-11 20:43:00.731694 INFO AppDaemon: Adding /config/appdaemon/apps/hass-apps/hass_apps/schedy/expression to module import path
2021-11-11 20:43:00.750636 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/hello.py
2021-11-11 20:43:00.756353 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/setup.py - ignoring
2021-11-11 20:43:00.757191 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/hass-apps/hass_apps_loader.py
2021-11-11 20:43:00.761214 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/docs/conf.py - ignoring
2021-11-11 20:43:00.762091 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/loader.py - ignoring
2021-11-11 20:43:00.763006 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/__init__.py - ignoring
2021-11-11 20:43:00.763883 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/common.py - ignoring
2021-11-11 20:43:00.764692 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/schedy/room.py - ignoring
2021-11-11 20:43:00.765626 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/schedy/schedule.py - ignoring
2021-11-11 20:43:00.766447 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/schedy/__init__.py - ignoring
2021-11-11 20:43:00.767282 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/schedy/stats.py - ignoring
2021-11-11 20:43:00.768249 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/schedy/util.py - ignoring
2021-11-11 20:43:00.769076 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/schedy/app.py - ignoring
2021-11-11 20:43:00.769994 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/schedy/config.py - ignoring
2021-11-11 20:43:00.770818 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/schedy/actor/custom.py - ignoring
2021-11-11 20:43:00.771732 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/schedy/actor/base.py - ignoring
2021-11-11 20:43:00.772558 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/schedy/actor/__init__.py - ignoring
2021-11-11 20:43:00.773482 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/schedy/actor/generic2.py - ignoring
2021-11-11 20:43:00.774347 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/schedy/actor/switch.py - ignoring
2021-11-11 20:43:00.775253 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/schedy/actor/thermostat.py - ignoring
2021-11-11 20:43:00.776135 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/schedy/actor/generic.py - ignoring
2021-11-11 20:43:00.777040 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/schedy/expression/helpers.py - ignoring
2021-11-11 20:43:00.777853 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/schedy/expression/types.py - ignoring
2021-11-11 20:43:00.778751 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hass-apps/hass_apps/schedy/expression/__init__.py - ignoring
2021-11-11 20:43:00.779484 INFO AppDaemon: Initializing app hello_world using class HelloWorld from module hello
2021-11-11 20:43:00.780963 INFO AppDaemon: Initializing app schedy using class SchedyApp from module hass_apps_loader
2021-11-11 20:43:00.943622 INFO hello_world: Hello from AppDaemon
2021-11-11 20:43:00.944734 INFO hello_world: You are now ready to run Apps!
2021-11-11 20:43:00.946732 INFO schedy: *** Welcome to schedy 0.8.3, running on AppDaemon 4.1.0.
2021-11-11 20:43:00.949029 INFO schedy: ***
2021-11-11 20:43:00.950744 INFO schedy: *** This is an app from the hass-apps package.
2021-11-11 20:43:00.952484 INFO schedy: *** DOCS: https://hass-apps.readthedocs.io/en/stable/
2021-11-11 20:43:00.954171 INFO schedy: ***
2021-11-11 20:43:00.955859 INFO schedy: *** You like this app, want to honor the effort put into
2021-11-11 20:43:00.957582 INFO schedy: *** it, ensure continuous development and support?
2021-11-11 20:43:00.959237 INFO schedy: *** Then please consider making a donation.
2021-11-11 20:43:00.960920 INFO schedy: *** DONATE: https://hass-apps.readthedocs.io/en/stable/#donations
2021-11-11 20:43:00.962601 INFO schedy: *** Thank you very much and enjoy schedy!
2021-11-11 20:43:00.964297 INFO schedy: ***
2021-11-11 20:43:00.967499 ERROR schedy: !!! Configuration error: required key not provided @ data['actor_type']. Got None
2021-11-11 20:43:00.969092 ERROR schedy: !!! Not initializing this app.
2021-11-11 20:43:00.972620 INFO AppDaemon: App initialization complete
Did U add a configuration for this app?seems like you just installed the app itself now I must configure it
here is my config as a starting point:
shedy_heating_upstairs:
module: hass_apps_loader
class: SchedyApp
debug: true
actor_type: thermostat
expression_environment: |
def heating_mode():
return state("input_select.heating_mode")
schedule_prepend:
- x: "Mark(OFF, Mark.OVERLAY) if not is_empty(filter_entities('binary_sensor', window_room=room_name, state='on')) else Next()"
- name: global schedule on/off switch
x: "Abort() if is_off('input_boolean.automated_heating') else Next()"
- name: per-room schedule on/off switch
x: "Abort() if is_off('input_boolean.automated_heating_' + room_name) else Next()"
schedule_append:
- v: "OFF"
schedule_snippets:
# BEDROOM
bedroom:
- v: 30
rules:
# don't turn on when it's > 19 degrees in the bedroom
- x: "Break() if float(state('sensor.ac_bedroom_temperature_2') or 0) > 18 else Next()"
- weekdays: 1-5
rules:
- rules:
# - x: "Next() if heating_mode() != 'Normal' else Break()"
- { start: "06:30", end: "07:00" }
- { start: "23:00", end: "23:30" }
- weekdays: 6-7
rules:
- { start: "07:30", end: "07:50" }
- { start: "23:00", end: "23:30" }
# ROOM EVAN
room_evan:
- v: 30
rules:
# don't turn on when it's > 19 degrees in the bedroom
- x: "Break() if float(state('sensor.ac_room_evan_temperature_2') or 0) > 18 else Next()"
- weekdays: 1-5
rules:
- rules:
# - x: "Next() if heating_mode() != 'Normal' else Break()"
- { start: "07:30", end: "07:50" }
- { start: "21:00", end: "21:30" }
- weekdays: 6-7
rules:
- { start: "09:15", end: "09:30" }
- { start: "21:00", end: "21:30" }
# ROOM ROSE
room_rose:
- v: 30
rules:
# don't turn on when it's > 19 degrees in the bedroom
- x: "Break() if float(state('sensor.ac_room_rose_temperature_2') or 0) > 18 else Next()"
- weekdays: 1-5
rules:
- rules:
# - x: "Next() if heating_mode() != 'Normal' else Break()"
- { start: "07:30", end: "07:50" }
- { start: "21:00", end: "21:30" }
- weekdays: 6-7
rules:
- { start: "07:30", end: "07:50" }
- { start: "21:00", end: "21:30" }
watched_entities:
- input_boolean.automated_heating_bedroom
- input_boolean.automated_heating_room_evan
- input_boolean.automated_heating_room_rose
- input_select.heating_mode
- input_boolean.automated_heating
- sensor.ac_bedroom_temperature_2
- sensor.ac_room_evan_temperature_2
- sensor.ac_room_rose_temperature_2
rooms:
# BEDROOM
bedroom:
rescheduling_delay: 30
actors:
climate.bedroom:
watched_entities:
- sensor.ac_bedroom_temperature_2
- binary_sensor.door_window_sensor_158d00019f308a
- input_boolean.automated_heating_bedroom
schedule:
- x: "IncludeSchedule(schedule_snippets['bedroom'])"
# ROOM EVAN
room_evan:
allow_manual_changes: true
rescheduling_delay: 30
actors:
climate.room_evan_ac_control:
watched_entities:
- sensor.ac_room_evan_temperature_2
- binary_sensor.openclose_16
- input_boolean.automated_heating_room_evan
schedule:
- x: "IncludeSchedule(schedule_snippets['room_evan'])"
# ROOM ROSE
room_rose:
allow_manual_changes: true
rescheduling_delay: 30
actors:
climate.rose:
watched_entities:
- sensor.ac_room_rose_temperature_2
- binary_sensor.door_window_sensor_158d00019daf13
- input_boolean.automated_heating_room_rose
schedule:
- x: "IncludeSchedule(schedule_snippets['room_rose'])"
statistics:
# Pick an arbitrary name for the parameter instance.
upstairs_temp_delta:
# The type of parameter as found in the actor'S documentation.
type: temp_delta
# More parameter-specific settings:
rooms:
bedroom:
room_evan:
room_rose:
I found my mistake.
Just a missing “room” in my config file.
Documentation bug or lack of understanding on my side?
Hi! I’m trying to get my head around conditional sub schedules to achieve something like a switch-case.
on Examples — hass-apps 0.20200319.0 documentation there is this example:
schedule:
- v: 20
rules:
- x: "Next() if is_on('input_boolean.include_sub_schedule') else Break()"
- { start: "07:00", end: "09:00" }
- { start: "12:00", end: "22:00" }
- v: 17
- v: "OFF"
Why are there v: 20
and v: 17
?
You have an intent error at ‘off’
v: 20
This is the temperature before any rules are processed.
Next, if input_boolean.include_sub_schedule
is turned on, then set start time to 7am, and end to 9am, and then start time to 12pm and end time to 10pm.
Outside that - set the temperature to 17 v: 17
and outside any of that, set it to OFF
If the input_boolean.include_sub_schedule
is off, then break - which takes us out of the rules, list - so the temperature should be v: 20
(although, it’s possible that it’s actually v: "OFF"
that would be the result)
Thats from the original docs.
Why would I set a temperature before the rules are processed, when would that value be activated?
My current assumption is that this is a docs bug and it should be
schedule:
- v: 20
rules:
- x: "Next() if is_on('input_boolean.include_sub_schedule') else Break()"
- { start: "07:00", end: "09:00" }
- { start: "12:00", end: "22:00" }
- v: "OFF"
Meaning:
If include_sub_schedule is on AND the time it is 7:00-9:00 or 12:00-22:00 set the value to 20
else turn it off
Edit: At least thats how it works in my current setup.
No, it’s if the sub schedule switch is on, then follow the sub schedule (which for some reason has not been included), but only between 7am and 9am, and then 12pm and 10pm. Outside of that time, set it to 17. If the sub_schedule switch is OFF, then set the heating OFF.
When in a sub-schedule, returning Break() from an expression will skip the remaining rules of that sub-schedule and continue evaluation after it.
So if the switch is off, it will stop processing the INNER rules. as the documentation states:
The rules 2-4 of the sub-schedule will only be respected when input_boolean.include_sub_schedule is on. Otherwise, evaluation continues with the last rule, setting the value to OFF.
The v: 20
in this particular example, will never do anything, because “OFF” will always overwrite the value if the sub_schedule switch is off. However, if the v: 17
was not present, then the outer v: 20
would be the temperature that would be set between 9am and 12pm and then 10pm to 7am.
Here is some of my schedy - so you can see, how complicated it can get:
schedule_snippets:
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))"
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.2) if is_off('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: "00: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: "11:30" }
- { v: 18.1, start: "11:30", end: "12:00" }
- { v: 18.2, start: "12:00", end: "12:30" }
- { v: 18.3, start: "12:30", end: "13:00" }
- { v: 18.4, start: "13:00", end: "14:00" }
- { v: 18.5, start: "14:00", end: "15:00" }
- { v: 18.6, start: "15:00", end: "16:00" }
- { v: 18.7, start: "16:00", end: "18:00" }
- { v: 18.8, start: "18:00", end: "20:00" }
- { v: 18.9, start: "20:00", end: "20:30" }
- { v: 18.8, start: "20:30", end: "21:00" }
- { v: 18.7, start: "21:00", end: "22:00" }
- { v: 18.6, start: "22:00", end: "23:00" }
- { v: 18.5, start: "23:00", end: "00:00" }
friendly_name: Upper House
schedule:
- v: 18
rules:
- x: "IncludeSchedule(schedule_snippets['weather'])"
- x: "Add(+0.1) if is_on('binary_sensor.bedroom_presence') else Next()"
- { v: "OFF", start: "08:00", end: "21:00" }
- { v: 18.0, start: "21:00", end: "22:00" }
- { v: 17.9, start: "22:00", end: "23:00" }
- { v: 17.8, start: "23:00", end: "00:00" }
- { v: 17.7, start: "00:00", end: "01:00" }
- { v: 17.6, start: "01:00", end: "02:00" }
- { v: 17.5, start: "02:00", end: "03:00" }
- { v: 17.4, start: "03:00", end: "04:00" }
- { v: 17.4, start: "04:00", end: "06:00" }
- { v: 17.4, start: "06:00", end: "08:00" }
I always set a (sane) default fallback temperature before the rules, to account for an error I might have made in the logic.
One thing is for sure: You know what temperatures you like when
However, what I proposed above doesn’t seem to be completely wrong as my schedule also does what it should do:
livingroom:
rescheduling_delay: 60
actors:
climate.livingroom_9750a2fe_thermostat:
schedule:
- name: "Set lower temp if absent"
v: 16
rules:
- x: "Next() if presence() == 'not home' else Break()"
- name: "Heat to comfy temp during the day when in normal mode"
v: 20
rules:
- x: "Next() if heating_mode() == 'Normal' else Break()"
- { start: "09:00", end: "23:00:00", weekdays: 1-5 }
- { start: "09:30", end: "23:30:00", weekdays: 6-7 }
- name: "Heat to comfy temp in the evening when in HO mode"
v: 20
rules:
- x: "Next() if heating_mode() == 'Homeoffice' else Break()"
- { start: "17:00", end: "22:30:00", weekdays: 1-5 }
- { start: "09:30", end: "23:30:00", weekdays: 6-7 }
- name: "Set lower temp in all other cases"
v: 16
Hi,
First, there is a single space missing before - v: "OFF"
in the example you quoted from the docs, will fix that.
Explanations given so far were not fully correct, so let me try to make things more clear.
A rule in a sub-schedule inherits all parameters from the outer rules, except for those it does define itself.
The v: 20
is inherited by all rules of the sub-schedule that don’t define a v
or x
themselves (that is, rules 2-3 of the sub-schedule).
The v: 17
is a fallback that matches when 1) the input_boolean is turned on and hence processing of the sub-schedule continues (Next()) and 2) neither rule 2 nor rule 3 of the sub-schedule matched (i.e. from 9:00-12:00 and 22:00-7:00).
If the input_boolean is off and thus sub-schedule evaluation is aborted (Break()), the v: "OFF"
matches all the time.
HTH
Mine is still very much a work in progress, but it’s getting there. I’m on year 2 now.
The temperatures of course, are “base” temperatures, which will end up being different depending on what is added to or subtracted from them after all the conditions are evaluated. For example the whole if it is below -9 outside thing, adds to the temperature multiple times, because of course if it is below -9.9, it is also below -4.9 and below 0.1 and below 5.1 and below 10.1 and below 14.1
OK, but when the switch is turned off, doesn’t the break() then mean the temperature rule that next gets evaluated is: v: OFF
?