Expire_after option for MQTT Binary Sensors

Regular MQTT sensors have an expire_after option. This option is not available for MQTT Binary Sensors.

It would be handy for things like motion sensors that do not send an update when motion stopped. I currently have to create an automation for each MQTT motion sensor to reset its state back to off after 5 seconds. With this expire_after option this could be accomplished much more easily with a simple configuration line.

because a developer hasn’t added it. Make a new feature request and it will be added:

https://community.home-assistant.io/c/feature-requests
1 Like

oh, it thought there was a reason for not including it haha. seems too obvious :stuck_out_tongue: ill add a request.

1 Like

It may have just been over looked. I could also be wrong, but I looked at the documentation and it doesn’t mention it. It also appears to be missing from the source code.

is it easy to add this feature?

No clue, it depends on the base class used to communicate with the device. If it doesn’t exist, someone needs to create it. Adding into the component python file would be very easy.

Has anyone looked into this further?

Is it on some sort of roadmap, or what’s the deal :slight_smile:
I want to use this to mark my PIR sensors as unavailable if no update in say 2 hours.

Cheers,

I have made the change and created a PR for this one if anyone is interested.

I just someone to do the doco, and sort out the linting issues, because not quite sure about those.

Cheers!

https://github.com/home-assistant/home-assistant/pull/26058