Automation walk-around for unreliable alarm sensor

Hello everyone,
this is my first post in this community, please forgive me if I inadvertently break any protocol.

I have realized an alarm system based on a esp32 board (olimex esp32-poe-iso) and the Alarmo integration on HA. I have several wired sensors for doors and windows. I have noticed that one of these (always the same one) is giving me a few false alarms (average 1-2 per week).
The problem comes from an erratic indication that sends an “open” state just for a fraction of a second and then goes back to “closed”. In fact the two events are logged in the same second.
I will check the connections, but for now I have implemented a walk-around via an automation.
I have created an automation triggered when there is a change in the state of the sensor for at least one full second. The automation then sets the value of a boolean helper. The helper, therefore, mimics the value of the sensor but ignores the erratic data.
So far so good, but I cannot use an helper as a sensor in Alarmo, therefore I had to create a template binary sensor that gets its value from the helper. This template sensor has been added to Alarmo, instead of the original unreliable sensor.
It works, but it looks to me a little too complicated, since I have to use 3 entities to do the job.
Is there a more efficient way to do it?
Thank you in advance.

You would need to start by explaining how you have implemented the sensor.

Since you posted in the ESPHome topic I assume ESPHome, so it would be good if you posted your yaml. Before you do however have a read of this:

Pay attention to the bit about using formatted text tags for code - to avoid upsetting anyone… :grinning:

1 Like

Sounds like a job for a delayed_on to me.

2 Likes

Thank you Mahko_Mahko! That was exactly what I was looking for. I visited that page multiple times, I don’t know how I could miss it! Thanks for pointing me in the right direction. Now it works perfectly.

zoogara you are right, sorry about that, I forgot to mention that I am using ESPHome. Thanks for linking that help page. Upsetting anyone is the last thing I want!

3 Likes