I’m running Schedy (0.8.3) under Appdaemon 4 (0.7.0). It’s been running fine and essentially unchanged for a couple of years to control my central heating setpoints. The relevant bits of the config are:
schedy_heating: # This is our app instance name.
module: hass_apps_loader
class: SchedyApp
debug: true
reset_at_startup: false
actor_type: thermostat
expression_environment: |
def home_tomorrow():
return state("input_boolean.home_tomorrow")
def house_mode():
return state("input_select.house_mode")
def house_vacant():
return state("input_boolean.house_vacant")
def season():
return state('input_select.season')
def gareth_location():
return (state('device_tracker.ghip7plus'))
def varina_location():
return (state('device_tracker.varinas_iphone'))
def setback_disable():
return (state('inout_boolean.setback_disable'))
def simulate_bedtime():
return (state('input_boolean.simulate_bedtime'))
schedule_snippets:
watched_entities:
- input_boolean.home_tomorrow
- input_boolean.house_vacant
- input_boolean.setback_disable
- input_boolean.simulate_bedtime
- input_select.house_mode
- input_select.season
- device_tracker.ghip7plus
- device_tracker.varinas_iphone
schedule_prepend:
- x: "10 if house_mode() == 'Away' else Next()"
- x: "10 if season() == 'Summer' else Next()"
- x: "15 if gareth_location() == 'not_home' and varina_location() == 'not_home' and setback_disable() == 'off' else Next()"
# default rule to apply if no other matches
schedule_append:
- v: 15
rooms:
livingroom:
rescheduling_delay: 0
replicate_changes: true
actors:
climate.livingroom_thermostat:
schedule:
- x: "15 if simulate_bedtime() == 'on' else Next()"
- v: 20
rules:
- weekdays: 1-5
rules:
- rules:
- x: "Next() if season() == 'Spring' else Break()"
- {v: 15, start: "23:00", end: "17:00+1d" }
- { start: "17:00", end: "23:00" }
- x: "Next() if house_mode() == 'Home - Normal Day' else Break()"
- { start: "07:00", end: "09:00" }
- { start: "17:00", end: "19:00" }
- rules:
- x: "Next() if house_mode() == 'Home - Home Day' else Break()"
- { start: "07:00", end: "09:00" }
- { v: 19, start: "09:00", end: "17:00" }
- { start: "17:00", end: "22:30" }
- weekdays: 6-7
rules:
- { start: "07:00", end: "09:00" }
- { v: 19, start: "09:00", end: "17:00" }
- { start: "17:00", end: "22:30" }
I’ve just switched input_select.season
from “Summer” to “Winter”. The livingroom setpoint should now be 19 as it’s mid-morning on Saturday (Day 6) and “Winter”. For some reason, it’s been set to 15. The log extract is as follows:
Initializing room (name='livingroom').
[A:climate.livingroom_thermostat] Initializing actor (entity_id='climate.livingroom_thermostat', type='thermostat').
[A:climate.livingroom_thermostat] Fetching initial state.
[A:climate.livingroom_thermostat] Attribute 'state' is 'heat'.
[A:climate.livingroom_thermostat] Attribute 'temperature' is 15.0.
[A:climate.livingroom_thermostat] Attribute 'current_temperature' is 19.5.
[A:climate.livingroom_thermostat] Received value of 15.0��.
[A:climate.livingroom_thermostat] Listening for state changes.
Registering scheduling timers at: [00:00:00, 07:00:00, 09:00:00, 17:00:00, 19:00:00, 22:30:00, 23:00:00]
Loading state of 'schedy_room.schedy_heating_livingroom' from Home Assistant.
= {'entity_id': 'schedy_room.schedy_heating_livingroom', 'state': '15.0', 'attributes': {'actor_wanted_values': {'climate.livingroom_thermostat': '15.0'}, 'scheduled_value': '15.0', 'rescheduling_time': None, 'overlay_active': False}, 'last_changed': '2021-10-22T21:30:00.369292+00:00', 'last_updated': '2021-10-22T21:30:00.369292+00:00', 'context': {'id': '3a08dd76a905f123427cda7d50093c63', 'parent_id': None, 'user_id': 'f3e0339fb7ea40408ba899bd17ac8c78'}}
Evaluating room's schedule (reset=False, force_resend=False).
Assuming it to be 2021-10-23 11:42:23.654626.
������ [SUB] <<Schedule 'livingroom'>/1:<Rule with sub <Schedule 'prepend'>>>
������ [ACT] <<Schedule 'livingroom'>/1/1:<Rule x="10 if house_mode() == 'Away' else Next()">>
Initializing expression helper: BasicHelper, order = 0
Initializing expression helper: PatternHelper, order = 0
Initializing expression helper: ScheduleHelper, order = 0
Initializing expression helper: StateHelper, order = 0
Initializing expression helper: ThermostatExpressionHelper, order = 0
Initializing expression helper: CustomEnvironmentHelper, order = 1000
Executing the expression_environment script.
������ => Next()
������ [ACT] <<Schedule 'livingroom'>/1/2:<Rule x="10 if season() == 'Summer' else Next()">>
������ => Next()
������ [ACT] <<Schedule 'livingroom'>/1/3:<Rule x="15 if gareth_location() == 'not_home' an"...>>
������ => Next()
������ [SUB] <<Schedule 'livingroom'>/2:<Rule with sub <Schedule 'room-individual'>>>
������ [ACT] <<Schedule 'livingroom'>/2/1:<Rule x="15 if simulate_bedtime() == 'on' else Ne"...>>
������ => Next()
������ [SUB] <<Schedule 'livingroom'>/2/2:<Rule with sub <Schedule of 2 rules>, v=20>>
������ [SUB] <<Schedule 'livingroom'>/2/2/1:<Rule with sub <Schedule of 2 rules>, weekdays={1-5}>>
������ [SUB] <<Schedule 'livingroom'>/2/2/1/1:<Rule with sub <Schedule of 6 rules>>>
������ [INA] <<Schedule 'livingroom'>/2/2/1/1/1:<Rule x="Next() if season() == 'Spring' else Break()">>
������ [ACT] <<Schedule 'livingroom'>/2/2/1/1/2:<Rule from 23:00 to 17:00+1d, v=15>>
������ => 15
Final result: 15.0��, markers: set()
I know the logic is a bit convoluted, but it, has been, working. Before I refactor it all, can anybody understand why it should appear that Schedy thinks it’s ‘Spring’ and also thinks the day is between 1-5, rather than 6?