Hi Guys!
I’m have build an alarm setup for myself which works quite well but up until this weekend it just sends a generic ALARM notification when it tiggers. This weekend I got the message for the first time due to an false positive trigger which made me consider including the sensor states in the notification message as kind of a summary like this.
Front door: On
Backdoor: Off
Windows: Off
Windows upstairs: Off
I have got that part working nicely but now the following problem rises:
The moment the alarm gets triggerd it starts beeping and allows for a x-amount of time to dismantle the alarm. If that is not happening then a loud noise starts playing and notifications get send.
But the moment the notification gets send it get’s the state of all the sensors and sends the message. But by that time the door has (likely) closed again so it sends the wrong state. What I need is the state when the alarm started the trigger.
I thought of several options:
• Create the notification message Immediately after the trigger hits but wait with sending until I know the alarm has not been dismantled. This option seems not possible as constructing the notification and sending happens in the same function.
• Create a notification message and save it temporarily so when the notification needs to be send the content can be read again and send. I tried this with the file notify https://www.home-assistant.io/integrations/file/ saving it to a notification.txt and then load it into a sensor which I use later as content for the message but this seems a very complex solution.
Does any of you know how to fix this problem ? So basically save the state of sensors when the alarm is triggered so I can use the content of that state later to construct a message ? I rather not make “save state” for each sensor individually but would prefer to create a full “reporting message” on the alarm trigger (when I have all the correct states) and use the content of that “reporting message” later to send it as a notification.
I hope this questions makes sense to you . Thnx in advance!