Trying to create a binary sensor from JSON MQTT but cannot get it to work. I want to use the “active” and turn the switch on/off by “0” and “1”.
The JSON looks like this:
{"timestamp": 1588945675722, "topic": "test:something/to/measure", "message": {"source": {}, "key": {}, "data": {"active": "0"}}}
My sensor:
- platform: mqtt
name:test
state_topic: "test:something/to/measure"
value_template: "{{ value_json[message][active] }}""
payload_on: "1"
payload_off: "0"
device_class: motion
I do not understand how to get to the “active” from the nested JSON file.