Json extraction from MQTT - I don't understand the error

Hi,
trying to do a simple jason extraction but don’t understand why it does not work. Spend already quite some time testing different alternatives, but no luck.

Here is the error message I receive:

2023-02-15 09:11:00.491 INFO (MainThread) [homeassistant.components.mqtt.binary_sensor] No matching payload found for entity: Status Tür Gästetoilette with state topic: zigbee2mqtt/0x00124b0029117643. Payload: '{"battery":100,"battery_low":false,"contact":true,"linkquality":47,"tamper":false,"voltage":3100}', template output: 'True', with value template 'Template("{{value_json["contact"]}}")'

It is strange that it says “no matching output” but at the same time says template output: ‘True’.

This is my configuration.yaml:

    - name: "Status Tür Gästetoilette"
      unique_id: "myhome-eg-wc-door"
      state_topic: "zigbee2mqtt/0x00124b0029117643"
      value_template: '{{value_json["contact"]}}'
      payload_on: "true"
      payload_off: "false"

Its probably super simple. Can somebody help me?
Thanks!!!

Try:

value_template: '{{ value_json.contact }}'

Probably simpler to use the ha entity that zigbee2mqtt will have created.

1 Like

Thank you for your help!
The solution was that I needed change the payload to:

      payload_on: True
      payload_off: False