Forked from pavax/z2m_aqara_trv_external_temperature.yaml
Created
February 7, 2024 18:50
-
-
Save sebastienserre/47cbbf783708c78d70cc8a5c1ae5ba03 to your computer and use it in GitHub Desktop.
z2m_aqara_trv_external_temperature.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Aqara TRV E1 external temperature | |
description: > | |
Configures the Aqara TRV to receive it's temperature from an external sensor. | |
Every time the temperature sensor value cahnges it's is send to the TRV. | |
domain: automation | |
source_url: "https://gist.github.com/pavax/8d6ed250765d89cb281d4a1762b8d2e8" | |
input: | |
external_temp_sensor: | |
name: External temperature sensor | |
description: This temperature sensor values will be synced to the TRV | |
selector: | |
entity: | |
filter: | |
domain: sensor | |
device_class: | |
- temperature | |
aqara_trv_device: | |
name: The Aqara TRV | |
description: The TRV that the temperature willl be set to | |
selector: | |
device: | |
multiple: false | |
z2m_instance_name: | |
name: "Z2M Instance Name (optional)" | |
description: "The Zigbee2Mqtt instance name (default: zigbee2mqtt)" | |
selector: | |
text: | |
default: "zigbee2mqtt" | |
z2m_topic_name: | |
name: "External temperature topic name (optional)" | |
description: > | |
The Z2M external temperature topic name for the Agara SRTS-A01. | |
Z2M version <= 1.35.1 need to use the value: sensor_temp. | |
Z2M version >= 1.35.2 need to use the value: external_temperature_input. | |
(default: external_temperature_input)" | |
selector: | |
text: | |
default: "external_temperature_input" | |
mode: single | |
max_exceeded: silent | |
variables: | |
aqara_trv_device: !input aqara_trv_device | |
external_temp_sensor: !input external_temp_sensor | |
z2m_instance_name: !input z2m_instance_name | |
z2m_topic_name: !input z2m_topic_name | |
trigger: | |
- platform: state | |
entity_id: !input external_temp_sensor | |
action: | |
- variables: | |
aqara_trv_device_name: "{{ device_attr(aqara_trv_device, 'name') }}" | |
aqara_trv_select_entity: >- | |
{% set device_entities = device_entities(aqara_trv_device) %} | |
{{ expand(states['select']) | |
| selectattr('entity_id','in', device_entities) | |
| selectattr('attributes.options', 'contains', 'external') | |
| map(attribute='entity_id') | |
| first | |
}} | |
- if: | |
- condition: template | |
value_template: "{{ not is_state(aqara_trv_select_entity, 'external')}}" | |
then: | |
- service: select.select_option | |
target: | |
entity_id: "{{aqara_trv_select_entity}}" | |
data: | |
option: external | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: 10 | |
milliseconds: 0 | |
- service: mqtt.publish | |
data: | |
topic: "{{z2m_instance_name}}/{{aqara_trv_device_name}}/set/{{z2m_topic_name}}" | |
payload_template: >- | |
{{ (states(external_temp_sensor)|float(0)|round(1)) }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment