diff --git a/assets/ha/report_outdoor_temp_to_controller_from_weather.yaml b/assets/ha/report_outdoor_temp_to_controller_from_weather.yaml new file mode 100644 index 0000000..424d58b --- /dev/null +++ b/assets/ha/report_outdoor_temp_to_controller_from_weather.yaml @@ -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 \ No newline at end of file diff --git a/assets/ha/report_temp_to_controller.yaml b/assets/ha/report_temp_to_controller.yaml new file mode 100644 index 0000000..729d17f --- /dev/null +++ b/assets/ha/report_temp_to_controller.yaml @@ -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 \ No newline at end of file diff --git a/assets/ha/set_boiler_indoor_temp.yaml b/assets/ha/set_boiler_indoor_temp.yaml deleted file mode 100644 index 3ffc2fa..0000000 --- a/assets/ha/set_boiler_indoor_temp.yaml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/assets/ha/set_boiler_outdoor_temp.yaml b/assets/ha/set_boiler_outdoor_temp.yaml deleted file mode 100644 index cb1b581..0000000 --- a/assets/ha/set_boiler_outdoor_temp.yaml +++ /dev/null @@ -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 \ No newline at end of file