Mqtt binary sensor - PIR on remote raspberry pi

Hi all,

I have a remote raspberry pi that sends an MQTT message when the PIR detects movement - a python app on the raspberry does this with the following code…

publish.single(state_topic, "true", retain=False, hostname=broker)

On the homeassistant the sensor to receive is currently setup like this

  - platform: mqtt
    name: "Dayroom Movement"
    state_topic: "dayroom/movement"
    qos: 0
    payload_on: "true"
    payload_off: "false"
    sensor_class: motion

So it’s kind of fine but not as I want as it just turns ON when movement is detected, then it stays ON in home assistant. I could set it OFF in python on the raspberry after a few seconds but that seems a bit wrong.

I envisage this working a bit like a ping, each time the PIR gets movement it pings HA and HA records that there was a movement event.

am i doing it wrong ? / any tips to do it better ?

Any ideas, movement sensor fine but I’m seeing double alerts in the UI. One for on and one for off… Seems wrong for a movement event.

How do others do this?

Anyone on here using PIR sensors with raspeberry - would have thought it was a good (cheap) option?

Hi @bingobob. Did you find a good solution for this?

I got myself some pirs that I plan to use on remote rPi:s so I would love to use your setup if you want to share it.

did you solve this?

di you solve this??

I solved it like this:

But there are still some open issues like sensor disappear after reboot of HASS.
Maybe @fabaff have more info about the status.