Last active
February 12, 2026 20:38
-
-
Save markkvdb/ad3029aeb13d498dde115465821d9278 to your computer and use it in GitHub Desktop.
Syncs an external temperature sensor to a Sonoff TRVZB.
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: Sonoff TRVZB External Temp Sync (Fixed) | |
| description: > | |
| Syncs an external temperature sensor to a Sonoff TRVZB. | |
| This version fixes the 'UndefinedError' by mapping inputs to variables. | |
| domain: automation | |
| input: | |
| external_temp_sensor: | |
| name: External Temperature Sensor | |
| description: The sensor that provides the actual room temperature. | |
| selector: | |
| entity: | |
| domain: sensor | |
| device_class: temperature | |
| trv_external_temp_input: | |
| name: TRV External Temperature Input | |
| description: The 'number' entity of the Sonoff TRV (e.g., number.trv_external_temperature_input). | |
| selector: | |
| entity: | |
| domain: number | |
| trv_sensor_selector: | |
| name: TRV Temperature Sensor Select | |
| description: The 'select' entity of the Sonoff TRV (e.g., select.trv_temperature_sensor_select). | |
| selector: | |
| entity: | |
| domain: select | |
| # This section maps the inputs to variables so the templates can access them | |
| variables: | |
| temp_sensor_entity: !input external_temp_sensor | |
| mode: single | |
| trigger: | |
| - platform: state | |
| entity_id: !input external_temp_sensor | |
| - platform: time_pattern | |
| minutes: "/30" | |
| - platform: homeassistant | |
| event: start | |
| condition: | |
| # Verify the sensor is a valid number before proceeding | |
| - condition: template | |
| value_template: "{{ is_number(states(temp_sensor_entity)) }}" | |
| action: | |
| # 1. Force the TRV into 'external' mode | |
| - service: select.select_option | |
| target: | |
| entity_id: !input trv_sensor_selector | |
| data: | |
| option: "external" | |
| # 2. Send the temperature value to the TRV | |
| - service: number.set_value | |
| target: | |
| entity_id: !input trv_external_temp_input | |
| data: | |
| # We use the variable 'temp_sensor_entity' here instead of '!input' | |
| value: "{{ states(temp_sensor_entity) | float(0) }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment