Hi, i have a instar camera from which i want to use the motion sensor in Home assistant. Via Mqtt i receive motion data as Values. I need a binary sensor which give me the state On or Off
I tried this:
mqtt:
- binary_sensor:
- name: "Bewegungsmelder Hof"
state_topic: "instar/10D1DC2286D1/status/alarm/triggered"
payload_on: "ON"
payload_off: "OFF"
device_class: motion
value_template: "{% if value_json.val == "0" %}OFF{% else %}ON{% endif %}"
however in Yaml i get an error “bad identation” (last line)
in dev.tools i get an error: “value_json is undefined”
so i dont even know if the code could work