Have input numbers for day/night temps.
Let’s say
Room A day
Room A Night
B
C
And they have a corresponding A,B,C TRV’s
Currently i have 2 rules for day and night where every TRV is being set. Wonder if this can be simplified in any way
Have input numbers for day/night temps.
Let’s say
Room A day
Room A Night
B
C
And they have a corresponding A,B,C TRV’s
Currently i have 2 rules for day and night where every TRV is being set. Wonder if this can be simplified in any way
Can you share your ‘rules’? That would make it a lot easier to provide specific input.
If there’s a constant difference between rooms A, B and C or between day and night, you could automatically set temperatures bsaed on that difference, driven by a ‘reference’ temperature. In other words: have 1 input changed by the user and automate the temperature this should translate to in each room. Or choose to set a fixed temperature in all rooms for the night.
It’s individual and there are no patterns at all. As an example
- conditions:
- condition: trigger
id: trv night temp
sequence:
- service: climate.set_temperature
entity_id: climate.A_trv
data_template:
temperature: '{{ states.input_number.trv_1_A_night.state | int }}'
- service: climate.set_temperature
entity_id: climate.trv_1_B
data_template:
temperature: '{{ states("input_number.trv_1_B_night") | int}}'
- service: climate.set_temperature
entity_id: climate.trv_1_C
data_template:
temperature: '{{ states.input_number.trv_1_C_night.state | int }}'
You could use Repeat for Each, but it would be easier if your entity IDs used a consistent naming scheme.
You just nailed it. Will change the naming scheme
Renamed all the entities so they match each other. Got the code below. Have already tried all i can.
I believe the error is in the jinja script.
As i have input_number.{{repeat.item}}_day which corresponds for example to
input_number.guestroom_trv_day
Error while executing automation automation.trv_day_night: Error rendering data template: ValueError: Template error: int got invalid input ‘unknown’ when rendering template ‘{{ states(“input_number.{{repeat.item}}_day”) | int}}’ but no default was specified
- id: 'trv_day_night'
alias: 'trv_day_night'
mode: single
trigger:
- platform: time
id: trv day temp
at: '08:50'
- platform: time
id: trv night temp
at: '23:05'
action:
- choose:
- conditions:
- condition: trigger
id: trv day temp
sequence:
repeat:
for_each:
- "kitchen_trv"
- "kitchen_tp"
- "guestroom_trv"
- "guestroom_tp"
- "koridor_trv"
- "koridor_tp"
- "spa_tp"
- "bedroom_trv"
- "kabinet_trv"
- "kids_trv"
- "hall_trv"
sequence:
- service: climate.set_temperature
target:
entity_id: "climate.{{repeat.item}}"
data:
temperature: '{{ states("input_number.{{repeat.item}}_day") | int}}'
Ok got it after some struggling around
sequence:
- service: climate.set_temperature
target:
entity_id: "climate.{{repeat.item}}"
data:
temperature: '{{ states("input_number."~ repeat.item + "_day") | int}}'