How can I send a temperature value via HTTP GET to a Shelly TRV radiator thermostat?

How can I “export” a temperature sensor value via HTTP GET from Home Assistant to a Shelly TRV radiator thermostat?

Hello,

I am thinking about buying a Shelly TRV radiator thermostat.

I watched this (german) video.

The host is using the Shelly TRV together with an external Shelly H&T temperature sensor but at 15:40 the host says that you can hook up any external temperature sensor via HTTP GET(?) to the Shelly TRV but this does not get explained any further.

**What I want looks like this. So to send the current temperature from my external temperature sensor to the Shelly TRV as http://192.168.0.165/ext_t?temp=measured t°C

I have an external temperature sensor via BTHome in Home Assistant which I want to “export” via HTTP GET.

Can anybody help me with this?

I googled for some hours and looked at RESTful Sensor - Home Assistant and HTTP - Home Assistant but to be honest I have no idea where to start and how to implement something like this.

Thank you for your help!

2 Likes

Can anyone help me with this?

I also have Shelly TRVs and will look into this over the weekend. Will let you know if I can figure it out.

Ok, so here it goes. It’s actually pretty easy. You need to edit your configuration.yaml and add:

rest_command:
    send_temp_to_shellytrv:
        url: 'http://SHELLYTRVURL/ext_t?temp={{ states("sensor.temperature") }}'

Change SHELLYTRVURL to your shelly’s local url and sensor.temperature to the sensor where you want to get your temperature from.

Make sure to restart home assistant in order to load the new rest service. Then you need to add an automation where you execute this rest command when the temperature changes:

alias: "Update ShellyTRV temp when temp changes"
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.temperature
condition: []
action:
  - service: rest_command.send_temp_to_shellytrv
    data: {}
mode: single
8 Likes

Thank you for your help!

1 Like

I have to thank also! :slight_smile:

One hint: I wrote send_temp_to_shellytrv-01 instead of send_temp_to_shellytrv_01 and got an error message while checking configuration.yaml (home assistant Invalid config for rest_command]: invalid slug Got OrderedDict). So don’t use “-” but “_” instead.

And one question: Do I have to enable " Enable external temperature corrections endpoint http://192.168.178.182/ext_t?temp=measured t° on the shelly webpage for that TRV?

Hi everybody :grinning:
For some reason, it doesnt work for me :thinking:

configuration.yaml

rest_command:
  send_temp_to_shellytrv_kueche:
    url: 'http://192.168.178.163//ext_t?temp={{ states("sensor.temperatur_kuche") }}'

automation: (triggeres every minute)

alias: Temperatur an ShellyTRV
description: Daten der externen Temperatursensoren an die TRVs senden
trigger:
  - platform: time_pattern
    minutes: /1
condition: []
action:
  - service: rest_command.send_temp_to_shellytrv_kueche
    data: {}
mode: single

In the Shelly Menu i have activated the checkbox with “Enable external temperature corrections endpoint http://192.168.178.163/ext_t?temp=measured t°

Can anybody see what im doing wrong?

I see that you use a double slash after the IP address.

I used the correct syntax, but I can not get home assistant to update the external temperature. The option is enabled on the TRV and I have tested that I can set it manually with a static temperature with the API.

I can’t figure out what I am doing wrong.

1 Like

THANK YOU!!!
It was the double slash :sweat_smile:

The template editor shows that my syntax is correct. When I run the command shown on the right, it successfully updates my external TRV temperature.

EDIT: I found this in the Homeassistant log:

Error 401 means: Unauthorized … why does homeassistant needs to do authorization ?

Finally got this solved by adding the username: and password: parameters to the call.

1 Like

Many thanks for this snippets @halfcat , it works perfectly and permits to use the TRV in combination with the floor heating and an external sensor under control of HA! :smiley:

But in the end I found that the automatically generated generic thermostat from the Shelly Integration was not up to the task (no configurable values for min and max) so I wrote my own generic thermostat. But still it was worth it, as it is nice to have the correct values on the TRV while in the Shelly App.

Thanks @halfcat , any idea what condition can be put so to prevent sending rest in case the external sensor become unavaible?

I would do that in the automation by adding a condition. Please do check you sensor and what it reports when it is unavailable. If for example the sensor has an identify button state of “unavailable”, you could add this condition:

condition: not
conditions:
  - condition: state
    entity_id: button.temperature
    state: unavailable
1 Like

Thank you all guys for providing such an useful information! This thread is one more reason I love HA Community!

could you provide your code?

I keep getting this error. even after multiple reboots

Service rest_command.send_ht_willow not found.