I currently have HA running my heating schedule using a basic automation. The automation as it stands, activates between certain times using the before / after conditions, and through this period, it sets the climate based on a slider value, which represents that period of the day.
I have automations for morning heating, evening heating, and ‘beween’ heating, each of which has its temperature slider. the automation for each is an iteration of the automation below,
when i try this, i get all sorts of Jinja errors, which im not to certain on how to correct.
Invalid config for [automation]: extra keys not allowed @ data[‘condition’][0][‘after’]. Got None not a valid value for dictionary value @ data[‘condition’][0][‘condition’]. Got None required key not provided @ data[‘condition’][0][‘entity_id’].
I’ve managed to ‘fudge’ my way around this, it may not be pretty, but it works.
I have automations which check an input_number slider, and if there are any changes to the slider, while the automation is in zone, it changes the target temperature in climate.
My hope was to have a input_select to adjust the on off time, which now I know cant work.
My resolution was to create a further set of automations, which activate on the time set by the input_select, and switch on / off the other automations which are looking at the temperature sliders.
automation to check slider
- alias: Weekday Morning Heating
id: weekdaymornHeat
trigger:
- platform: time
seconds: '/10'
condition:
- condition: state
entity_id: binary_sensor.workday_today
state: 'on'
- condition: state
entity_id: input_boolean.vacation_mode
state: 'off'
- condition: state
entity_id: input_boolean.school_holidays
state: 'off'
action:
- service: climate.set_temperature
data_template:
entity_id: climate.lounge
temperature: '{{ states.input_number.morning_temp.state | float }}'
- alias: WDmornOn_WDbt3Off
trigger:
platform: time
#as all timings are in 15 minute blocks, triggering the check every 15th minute will suffice
minutes: '/15'
# this will report true if time in input_select (in format HH:MM ) is equal to actual time
condition:
- condition: template
value_template: '{{states.sensor.time.state == states.input_select.weekday_morn_on.state}}'
action:
#our action should be to enable the next automation, and disable the previous automation
- service: automation.turn_on
entity_id: automation.weekday_morning_heating
- service: automation.turn_off
entity_id: automation.weekday_between_heating3
Unfortunately my skill set is limited, and im still attempting to self teach all of this. I’m not too well versed at all in template conditions. I’ll keep plodding through.
I have tried multiple attempts using templates under the time function, including what you are suggesting now, but i don’t believe they work at all, hence the fact i am now trying to use templating as a condition. Thanks for the tips though.
not sure I follow you. I mean, the template should check itself every minute itself due to the sensor. time in your template. But mayby I misunderstood what you need to achieve, or maybe the template doesn’t do as I think it should
I was thinking kind of like this for alarm clock, just with your template instead:
automation:
- alias: 'Hue light on gradually with alarm'
hide_entity: False
trigger:
platform: template
value_template: '{{ states.sensor.time.state == states.sensor.alarm_clock_time_long.state }}'
condition:
condition: state
entity_id: input_boolean.alarm_clock_status
state: 'on'
action:
service: script.wake_up
But maybe it will not work as I think, or updates once a minute is too slow for what you want to achieve.