Retry notification if send failed

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
bennythep
Posts: 3
Joined: Monday 07 September 2020 1:33
Target OS: Windows
Domoticz version:
Contact:

Retry notification if send failed

Post 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
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Retry notification if send failed

Post 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?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
bennythep
Posts: 3
Joined: Monday 07 September 2020 1:33
Target OS: Windows
Domoticz version:
Contact:

Re: Retry notification if send failed

Post 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?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Retry notification if send failed

Post 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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
bennythep
Posts: 3
Joined: Monday 07 September 2020 1:33
Target OS: Windows
Domoticz version:
Contact:

Re: Retry notification if send failed

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest