Product Guides

How to Set Up SONOFF TRV With an External Sensor in Home Assistant

Introduction

A smart thermostatic radiator valve installed on a radiator can be affected by heat from the radiator, cold air near a window, and its installation position. As a result, the temperature measured by its built-in sensor may be higher than the actual room temperature.  

If a separate temperature sensor is already installed in the room, you can create an automation in Home Assistant to synchronize the temperature measured by the external sensor with the TRV. Whenever the external temperature sensor reports a new temperature, Home Assistant writes the latest value to the TRV, allowing the device to control the heating based on a more representative room temperature.

  • This tutorial uses the SONOFF TRV-ZBT as an example. The first-generation TRVZB can also be configured by following this tutorial.
  • The SONOFF SNZB-02DR2 is used as the external temperature sensor. Other sensors that can report temperature correctly in Home Assistant can be configured in the same way.   

Choose the ZHA or Zigbee2MQTT (Z2M) method below according to how your thermostatic radiator valve is connected.



Prerequisites

Before starting, make sure that:

  • The SONOFF TRV-ZBT has been successfully added to Home Assistant.
  • The external temperature sensor has been successfully added to Home Assistant and can report temperature correctly.
  • The TRV-ZBT and the external temperature sensor use the same temperature unit. Using degrees Celsius (°C) for both is recommended.
  • You have confirmed the entity ID of the external temperature sensor, for example: 

Integration method

Example external temperature sensor entity ID

ZHA

sensor.sonoff_snzb_02dr2_temperature

Zigbee2MQTT (Z2M)

sensor.0xd44867fffe0f8731_temperature


You can find the entity ID by going to:

    • Developer tools → States
    • Enter the external temperature sensor's device name in the search box, find the Temperature entity that represents the current temperature, and copy its complete entity ID. You will use this entity ID when configuring the automation trigger and YAML action.  

Entity IDs may vary depending on the integration method, device name, and user configuration. Please use the actual temperature entity ID shown under Developer tools → States.  



Step 1: Create an Automation

In Home Assistant, go to: Settings → Automations & scenes → Automations

  • Click Create automation in the bottom-right corner, then select Create new automation.
  • The recommended automation name is: Sync remote temperature to SONOFF TRV-ZBT.
  • You can also distinguish automations by room name, for example: Sync bedroom temperature to TRV-ZBT



Step 2: Configure the Trigger

In the When section, click Add trigger, then select State.

  • In Entity, enter or paste the external temperature sensor's temperature entity ID that you found earlier under Developer tools → States, then select the corresponding entity from the search results.
  • Leave Attribute, From, and To empty. This ensures that the automation is triggered whenever the external temperature sensor reports a new temperature value.

It is recommended to monitor changes to the temperature entity only. Do not select battery level, signal strength, or other attributes, as this may trigger unnecessary synchronisation actions.



Option 1: TRV Connected to Home Assistant via ZHA

Step 3: Enable the External Temperature Source

Open the TRV-ZBT device page and confirm that:

  • The external temperature sensor is enabled or selected as the external temperature source.
  • The external temperature sensor value entity is available on the page.

Step 4: Confirm the External Temperature Input Entity

  • On the TRV-ZBT device page in Home Assistant, confirm that the following Number entity is available for receiving the external temperature: External temperature sensor value
  • If several similarly named temperature entities appear on the device page, confirm the complete entity ID by going to: Developer tools → States.
  • Search for the TRV-ZBT device name and locate the corresponding Number entity. Its entity ID usually contains: external_temperature_sensor_value
    • For example: number.sonoff_trv_zbt_external_temperature_sensor_value
  • Copy the complete entity ID. In the next step, paste it into the entity search box under Target, then select the corresponding entity.

Tip: Always verify the complete entity ID to avoid accidentally selecting the TRV target temperature or local temperature entity.

Step 5: Add the Action for Writing the External Temperature

  • In the Then do section, click Add action, then search for and select: Number: Set
  • In some versions of Home Assistant, this action may appear as: Set number value
  • In the entity search box under Target, paste the TRV-ZBT external temperature input entity ID copied in the previous step, then select the matching entity from the search results. For example, the matching entity may be displayed as: External temperature sensor value

If multiple TRV-ZBT devices are installed, carefully check the device name and room location to avoid synchronizing the temperature with the wrong thermostatic valve.

  • Next, click the three-dot menu in the top-right corner of the action and select Edit in YAML.

Change the action content to:

action: number.set_value
target:
  entity_id: number.sonoff_trv_zbt_external_temperature_sensor_value
data:
  value: "{{ states('sensor.sonoff_snzb_02dr2_temperature') | float }}"

In this example:

  • sensor.sonoff_snzb_02dr2_temperature is the temperature entity ID of the external temperature sensor.
  • number.sonoff_trv_zbt_external_temperature_sensor_value is the external temperature value entity ID of the TRV-ZBT.

Tip: Replace these entity IDs with the actual IDs displayed in your Home Assistant instance. Do not copy the example IDs directly.



Option 2: TRV Connected to Home Assistant via Zigbee2MQTT (Z2M)

Step 3: Select the External Temperature Source

  • Open the TRV-ZBT device page in Home Assistant.
  • Find the Temperature sensor and set it to: external
    • The external means that the TRV will use the external temperature written to it for temperature control.
    • The external_2 and external_3 are other reserved external temperature source options. If you are configuring only one external temperature sensor, select external.

Step 4: Confirm the External Temperature Input Entity

  • In the TRV-ZBT device entities in Home Assistant, locate the Number entity used for writing the external temperature.
    • In some versions of Z2M and Home Assistant, this entity may be displayed simply as Temperature on the device page and may have the same displayed name as the TRV target temperature entity. This is normal.
  • Confirm its complete entity ID by going to: Developer tools → States.
  • Search for the TRV-ZBT device name or IEEE address, then locate the Number entity whose entity ID contains: external_temperature_input.
    • For example: number.0xa4c138a1e838ed59_external_temperature_input

Even if the entity is displayed as Temperature on the device page, it is the correct entity for receiving the external temperature as long as its complete entity ID contains 'external_temperature_input'.

Once confirmed, copy the complete entity ID. In the next step, paste it into the entity search box under Target, then select the corresponding entity.

Do not select an entity based only on its displayed name. Always confirm it using the complete entity ID.

Step 5: Add the Action for Writing the External Temperature

  • In the Then do section, click Add action, then search for and select: Number: Set, or Set number value
  • In the entity search box under Target, paste the TRV-ZBT external temperature input entity ID copied in the previous step, then select the corresponding entity from the search results.
  • Next, click the three-dot menu in the top-right corner of the action and select Edit in YAML.

  • Enter:

action: number.set_value
target:
  entity_id: number.0xa4c138a1e838ed59_external_temperature_input
data:
  value: "{{ states('sensor.0xd44867fffe0f8731_temperature') | float }}"

In this example:

  • The sensor.0xd44867fffe0f8731_temperature is the temperature entity ID of the external temperature sensor.
  • The number.0xa4c138a1e838ed59_external_temperature_input is the external temperature input entity ID of the TRV-ZBT.

Replace these entity IDs with the actual entity IDs displayed in your Home Assistant instance.

If you cannot find an entity containing external_temperature_input in Home Assistant, first check whether the External temperature item is exposed on the TRV-ZBT device page in Z2M. If it is not displayed, update Z2M and the device converter, then check again.



Final Step: Save and Enable the Automation

  • After completing the configuration, click Save to save the automation.
  • Return to the automation list and confirm that the switch next to the automation is turned on.
  • From this point onward, whenever the remote temperature sensor reports a new temperature, Home Assistant will automatically synchronize it with the TRV-ZBT.

 

 

Check Whether the Configuration Was Successful

Follow these steps to confirm that the automation is working correctly:

  1. Open the device page of the external temperature sensor and note its current temperature.
  2. Wait for the sensor to report a new temperature reading. To speed up the test, gently hold the sensor or temporarily move it to an area with a slightly different temperature to trigger a change in its reading.
  3. Open the TRV-ZBT device page.
  4. Confirm that TRV-ZBT has successfully synchronised and is using the external temperature:
    • Check whether the TRV-ZBT external temperature input value has been updated to match the current temperature reported by the external temperature sensor.
      • ZHA: Check External temperature sensor value. Its Number entity ID contains external_temperature_sensor_value.
      • Z2M: Check the Number entity whose entity ID contains external_temperature_input. This entity may be displayed as Temperature on the device page.
    • Confirm that the current temperature displayed by TRV-ZBT has also been updated to the external temperature value. You can check the Currently temperature shown on the thermostat card.

5. Return to the automation page and confirm that Last triggered displays a recent execution time.

You can also open the automation, click the three-dot menu in the top-right corner of the action, and select Run action to manually test whether the temperature can be successfully written to the TRV-ZBT.

 

Continuar lendo

SONOFF TRV Gen2 Smart Radiator Valve Guide: Installation, Features & FAQ

Deixar comentário

Os comentários precisam ser aprovados antes da publicação.

Este site é protegido por hCaptcha e a Política de privacidade e os Termos de serviço do hCaptcha se aplicam.