AutomationDataset/Evgen2/Evgen2_automations.yaml

51 lines
1.7 KiB
YAML

- alias: Report outdoor temp to SmartTerm from weather
description: Script for reporting outdoor temperature to the SmartTerm controller
from home assistant weather integration
trigger:
- platform: time_pattern
seconds: /30
condition:
- condition: template
value_template: '{{ states(source_entity) != ''unavailable'' and states(target_entity)
!= ''unavailable'' }}'
action:
- if:
- condition: template
value_template: '{{ (state_attr(source_entity, ''temperature'')|float(0) - states(target_entity)|float(0))
| abs | round(2) >= 0.1 }}'
then:
- service: number.set_value
data:
value: '{{ state_attr(source_entity, ''temperature'')|float(0)|round(2) }}'
target:
entity_id: '{{ target_entity }}'
variables:
source_entity: weather.forecast_home_assistant
target_entity: number.NAME_t_outdoor
mode: single
- alias: Report indoor temp to SmarTherm controller
description: Script for reporting indoor temperature to the SmartTerm controller
from home assistant temperature sensor
triggers:
- trigger: time_pattern
seconds: /10
conditions:
- condition: template
value_template: '{{ states(''source_entity'') != ''unavailable'' }}'
actions:
- if:
- condition: template
value_template: '{{ (states(source_entity)|float(0) - states(target_entity)|float(0))
| abs | round(2) >= 0.05 }}'
then:
- action: number.set_value
metadata: {}
data:
value: '{{ states(source_entity)|float(0)|round(2) }}'
target:
entity_id: '{{ target_entity }}'
variables:
source_entity: sensor.YOUR_SENSOR
target_entity: number.NAME_t_indoor
mode: single