Page 1 of 1

Retry notification if send failed

Posted: Monday 07 September 2020 1:40
by bennythep
Apologies.. I have looked everywhere for an answer to this but I just can't seem to find anything. I thought this would be something simple.

I have a power switch attached to my cable modem, and a script that runs every 5 minutes checking the internet connection. Sometimes, the modem gets flaky and a restart fixes it. So every 5 mins, the script checks if the cloud is reachable, and if not, it turns off the power, waits 5 secs, then turns it back on again. I want to get a notification when this happens (through FCM, which is fine for me).

The problem is, the notification is tied to the power turning back on, at which point it tries to send the notification but can't, because the internet isn't back up yet.

Is there a way to tell Domoticz to retry notifications if they fail?
  • I looked around for a script that I could write that would 'tap into' notification sent event, but couldn't find anything
  • I don't really want to have a delay on sending the notifications, because I use the notification system for other notifications that I want to get instantly

Re: Retry notification if send failed

Posted: Monday 07 September 2020 11:06
by waaren
bennythep wrote: Monday 07 September 2020 1:40
  • I looked around for a script that I could write that would 'tap into' notification sent event, but couldn't find anything
  • I don't really want to have a delay on sending the notifications, because I use the notification system for other notifications that I want to get instantly
Can you share your current script? Maybe it is relatively simple to adapt it to serve your needs.
What is your domoticz version?

Re: Retry notification if send failed

Posted: Monday 07 September 2020 23:23
by bennythep
My Domoticz version is 2020.2 (Windows).

Sorry I'might not be understanding your question, but the script I run to test the internet connection isn't run in Domoticz, it simply calls the Domoticz API if the modem needs to be reset. It runs the 'turn off' api call, then waits 5 secs, then runs the 'turn on' API call. The switch has a notification event tied to 'turn on', which then sends the notification.

Really, I just need to know how I can get Domoticz to keep retrying sending a notification if it fails, until it's sent correctly. Is that possible?

Re: Retry notification if send failed

Posted: Tuesday 08 September 2020 0:14
by waaren
bennythep wrote: Monday 07 September 2020 23:23 Really, I just need to know how I can get Domoticz to keep retrying sending a notification if it fails, until it's sent correctly. Is that possible?
show u
No that is not possible but if you share your current script I might be able to create a dzVents script to resend a notification or send an Email after some seconds /minutes.

Re: Retry notification if send failed

Posted: Tuesday 08 September 2020 0:38
by bennythep
Oh that would be really great, thankyou!

It's disappointing this functionality isn't built into Domoticz, I might submit a feature request.

The script I have isn't a Domoticz script, though. It's a batch script. Is that ok? Is it possible to script a notification and return back whether it was sent correctly or not? I did try and look this up but couldn't find anything. Ultimately I need code that does something like this:
  • 1. trigger: modem power switch turned back on
  • 2. send notification
  • 3. check notification sent
  • 4. if not sent, return to 2