Adding MQTT Temp Sensor

Hi All,

I’m still very new to MQTT & HA and I know I’m doing something silly here but I can’t work it out.

So I have a temperature sensor connected to an ESP that is pushing the data to the MQTT database. I can see the data in MQTT but can’t retrieve it in HA

sensor:
  - platform: mqtt
    name: "Upstairs Temperature"
    state_topic: "rflink/Oregon_TempHygro-2DF8"
    unit_of_measurement: '°C'
    value_template: "{{ value_json.temperature }}"
  - platform: mqtt
    name: "Upstairs Humidity"
    state_topic: "rflink/Oregon_TempHygro-2DF8"
    unit_of_measurement: '%'
    value_template: "{{ value_json.humidity }}"

card

Do you have something like this in your configuration.yaml?

mqtt:
  discovery: true
  broker: 192.16x.xx.xx
  port: 18xx

Your value_template is incorrect. You don’t have temperature or humidity in the payload.
Try this:

sensor:
  - platform: mqtt
    name: "Upstairs Temperature"
    state_topic: "rflink/Oregon_TempHygro-2DF8"
    unit_of_measurement: '°C'
    value_template: "{{ value_json.TEMP }}"
  - platform: mqtt
    name: "Upstairs Humidity"
    state_topic: "rflink/Oregon_TempHygro-2DF8"
    unit_of_measurement: '%'
    value_template: "{{ value_json.HUM }}"
1 Like

haha oops, that was a bit obvious really wasn’t it!

Thanks, it’s all sorted

1 Like