@blakeblackshear here’s an easier method in the MQTT binary sensor that gives the best of both worlds:
Take this, which worked with the original ON/OFF payloads:
- platform: mqtt
name: "Motion BYC Person"
state_topic: "frigate/byc/person"
payload_on: "ON"
payload_off: "OFF"
device_class: motion
availability_topic: "frigate/available"
…and change it to this:
- platform: mqtt
name: "Motion BYC Person"
state_topic: "frigate/byc/person"
payload_on: "ON"
payload_off: "OFF"
device_class: motion
availability_topic: "frigate/available"
value_template: >
{% if value == "0" or value == '' %}
OFF
{% else %}
ON
{% endif %}
Tested it quite a bit and it seems to work fine. If it’s NULL or 0, the binary sensor stays off. Anything else, e.g. 1 or 10 objects detected, and it turns to on.
FYI your work on Frigate has been outstanding. I basically replaced the brains in Blue Iris with Frigate via MQTT integration. It works amazingly well. Thanks much!