adjust structure
This commit is contained in:
@@ -51,77 +51,77 @@ blueprint:
|
||||
- domain: sensor
|
||||
device_class: temperature
|
||||
|
||||
triggers:
|
||||
- trigger: state
|
||||
entity_id:
|
||||
- !input window_sensor
|
||||
from: "off"
|
||||
to: "on"
|
||||
for: !input window_delay_open
|
||||
id: FENSTER_OPEN
|
||||
- trigger: state
|
||||
entity_id:
|
||||
- !input window_sensor
|
||||
from: "on"
|
||||
to: "off"
|
||||
for: !input window_delay_close
|
||||
id: FENSTER_CLOSED
|
||||
- platform: time_pattern
|
||||
minutes: '29'
|
||||
id: SYNC_TEMPERATURE
|
||||
triggers:
|
||||
- trigger: state
|
||||
entity_id:
|
||||
- !input window_sensor
|
||||
from: "off"
|
||||
to: "on"
|
||||
for: !input window_delay_open
|
||||
id: FENSTER_OPEN
|
||||
- trigger: state
|
||||
entity_id:
|
||||
- !input window_sensor
|
||||
from: "on"
|
||||
to: "off"
|
||||
for: !input window_delay_close
|
||||
id: FENSTER_CLOSED
|
||||
- platform: time_pattern
|
||||
minutes: '29'
|
||||
id: SYNC_TEMPERATURE
|
||||
|
||||
variables:
|
||||
trv: !input radiator_entity
|
||||
remote_temperature_entity: >
|
||||
{% set entities = device_entities(device_id(trv)) %}
|
||||
{% set remote_temperature_entity_id = namespace(id='') %}
|
||||
{% for s in entities %}
|
||||
{% if 'remote_temperature' in s %}
|
||||
{% set remote_temperature_entity_id.id = s %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ remote_temperature_entity_id.id }}
|
||||
window_detection_entity: >
|
||||
{% set entities = device_entities(device_id(trv)) %}
|
||||
{% set window_detection_entity_id = namespace(id='') %}
|
||||
{% for s in entities %}
|
||||
{% if 'window_detection' in s %}
|
||||
{% set window_detection_entity_id.id = s %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ window_detection_entity_id.id }}
|
||||
current_temperature: !input temperature_sensor
|
||||
variables:
|
||||
trv: !input radiator_entity
|
||||
remote_temperature_entity: >
|
||||
{% set entities = device_entities(device_id(trv)) %}
|
||||
{% set remote_temperature_entity_id = namespace(id='') %}
|
||||
{% for s in entities %}
|
||||
{% if 'remote_temperature' in s %}
|
||||
{% set remote_temperature_entity_id.id = s %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ remote_temperature_entity_id.id }}
|
||||
window_detection_entity: >
|
||||
{% set entities = device_entities(device_id(trv)) %}
|
||||
{% set window_detection_entity_id = namespace(id='') %}
|
||||
{% for s in entities %}
|
||||
{% if 'window_detection' in s %}
|
||||
{% set window_detection_entity_id.id = s %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ window_detection_entity_id.id }}
|
||||
current_temperature: !input temperature_sensor
|
||||
|
||||
actions:
|
||||
- if:
|
||||
- condition: trigger
|
||||
id:
|
||||
- FENSTER_OPEN
|
||||
then:
|
||||
- service: switch.turn_on
|
||||
target:
|
||||
entity_id: "{{ window_detection_entity }}"
|
||||
alias: Setze Fenster auf offen
|
||||
- if:
|
||||
- condition: trigger
|
||||
id:
|
||||
- FENSTER_CLOSED
|
||||
then:
|
||||
- service: switch.turn_off
|
||||
target:
|
||||
entity_id: "{{ window_detection_entity }}"
|
||||
alias: Setze Fenster auf geschlossen
|
||||
# temperature sensor sync
|
||||
- if:
|
||||
- condition: trigger
|
||||
id:
|
||||
- FENSTER_OPEN
|
||||
- FENSTER_CLOSED
|
||||
- SYNC_TEMPERATURE
|
||||
then:
|
||||
- service: number.set_value
|
||||
data:
|
||||
value: "{{ states(current_temperature) | float }}"
|
||||
target:
|
||||
entity_id: "{{ remote_temperature_entity }}"
|
||||
alias: Sync remote temperature sensor
|
||||
actions:
|
||||
- if:
|
||||
- condition: trigger
|
||||
id:
|
||||
- FENSTER_OPEN
|
||||
then:
|
||||
- service: switch.turn_on
|
||||
target:
|
||||
entity_id: "{{ window_detection_entity }}"
|
||||
alias: Setze Fenster auf offen
|
||||
- if:
|
||||
- condition: trigger
|
||||
id:
|
||||
- FENSTER_CLOSED
|
||||
then:
|
||||
- service: switch.turn_off
|
||||
target:
|
||||
entity_id: "{{ window_detection_entity }}"
|
||||
alias: Setze Fenster auf geschlossen
|
||||
# temperature sensor sync
|
||||
- if:
|
||||
- condition: trigger
|
||||
id:
|
||||
- FENSTER_OPEN
|
||||
- FENSTER_CLOSED
|
||||
- SYNC_TEMPERATURE
|
||||
then:
|
||||
- service: number.set_value
|
||||
data:
|
||||
value: "{{ states(current_temperature) | float }}"
|
||||
target:
|
||||
entity_id: "{{ remote_temperature_entity }}"
|
||||
alias: Sync remote temperature sensor
|
||||
Reference in New Issue
Block a user