MQTT sensor and value_json template

Hi,
i have this sensor

- platform: mqtt
  name: "Posizione tapparella bagno"
  state_topic: "tele/tapparellaBagno/SENSOR"
  value_template: "{{ value_json.SHUTTER-0 }}"
  json_attributes:
    - SHUTTER-0

and this mqtt message
{“Time”:“2018-07-17T20:02:29”,“SHUTTER-0”:100}

the sensor state value is unknown, someone can help me to get the value 100?

before the message was {“Time”:“2018-07-17T20:02:29”,“SHUTTER”:100} and the the sensor worked well with this configuration:

- platform: mqtt
  name: "Posizione tapparella bagno"
  state_topic: "tele/tapparellaBagno/SENSOR"
  value_template: "{{ value_json.SHUTTER }}"
  json_attributes:
    - SHUTTER

Try value_template: "{{ value_json['SHUTTER-0'] }}"

BTW, seems using json_attributes here is redundant.

thank you @pnbruckner now it’s ok.
you’re right about json_attributes.

1 Like