upd ha scripts

This commit is contained in:
Yurii
2023-11-28 12:45:49 +03:00
parent 7763ee9fa9
commit 9bc4c06cad
4 changed files with 64 additions and 47 deletions

View File

@@ -0,0 +1,32 @@
# Script for reporting outdoor temperature to the controller from home assistant weather integration
# Updated: 28.11.2023
alias: Report outdoor temp to controller from weather
description: ""
variables:
# The source weather from which we take the temperature
source_entity: "weather.home"
# Target entity number where we set the temperature
# If the prefix has not changed, then you do not need to change it
target_entity: "number.opentherm_outdoor_temp"
trigger:
- platform: state
entity_id: "{{ source_entity }}"
attribute: temperature
- platform: time_pattern
seconds: /30
condition:
- condition: template
value_template: "{{ has_value(source_entity) and has_value(target_entity) }}"
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 }}"
mode: single

View File

@@ -0,0 +1,32 @@
# Script for reporting indoor/outdoor temperature to the controller from any home assistant sensor
# Updated: 28.11.2023
alias: Report temp to controller
description: ""
variables:
# The source sensor from which we take the temperature
source_entity: "sensor.livingroom_temperature"
# Target entity number where we set the temperature
# To report indoor temperature: number.opentherm_indoor_temp
# To report outdoor temperature: number.opentherm_outdoor_temp
target_entity: "number.opentherm_indoor_temp"
trigger:
- platform: state
entity_id: "{{ source_entity }}"
- platform: time_pattern
seconds: /30
condition:
- condition: template
value_template: "{{ has_value(source_entity) and has_value(target_entity) }}"
action:
- if:
- condition: template
value_template: "{{ (states(source_entity)|float(0) - states(target_entity)|float(0)) | abs | round(2) >= 0.01 }}"
then:
- service: number.set_value
data:
value: "{{ states(source_entity)|float(0)|round(2) }}"
target:
entity_id: "{{ target_entity }}"
mode: single

View File

@@ -1,22 +0,0 @@
alias: Set boiler indoor temp
description: ""
trigger:
- platform: state
entity_id:
- sensor.livingroom_temperature
- platform: time_pattern
seconds: /30
condition:
- condition: template
value_template: "{{ states('sensor.livingroom_temperature') not in ['unavailable', '0'] }}"
action:
- if:
- condition: template
value_template: "{{ has_value('number.opentherm_indoor_temp') and (states('sensor.livingroom_temperature')|float(0) - states('number.opentherm_indoor_temp')|float(0)) | abs | round(2) >= 0.01 }}"
then:
- service: number.set_value
data:
value: "{{ states('sensor.livingroom_temperature')|float(0)|round(2) }}"
target:
entity_id: number.opentherm_indoor_temp
mode: single

View File

@@ -1,25 +0,0 @@
alias: Set boiler outdoor temp
description: ""
trigger:
- platform: state
entity_id:
- weather.home
attribute: temperature
for:
hours: 0
minutes: 1
seconds: 0
- platform: time_pattern
seconds: /30
condition: []
action:
- if:
- condition: template
value_template: "{{ has_value('weather.home') and (state_attr('weather.home', 'temperature')|float(0) - states('number.opentherm_outdoor_temp')|float(0)) | abs | round(2) >= 0.1 }}"
then:
- service: number.set_value
data:
value: "{{ state_attr('weather.home', 'temperature')|float(0)|round(2) }}"
target:
entity_id: number.opentherm_outdoor_temp
mode: single