Hi, I hope somebody can help me: I want to change the target temp on a Generic thermostat using an automation. I have an input number called input_number.heating_temperature and into my automation I have set:
I’m sorry to disturb again but templating syntax is difficult for me.
I’ve to set an input number at different values depending on hours. So I have that:
input_number.target
input_number.pt_6_22 = 2
input_number.pt_6_23 = 1
where 6 is the day of week and 22 (or 23) the hour of day.
If, in my automation, I set value of input_number.target using this template:
{{ states.input_number.pt_6_22.state | int }}
it takes the correct value but if I want to nest into this template hour and day variables I can’t find which is the correct teplate. I want somenthing like this:
{{ states.input_number.pt_{{ now().weekday() }}_{{ now().hour }}.state | int }}
I tried as well and I have the same behaviour (answer is “unknown”)
I do not see any solution sofar… You probably have to split this line by using “if… else… endif” to work around this double template cascade…
I have one input_boolean for every hour of every day (input_boolean_temp_pt_0_0 for sunday at 00:00, input_boolean_temp_pt_0_1 for sunday at 01:00, input_boolean_temp_pt_1_0 for monday at 00:00, and so on) to decide if use target temp 1 or target temp 2, but I think you can safely remove the “if” leaving only something like this:
id: ‘1577728788647’
alias: Cron Temperatura PT
description: ‘’
trigger:
I get the following error:
Invalid config for [automation]: must contain at least one of service, service_template. @ data[‘action’][0]. Got None. (See /config/configuration.yaml, line 10).
Are you editing the yaml file or into web interface? Maybe an indetation problem, your “action:”, “condition:” and “weekday:” lines seem to have too many spaces before “action:”, it should have only one space before like “trigger:”.
I’m not able to quote here the code with visible indentation but also entity_id, hvac_mode, temperature and maybe mode need 2 spaces more then data_template and service one only more.