I’m not understanding this section of the help page.
The example shows, the value_json.on (references the “on” in the msg?) grabs the value “true”? So I thought I would duplicate this in mine, but I get the error below.
My MQTT sensor:
- platform: mqtt
unique_id: '123456HomeAssistantShutDown'
state_topic: "homeassistant/CMD/shutdown"
value_template: "{{ value_json.cmd }}"
My MQTT payload:
{"type":"HA","cmd":"SHUTDOWN"}
When I send that msg I get this error in the logs:
Logger: homeassistant.helpers.template
Source: helpers/template.py:1791
First occurred: 12:22:40 PM (1 occurrences)
Last logged: 12:22:40 PMTemplate variable error: ‘value_json’ is undefined when rendering ‘{{ value_json.type.cmd }}’
1 post - 1 participant