@@ -198,13 +198,26 @@ def get_section_condition(section):
198198 format_vars = {"condition" : safe_condition }
199199 if section == "down_devices" :
200200 format_vars ["alert_down_minutes" ] = alert_down_minutes
201+ if section == "events" :
202+ # 'Down Reconnected' has its own dedicated section; exclude it
203+ # from events when that section is also active to prevent the
204+ # same device appearing twice with different IP sources.
205+ if "down_reconnected" in sections :
206+ format_vars ["event_types" ] = "'Connected', 'Disconnected','IP Changed'"
207+ else :
208+ format_vars ["event_types" ] = "'Connected', 'Down Reconnected', 'Disconnected','IP Changed'"
201209 sqlQuery = template .format (** format_vars )
202210
203211 except Exception as e :
204212 mylog ("verbose" , [f"[Notification] Error building condition for { section } : " , e ])
205213 fallback_vars = {"condition" : "" }
206214 if section == "down_devices" :
207215 fallback_vars ["alert_down_minutes" ] = alert_down_minutes
216+ if section == "events" :
217+ if "down_reconnected" in sections :
218+ fallback_vars ["event_types" ] = "'Connected', 'Disconnected','IP Changed'"
219+ else :
220+ fallback_vars ["event_types" ] = "'Connected', 'Down Reconnected', 'Disconnected','IP Changed'"
208221 sqlQuery = template .format (** fallback_vars )
209222 parameters = {}
210223
0 commit comments