Shelly TRV MQTT Configuration [solved]

Hello everybody!

I would like to integrate some Shelly TRVs via MQTT with some success. But still some parts are missing.

Here is what I’m trying as a sensor:

1.) Shows the target temperature

- platform: mqtt
  name: MQTT TRV-01 receive set target temp
  unique_id: MQTT TRV-01 receive set target temp
  unit_of_measurement: '°C'
  expire_after: 86400
  device_class: temperature
  qos: 0
  state_topic: shellies/TRV-Wohnen-01/info
  value_template: "{{ value_json.thermostats.target_t.value }}"

2.) Mostly unknown, once unavailable

- platform: mqtt
  name: MQTT TRV-01 receive get temp
  unique_id: MQTT TRV-01 receive get temp
  unit_of_measurement: '°C'
  expire_after: 86400
  device_class: temperature
  qos: 0
  state_topic: shellies/TRV-Wohnen-01/info
  value_template: "{{ value_json.thermostats.tmp.value }}"

3.) Unavailable

- platform: mqtt
  name: MQTT TRV-01 send target temp
  unique_id: MQTT TRV-01 send target temp
  unit_of_measurement: '°C'
  expire_after: 86400
  device_class: temperature
  qos: 0
  state_topic: shellies/TRV-Wohnen-01/thermostat/0/command/target_t

Could You please help me?

Not strictly an answer to your question; but the shellies are working well with the COIOT API

Partly solved :slight_smile:
I’m getting the actual temerature.

- platform: mqtt
  name: "Room2 temperature"
  unique_id: "Room2 temperature"
  state_topic: "shellies/TRV-Schlafen/info"
  unit_of_measurement: "°C"
  device_class: temperature
  force_update: true
  value_template: "{{value_json.thermostats[0].tmp.value }}"
  json_attributes_topic: "shellies/TRV-Schlafen/info"
  json_attributes_template: "{{ value_json.thermostats | tojson }}"
  availability_topic: "shellies/TRV-Schlafen/online"
  payload_available: "true"
  payload_not_available: "false"

I’m fiddling with this topic again because the connectivity with WiFi is really bad.

And this settings actually work. I will continue expanding this settings.

mqtt:
  sensor:
    - name: "Shelly-TRV Bad Target_t"
      unit_of_measurement: "°C"
      #expire_after: 86400
      device_class: temperature
      icon: mdi:home-thermometer-outline
      qos: 1
      state_topic: "shellies/shellytrv-8CF6811CA673/status"
      value_template: "{{ value_json.target_t.value }}"

    - name: "Shelly-TRV Bad Temperatur"
      unit_of_measurement: "°C"
      #expire_after: 86400
      device_class: temperature
      icon: mdi:home-thermometer-outline
      qos: 1
      state_topic: "shellies/shellytrv-8CF6811CA673/status"
      value_template: "{{ value_json.tmp.value }}"

    - name: "Shelly-TRV Bad Batterie"
      unit_of_measurement: "%"
      #expire_after: 86400
      device_class: battery
      icon: mdi:battery
      qos: 1
      state_topic: "shellies/shellytrv-8CF6811CA673/info"
      value_template: "{{ value_json.bat.value }}"

This is how I set the target_t

service: mqtt.publish
data:
  qos: "1"
  retain: false
  topic: shellies/shellytrv-8CF6811CA673/thermostat/0/command/target_t
  payload_template: "{{ states('input_number.temperatur_ziel_hoch')|float(0) }}"

I have just bought a couple of these shelly valves and am testing them. Unfortunately the CoIoT implementation didn’t seem to be terribly reliable for me (they wouldn’t reliably respond to automated schedule commands to change temperature), so now I wanted to connect them via mqtt.

I don’t have a ton of experience with yaml - would you be able to help? Is this code going in configuration.yaml to custom create an entity?

Yo can put this code into configuration.yaml. Read here MQTT Sensor