@MechToni wrote:
Dear Community,
after a few weeks working with this thrilling operating system I am almost pleased with my window detection. I use a schedule of three different basic operating temperatures but want to have individual temperatures controlled by presence or manual action. So I think it makes sense to let a window detection work like this. It might not be very elegant. But not yet I have integrated the usage of variables and I am not firm in jinja2. It was a lot of intensive work though. There is a minimal issue, I can’t explain yet. So would please somebody have a look at my automation to help me?
This automation should do the following:
When I open a window in a specific room the current target temperature value of the specific climate is temporarily written into a specific input number. Each room needs one. The new target temperature is set to an individual low (energy saving) temperature of another input_number. When I close the window again the memorized input number is set back as new target temperature again.What the automation does:
When I open a window it actually writes the current target temperature in the correct input number and sets the new individual low temperature. But when I close the window again, it will always pick the first input number of the template, here ‘input_number.schlafzimmer_temp_soll’.The template syntax:
{% if 'trigger.to_state.object_id', 'binary_sensor.schlafzimmer_fenster_kontakt' %} {{ state_attr('climate.schlafzimmer', 'temperature') }}
is working absolutely correct in the first part of the automation.
So I believe it makes a difference if I use a data template for a value > or a temperature > but I can’t make a sense of it.
Thanks a lot for any help!
Best,
Torsten- alias: 'fenster_offen_input_number.set_value' trigger: platform: state from: 'off' to: 'on' entity_id: - binary_sensor.schlafzimmer_fenster_kontakt - binary_sensor.wohnzimmer_fenster_kontakt - binary_sensor.kinderzimmer_fenster_kontakt - binary_sensor.bad_fenster_kontakt action: service: input_number.set_value data_template: entity_id: > {% set raum = trigger.to_state.object_id.split('_')[0] %} input_number.{{raum}}_temp_soll value: > {% if 'trigger.to_state.object_id', 'binary_sensor.schlafzimmer_fenster_kontakt' %} {{ state_attr('climate.schlafzimmer', 'temperature') }} {% elif 'trigger.to_state.object_id', 'binary_sensor.wohnzimmer_fenster_kontakt' %} {{ state_attr('climate.wohnzimmer', 'temperature') }} {% elif 'trigger.to_state.object_id', 'binary_sensor.kinderzimmer_fenster_kontakt' %} {{ state_attr('climate.kinderzimmer', 'temperature') }} {% elif 'trigger.to_state.object_id', 'binary_sensor.bad_fenster_kontakt' %} {{ state_attr('climate.bad', 'temperature') }} {% endif %} - alias: 'fenster_offen_climate.set_temperature' trigger: platform: state from: 'off' to: 'on' entity_id: - binary_sensor.schlafzimmer_fenster_kontakt - binary_sensor.wohnzimmer_fenster_kontakt - binary_sensor.kinderzimmer_fenster_kontakt - binary_sensor.bad_fenster_kontakt action: service: climate.set_temperature data_template: entity_id: > {% set raum = trigger.to_state.object_id.split('_')[0] %} climate.{{raum}} temperature: > {{ states("input_number.temp_fenster_offen") }} - alias: 'fenster_geschlossen_climate.set_temperature' trigger: platform: state from: 'on' to: 'off' entity_id: - binary_sensor.schlafzimmer_fenster_kontakt - binary_sensor.wohnzimmer_fenster_kontakt - binary_sensor.kinderzimmer_fenster_kontakt - binary_sensor.bad_fenster_kontakt action: service: climate.set_temperature data_template: entity_id: > {% set raum = trigger.to_state.object_id.split('_')[0] %} climate.{{raum}} temperature: > {% if 'trigger.to_state.object_id', 'binary_sensor.schlafzimmer_fenster_kontakt' %} {{ states('input_number.schlafzimmer_temp_soll') }} {% elif 'trigger.to_state.object_id', 'binary_sensor.wohnzimmer_fenster_kontakt' %} {{ states('input_number.wohnzimmer_temp_soll') }} {% elif 'trigger.to_state.object_id', 'binary_sensor.kinderzimmer_fenster_kontakt' %} {{ states('input_number.kinderzimmer_temp_soll') }} {% elif 'trigger.to_state.object_id', 'binary_sensor.bad_fenster_kontakt' %} {{ states('input_number.bad_temp_soll') }} {% endif %}
Posts: 3
Participants: 2