Smoke detector test reminder (how to perform long term state monitoring)?

I have a couple of Z-Wave smoke detectors that have a “test in progress” state. I would like to create an automation that sends me an email if I haven’t tested a smoke detector in six months (or some really long time period.)

For short term stuff like sending an alert if I left my garage door open for more than an hour, I can use an automation trigger that fires if a device has been in a given state for a period of hours, minutes, and seconds. It does not appear that automation triggers support state monitoring in terms of days and months. I assume that state monitoring is based on information stored in the recorder, which only holds data for a limited period of time.

Is there a way to create an automation that runs based on something being in a state for a period of months?

I know I could just create a trigger that fires every January 1 and July 1 (which might be the ultimate solution), but I am curious if long term time offsets are supported for use cases like testing smoke alarms, changing air filters, etc.

You can use something like a datetime helper that you update each time you run your test. Then you could do triggering based on how old the time data is.

You could also play with some of the time templating functions, search for relative_time or timedelta.

1 Like

Another option is to use Grocy and track your ‘chores’ with it. It is mainly for groceries but there are several people like me that run it for chore tracking.
https://grocy.info/
I have this running in a docker container and have HA (via HACS Grocy integration) pick up the chores that are to in the next 5, 7, 30 days and then all chores (completely up to you, these time frames just worked for me). Just for that it is a great little project. I have very long term things in there like change out my smoke detectors every 10 years. Inside HA I also have a chore complete button when the task is done. You could write an automation that completes the chore and then Grocy would let you know when it was due again…and it will survive an update or a shutdown.

Yet another way would be to have an MQTT broker that you don’t shutdown that you ‘store’ long term info on to retrieve when it was last done.

Well, it seems I want do something similar, that’s why reply to this topic. If not wanted, please let me now and I create a new topic.

So, what I have:
I have a number of smoke detector’s installed over Zigbee (Heiman Smoke Detector). If I press the test-button on them, the alarm is registered in the entity ‘binary_sensor.smokesensor_{roomname}_iaszone’

What I want:
I want get a reminder (via Telegram) to test my smoke detector’s. Let’s say each month (30 days). The message should name the smoke detector(s), that I have to test.

What I already tried:
I tried to setup an automation with an timer. The trigger is a time I set. The action is sending the notification via Telegram. Both things working already.

My Problems/Questions:
The part with the condition make me crazy. I tried a little bit with templating in the developer tools.

{% for state in states.binary_sensor if 'smoke' in state.entity_id %}
      {{ state.last_changed }} | {{device_attr(state.entity_id, "name_by_user")}}
{% endfor %}

I’m a bit lost how to design the condition and then transfer the name of the smoke sensor to the action/notification part.
When I read the forum, I often find that the history is limited to 10 days. So I will not get the info, when I last time pressed the test button. That’s the default setting? Where I could change it for specific devices?
Then another problem is, the last_changed value seems not the timestamp I can use. The smoke detector sent from time to time (1 or 2 day’s) updates. Even when it’s always false (the alarm), the last_changed value is the last update. I’m right with that?
So, my thoughts was to store the last alarm ‘somewhere’ (timestamp or so) and check this in my timer. How I should do this? How I then can get the name of the smoke detector?

Thank you!

As per the solution I proposed earlier, you need to use a datetime helper to store your last test information. You should have an automation that updates the helper when you capture the update test button press event your binary_sensor.smokesensor_{roomname}_iaszone You should be triggering your notification based on a time difference from that helper. The reason for this is that your state.last_changed is going to get reset anytime the zigbee network gets a restart, or some other state is modified on the device, not just a press of your test button.

I would recommend that when you’re doing your smoke alarm testing that you test all of them at the same time and not just a single one. That way you don’t really have to directly track all of them, just have all of the test button press events update the same datetime helper.

1 Like