New Shelly TRV BLU integration

There is an external temperature number entity if you configured the device via Shellies Discovery.
If you configured the device manually you can use TRV.SetExternalTemperature method Shelly BLU TRV (Thermostatic Radiator Valve) | Shelly Technical Documentation

Hi @Bieniu

I am using the shelly discovery script (latest version). I had previously added 2 new BLU TRV to home assistant, which work fine. I have now added a third TRV to the gateway and running both the announce and discovery automations, does not pull in the new device?

Any ideas as to why this might be happening?

Thanks.

Thanks for your Reply Bieniu.
I didnt use your shellies discovery script (do you mean this?: GitHub - bieniu/ha-shellies-discovery-gen2: Script that adds MQTT discovery support for Shellies Gen2 devices).

i just added the script from vlad.barjovanu to the BLU Gateway. and added the mqtt devices manually:

- climate:
name: "ShellyTRV.office"
unique_id: "1234567890ab"
current_temperature_topic: "shellyblugwg3-e1b234567ac8/status/bthomesensor:203"
current_temperature_template: "{{ value_json.value }}"
max_temp: 30
min_temp: 4
temp_step: 0.1
temperature_state_topic: "shellyblugwg3-e1b234567ac8/status/bthomesensor:202"
temperature_state_template: "{{ value_json.value }}"
temperature_command_template: "{{ {'id': 0, 'src': 'homeassistant', 'method': 'BluTRV.Call', 'params': {'id': 200, 'method': 'TRV.SetTarget', 'params': {'id': 0, 'target_C': value | round(1)}}} | to_json }}"
temperature_command_topic: "shellyblugwg3-e1b234567ac8/rpc"
action_topic: "shellyblugwg3-e1b234567ac8/remotestatus/blutrv:200/trv"
action_template: "{% if value_json.pos > 0 %}heating{% else %}idle{% endif %}"
mode_state_topic: "shellyblugwg3-e1b234567ac8/status/bthomesensor:202"
mode_state_template: "{{ 'off' if value_json.value == 4 else 'heat' }}"
modes: ["heat", "off"]
mode_command_topic: "shellyblugwg3-e1b234567ac8/rpc"
mode_command_template: "{% set target = 4 if value == 'off' else 21 %}{{ {'id': 0, 'src': 'homeassistant', 'method': 'BluTRV.Call', 'params': {'id': 200, 'method': 'TRV.SetTarget', 'params': {'id': 0, 'target_C': target}}} | to_json }}"
availability:
  - topic: "shellyblugwg3-e1b234567ac8/status/blutrv:200"
    value_template: "{%if value_json.rpc%}online{%else%}offline{%endif%}"
device:
  connections:
    - - bluetooth
      - 12:34:56:78:90:ab
  name: Shelly BLU TRV
  model: Shelly BLU TRV
  model_id: SBTR-EU90AB
  manufacturer: Allterco Robotics

I’m not sure if i have to add TRV.SetExternalTemperature to the script running on the gateway. Or can i just use something like that in my configuration.yaml?

mqtt:
  - number:
      command_topic: "ShellyBLUGateway/rpc"
      command_template: "{{ {'id': 0, 'src': 'homeassistant', 'method': 'BluTRV.Call', 'params': {'id': 200, 'method': 'TRV.SetExternalTemperature ', 'params': {'id': 0, 't_C': value | round(1)}}} | to_json }}"

This is possibly not correct, i didn’t test this yet! (do i for example need the round(1)?)

I just have these 3 TRV BLU devices and didn’t want to add the python_script component for your discovery script…
but maybe thats the way to go… ^^

Yes, you can use a number entity. The configuration looks like this for Shellies Discovery:

qos: 0
icon: mdi:thermometer-check
min: -50
device:
  via_device: gateway_mac
  model: Shelly BLU TRV
  identifiers:
    - blu_trv_mac
  manufacturer: Allterco Robotics
  connections:
    - - bluetooth
      - blu_trv_mac
  name: Shelly BLU TRV
  model_id: SBTR-001AEU
max: 50
unit_of_measurement: °C
enabled_by_default: 'true'
availability:
  - topic: shellies-gen3/shelly-blu-gateway-grn3/online
    payload_available: 'true'
    payload_not_available: 'false'
  - value_template: '{%if value_json.mqtt.connected%}online{%else%}offline{%endif%}'
    topic: shellies-gen3/shelly-blu-gateway-gen3/status/rpc
mode: box
step: 0.1
command_topic: shellies-gen3/shelly-blu-gateway-gen3/rpc
unique_id: shellyblugwg3-gateway_mac-blu_trv_mac-external_temperature
name: External temperature
command_template: >-
  {{{"id":1,"src":"home-assistant","method":"BluTRV.Call","params":{"id":200,"method":"TRV.SetExternalTemperature","params":{"id":0,"t_C":value}}}|to_json}}
entity_category: config

I switched to using the MQTT YAML config rather than the Shelly discovery as I have more than 2 TRVs.

I need to add a state to the thermostat so that when the value is open beyond 10%, the thermostat states “heating” and when it’s below 10%, it goes back to the “idle” setting.

I am sure this is possible but cannot find anywhere in the documentation to support.

Thanks.

Thank you very much… seems to work like a charm! :slight_smile:

Has anybody implemented a way to switch between different set of schedules for TRV Blu like they are available on old TRV? There, it was possible to define different schedules for when you are at home or away. TRV Blu only allow to implement different target temperatures on a cron schedule. It would be great to recover the original feature.

I can’t integrate the TRV BLU into Home Assistant using either ZHA Zigbee or MQTT. With zigbee zha integration, the TRV is only found briefly and then remains as found in ZHA without being integrated. I get these error messages in HomeAssistant via MQTT

With this configuartion.yaml entry (for testing directly in the HA configuration.yaml)

mqtt:
  - climate:
    name: "STUDIO TRV"
    unique_id: "shellyblutrv-f844771eec2b"
    current_temperature_topic: "studio-shellyblugwg3-8cbfeaa699a8/status/bthomesensor:203"
    current_temperature_template: "{{ value_json.value }}"
    max_temp: 29
    min_temp: 4
    temp_step: 0.5
    temperature_state_topic: "studio-shellyblugwg3-8cbfeaa699a8/status/bthomesensor:202"
    temperature_state_template: "{{ value_json.value }}"
    temperature_command_template: "{{ {'id': 0, 'src': 'homeassistant', 'method': 'BluTRV.Call', 'params': {'id': 200, 'method': 'TRV.SetTarget', 'params': {'id': 0, 'target_C': value | round(1)}}} | to_json }}"
    temperature_command_topic: "studio-shellyblugwg3-8cbfeaa699a8/rpc"
    action_topic: "studio-shellyblugwg3-8cbfeaa699a8/status/blutrv:200/rpc"
    action_template: "{% if value_json.result.pos | int > 0 %}heating{% else %}idle{% endif %}"
    mode_state_topic: "studio-shellyblugwg3-8cbfeaa699a8/status/bthomesensor:202"
    mode_state_template: "{{ 'off' if value_json.value == 4 else 'heat' }}"
    modes: ["heat", "off"]
    mode_command_topic: "studio-shellyblugwg3-8cbfeaa699a8/rpc"
    mode_command_template: "{% set target = 4 if value == 'off' else 21 %}{{ {'id': 0, 'src': 'homeassistant', 'method': 'BluTRV.Call', 'params': {'id': 200, 'method': 'TRV.SetTarget', 'params': {'id': 0, 'target_C': target}}} | to_json }}"
    availability:
      - topic: "studio-shellyblugwg3-8cbfeaa699a8/status/blutrv:200"
        value_template: "{%if value_json.rpc%}online{%else%}offline{%endif%}"
    device:
      connections:
        - - bluetooth
          - 8c:bf:ea:a6:99:aa
      name: studio-shellyblugwg3-8cbfeaa699a8
      model: Shelly BLU TRV
      model_id: SBTR-EU867E
      manufacturer: Allterco Robotics

Looks like indention problem, did you read this? MQTT HVAC - Home Assistant

Yes i have read this. But I don’t know what exactly I need to find the Shelly BLU TRV.
The above code for “mqtt” does not work.

Oke, After Day’s of struggling and sometimes with some improvements. i give up :smile: the case is: the MQTT connection from myBLUGW is up. as you can see in the screenshot below. but in HA (left side) the response of the devices stay’s ‘not availible’

The ID of my blutrv is correct
THe ID of my BLUgateway have i copied from the bottom left of the webinterface (and hover text say’s ID) but i cannot find out why in HA i do not get the device running. the only thing i can think of is, that i have one other MQTT device that MQTT did find on its own and is NOT in the configuration.yaml. but this device also a HAVC (Airconditioning) is working. Please someone any idea’s

mqtt:
- climate:
    name: "Blutrv"
    unique_id: "f8:44:77:2a:f9:32"
    current_temperature_topic: "shellyblugwg3-34cdb078aec4/status/bthomesensor:203"
    current_temperature_template: "{{ value_json.value }}"
    max_temp: 30
    min_temp: 4
    temp_step: 0.1
    temperature_state_topic: "shellyblugwg3-34cdb078aec4/status/bthomesensor:202"
    temperature_state_template: "{{ value_json.value }}"
    temperature_command_template: "{{ {'id': 0, 'src': 'homeassistant', 'method': 'BluTRV.Call', 'params': {'id': 200, 'method': 'TRV.SetTarget', 'params': {'id': 0, 'target_C': value | round(1)}}} | to_json }}"
    temperature_command_topic: "shellyblugwg3-34cdb078aec4/rpc"
    mode_state_topic: "shellyblugwg3-34cdb078aec4/status/bthomesensor:202"
    mode_state_template: "heat"
    modes: ["heat"]
    availability:
      - topic: "shellyblugwg3-34cdb078aec4/status/blutrv:200"
        value_template: "{%if value_json.rpc%}online{%else%}offline{%endif%}"
    device:
      connections:
        - - bluetooth
          - f8:44:77:2a:f9:32
      name: Blutrv
      model: Blutrv
      model_id: SBTR-EU867E
      manufacturer: Allterco Robotics

What the earlier reply was is that the ‘TAB’s’ or something like that are not correct.
Your code is not formated in the right way HA wants to. i also had this issue and this is an HA logic and not an BluTRV issue.

Topics are different

But how dit i manage to change the topic in the webinterface of the BLUGW?
or in other words is the sollution to change the YAML with replacing the ID

"shellyblugwg3-34cdb078aec4/ to “blutrv”

MQTT Prefix field.

Yes, you can use such topic in the YAML configuration.

1 Like

YOU ARE THE GREATEST!!! :slight_smile:

1 Like

Great work from @Bieniu! But i gave up and send them back to Shelly.
Its weird that normal support takes so long while all other devices work fine with the shelly intergration.

I bought 6 Sonoff TRV’s for half the money and they work flawless since i installed them. Just something to think about if you might consider buying smart valves.

New configuration with HVAC action support (firmware 20250109-090619/1.5.0-beta1-g16e0ef4 for BLU Gateway required)

mqtt:
  - climate:
      name: "Shelly BLU TRV Thermostat"
      unique_id: "112233445566"
      current_temperature_topic: "shellyblugwg3-aabbccddeeff/status/blutrv:200"
      current_temperature_template: "{{value_json.current_C}}"
      max_temp: 30
      min_temp: 4
      temp_step: 0.1
      temperature_state_topic: "shellyblugwg3-aabbccddeeff/status/blutrv:200"
      temperature_state_template: "{{value_json.target_C}}"
      temperature_command_template: "{{ {'id': 0, 'src': 'homeassistant', 'method': 'BluTRV.Call', 'params': {'id': 200, 'method': 'TRV.SetTarget', 'params': {'id': 0, 'target_C': value | round(1)}}} | to_json }}"
      temperature_command_topic: "shellyblugwg3-aabbccddeeff/rpc"
      mode_state_topic: "shellyblugwg3-aabbccddeeff/status/blutrv:200"
      mode_state_template: "heat"
      modes: ["heat"]
     action_topic: "shellyblugwg3-aabbccddeeff/status/blutrv:200"
     action_template: "{% if value_json.pos > 0 %}heating{% else %}idle{% endif %}"
      availability:
        - topic: "shellyblugwg3-aabbccddeeff/status/blutrv:200"
          value_template: "{% if value_json.rpc %}online{% else %}offline{% endif %}"
      device:
        connections:
          - - bluetooth
            - 11:22:33:44:55:66
        name: Shelly BLU TRV
        model: Shelly BLU TRV
        model_id: SBTR-EU867E
        manufacturer: Allterco Robotics

112233445566 - BLU TRV ID
aabbccddeeff - BLU Gateway ID
200 - BLU TRV ID from BLU Gateway webpanel

Hi, do we need the BLU gateway at all? I have a shellyplus1pm and interface is practically the same with the same functionality and running faster than the gateway.
Has anybody tried to integrate the TRV via Gen2/3 switch?

One more thing - where is the option to enable the zigbee radio? I tried the latest beta but can’t see such option.