Shelly TRV mqtt configuration and lovelace configuration

I installed several Shelly TRV valves, but I have problems regarding MQTT discovery, also HA do not discover my valves.
Now I decided to add devices in old fashion way, so that I would like to add valves manualy to sensors.yaml, protocol for communicate would be MQTT.

Can anybody help me how to make sensors/binnary mqtt configuration…

I found instructions:
https://shelly-api-docs.shelly.cloud/gen1/#shelly-trv

Also, do anybody has thermostat / valve GUI, so that is easy to define temperature and also to completly open/close valve.

THANK YOU…

Is you can’t set it up with MQTT the MQTT sensors won’t work either.
Double check the details you entered, open MQTT explorer and see if you can see any reference in there.

I checked twice, found that I had wrong IP address (typing mistake).

But still… In MQTT explorer I do not get info from TRV… I got many other devices (also shellies), but no TVR…

I also tried to enable discovery, but the result was the same…

I have at the same time also enable ColoT and Device discoverable, but this either do not helping regarding HA discovery…

Have to try to reboot the TRV after activation of CoIoT?

Another thought. I couldn’t activate MQTT via app, It worked via web page

Yes… I have make reboot… also… I configure all settings via web browser (chrome)…

Devices has static IP on network if somehow related (but it shouldnt be)…

Last Shelly FW? If you use HA in a docker , have you mapped the CoIoT port?

I’m using on Raspbery Pi4… so no docker…

Probably there is problem in discovery script somewhere …

1 Like

The only and best iption for me would be manually add mqtt sensor… anybody know how to make mqtt template for sensors from the docs…

This is a binary sensor of mine for MQTT.
You would need in binary_sensor: at the top if you set it up in the main config file.

- platform: mqtt
  device_class: motion
  state_topic: "selfmon/vmod/prio/inputs/read/1011"
  name: "Hall"
  off_delay: 3
  payload_on: "OPEN"
  payload_off: "CLOSED"

uff… my goil is to have much more info…

  • desired temperature
  • current temperature
  • valve % opened
  • battery level

Also to set the current desired temperature and to send external sensor temperature…

So you just repeat that block of code 4 times changing the state topic.

I have added the Shelly TRVs with MQTT. I have the ‘Mosquitto broker’ addon installed. After setting the MQTT setting for the TRV in the local browser, in HA in the UI on the Integrations Page, it didn’t discover the TVRs automatically. I had to add manually by clicking on the ADD INTEGRATION button, type in “Shelly”, select the Shelly Option, then in the pop up, typed in the IP address of the TRV. (I use Static IP addresses for all my shelly devices.) It picked the TRV from there.

The problem is that I’m also using Shelly4HASS integration, so I prefer to add MQTT sensors manually to sensors yaml file…
If I add also native shelly integration, the devices are doubled… all mixed…

Do you maybe have MQTT sensor configuration, so that I would add TRV manually…

Hi kslb

I’m currently playing with my Shellys. My configuration looks like this:

  - platform: mqtt
    name: Heater office
    min_temp: 4
    max_temp: 31
    modes:
    current_temperature_topic: shellies/shellytrv-office/info
    current_temperature_template: "{{ value_json.thermostats[0].tmp.value }}"
    temperature_command_topic: shellies/shellytrv-office/thermostat/0/command/target_t

I’m not done with configuring at this time, but it does its job.

1 Like

I am using the official HA Shelly Integration: Shelly - Home Assistant
I haven’t done any MQTT settings in HA other than the basic install when adding Mosquitto broker.

Great… This is what I was looking for…

I will try your code in weekend when I will have time to play with it…

If you will make some progress please publish the updated code…
I will do also if I will somehow succed to add some additional information to configuration code… but this is great for start…

Ok, so now it’s working also for me…

slika

So, now the feature which would be good to add is…
1: Battery status (%)
2: Valve position (as seen on Shelly Cloud, so that you can see how much % is open)
3: Calibration status: Calibrated / Not calibrated
4: Option to push to make the valve calibration

What do you think?

My code (a little modified - added step):

  - platform: mqtt
    name: "Luka (TRV)"
    min_temp: 4
    max_temp: 31
    temp_step: 1
    modes:
    current_temperature_topic: shellies/shellytrv-luka/info
    current_temperature_template: "{{ value_json.thermostats[0].tmp.value }}"
    temperature_command_topic: shellies/shellytrv-luka/thermostat/0/command/target_t

I see also another problem:
slika

The desired temperature is not synched… Only if I change the desired temp, then the data is changed also on Shelly, but HA do not read desired temp and is on HA restart allways 21…