Mqtt message to HA sensor

I want to make an MQTT sensor from a MQTT message, I tried to make an yaml mqtt sensor, but I can’t get is to work

I get this message from my MQTT broker,

Message 85 recieved on Heatpump at 15:58

{
“devices”: "A,
“payload”: {
“Input”: 27.56,
“Output”: 23.94,
“Flow”: 0.17,
“Watt”:2593
}
}

How did you set up the mqtt sensor in HA?

You need to properly extract the data from the json encoded MQTT message. Can you show what didn’t work?

Edit. Something like this should work, if the MQTT topic is indeed “Heatpump” (which seems weird to me - can you check which topic the message is being posted to?)

mqtt:
  sensor:
    - name: "Heatpump Input Temperature"
      state_topic: "Heatpump"
      unit_of_measurement: "°C"
      value_template: "{{ value_json.payload.Input }}"
      device_class: "temperature"
1 Like