diff --git a/modules/settings.py b/modules/settings.py index 9fd2079..dffce8d 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -323,6 +323,9 @@ try: coastalForecastDays = config['location'].getint('coastalForecastDays', 3) # default 3 days # location alerts + alert_duration = config['location'].getint('alertDuration', 20) # default 20 minutes + if alert_duration < 10: # the API calls need throttle time + alert_duration = 10 eAlertBroadcastEnabled = config['location'].getboolean('eAlertBroadcastEnabled', False) # old deprecated name ipawsAlertEnabled = config['location'].getboolean('ipawsAlertEnabled', False) # default False new ^ # Keep both in sync for backward compatibility diff --git a/modules/system.py b/modules/system.py index b796215..bb60f69 100644 --- a/modules/system.py +++ b/modules/system.py @@ -1304,8 +1304,8 @@ def handleAlertBroadcast(deviceID=1): if should_send_alert("overdue", overdueAlerts, min_interval=300): # 5 minutes interval for overdue alerts send_message(overdueAlerts, emergency_responder_alert_channel, 0, emergency_responder_alert_interface) - # Only allow API call every 20 minutes - if not (clock.minute % 20 == 0 and clock.second <= 17): + # Only allow API call every alert_duration minutes at xx:00, xx:20, xx:40 + if not (clock.minute % alert_duration == 0 and clock.second <= 17): return False # Collect alerts