I have an automation that sends an alert to my phone when a person or vehicle is detected at my garage. This is done by having Blue Iris send an MQQT alert which then changes a sensor in HASS. I realize that I can directly use a trigger of “When an MQTT message has been received” rather than “When X Sensor changes state” for an automation trigger, but I’m curious why this isn’t working.
So basically I have a sensor,Blue_Iris_GarageWide_Person
which goes On or Off depending on the MQQT sent from Blue Iris. This sensor changes fine, and is always correctly either On or Off:
The automation doesn’t ever seem to run though, even if I manually change the sensor to On or Off in MQQT Explorer. I would like the trigger to occur when the sensor goes from Off to On but it seems that the only states shown in the automation are “Unavailable” and “Unknown”. When I manually change it to Off and On, the automation doesn’t trigger. However, if I don’t put any state there, the automation triggers when the sensor enters both Off and On states (as expected):
So I guess the ultimate question is, why is the sensor showing the expected On and Off states, but the automation for this sensor is not recognizing these states?
EDIT: Adding on, in the config the sensor is:
mqtt:
sensor:
- name: Blue_Iris_GarageWide_Person
state_topic: "BI/garagewide/person"
In researching more, it seems that maybe this sensor should instead be a binary sensor which expects on and off values? The values are being retained for both on and off from Blue Iris so I"m not sure if that makes a different or not.