Mqtt msg.payload read in mqtt sensor

Hi

I send mqtt msg.payload from node-red to mqtt sensor in hass.

I can get value of msg.payload?

I try like this:

  - platform: mqtt    
    name: "mqtt_sensing_wc"
    state_topic: "home/bathroom/sensor/wc"
    qos: 0
    unit_of_measurement: ""
    value_template: "{{ msg.payload }}"

but not working.

If you don’t add a value_template, the sensor will take the value of whatever is in the payload of the message. What is the content of the payload?

Whole message send from node-red to mqtt:

I wanna add payload: “brez” to my mqtt sensor.

Just remove the value_template line, and it should work fine.

Thanks. I just do that and now is working :slight_smile:

1 Like