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 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