Is there a way to send notification when automation has been triggered.
But I do not want to receive the notification on midnight.
Is it posible to send the notification when it is triggered between 10:00 and 15:00.
For example:
sensor failure triggered on 01:00 – message send same day between 10:00 - 15:00
sensor failure triggered on 18:00 – message send next day between 10:00 - 15:00.
sensor failure triggered on 11:00 – message send immediately because the time is between settings.
It’s possible; sort of. You would need to store the notifications that must be delivered later (later on the same day or the next day). At 10:00 every day an automation would run and deliver the stored notifications that must delivered that day.
To my knowledge, there’s no integration available to store and forward notifications. If you try to do this exclusively with an automation, the first challenge is to find a place to store the notifications. An input_text only allows 255 characters which is insufficient for storing more than one or two notifications. Maybe there’s a way to use multiple input_texts, say 10 of them, and store one notification in each one. Of course, that just complicates how to manage them.
Yes, you can publish the notifications as retained messages (so they will be stored on the broker). How do you plan to store multiple notifications? If all in one topic, how do you accumulate them? If one topic per notification, how do manage them? How do you retrieve these stored payloads? Something in Home Assistant has to subscribe to the topic(s) in order to receive the payload(s) you just published.
FWIW, this isn’t an easy problem to solve with the available tools.
I have no previous knowledge of this but perhaps you can use file? https://www.home-assistant.io/integrations/file
As I see it this can read and write to a file. That way you can store the messages in the file and at 10 run an automation to read and send them.
But I have never used this…
Re-read its description: File Sensor only retrieves the last line in the file.
Plus it offers no means of deleting anything in the file and that’s needed to purge old notifications.
Perhaps you can store notifications in the file but use a scheduled (shell or python) script (running at 10:00 AM) to manage them. It would collect the current day’s notifications from the file (remove them from the file) and publish them to an MQTT topic (subscribed to by an MQTT Sensor), perhaps as a JSON dictionary (for easier parsing). The MQTT Sensor could store it in its attributes where, unlike its state, doesn’t have a 255 character limit. If there are no notifications to publish, it publishes an empty payload (to clear the MQTT Sensor’s attribute).
An automation runs at 10:05 and sends whatever notifications it finds in the MQTT Sensor’s attribute.