Help with sensor string

Hi,
I have defined a mqtt sensor to retrieve values from mqtt server.

    - name: "OpenEVSE State"
      state_topic: "openevse/announce/9c0c"
      qos: 1

The sensor returns this string

{"state":"connected","id":"b8d61a0d9c0c","name":"openevse-9c0c","mqtt":"openevse-9c0c","http":"http://192.168.1.240/"}

I’m only intersted in the “state” attribute and would like to evaluate if this is connected (or not). What is the best way to do this?

Many thanks

I think you should add a line like

value_template: "{{ value_json.state}}"

See here MQTT Sensor - Home Assistant

1 Like