From b6d29ad46199da6e9228eb2f5e05cabc63988f96 Mon Sep 17 00:00:00 2001 From: "David M. Raker" Date: Tue, 16 Apr 2024 18:08:56 -0700 Subject: [PATCH] Fixes to driver exception handling related to bacnet pings and heartbeats. --- services/core/PlatformDriverAgent/platform_driver/agent.py | 5 ++++- .../platform_driver/interfaces/bacnet.py | 7 +++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/services/core/PlatformDriverAgent/platform_driver/agent.py b/services/core/PlatformDriverAgent/platform_driver/agent.py index 967e2c81f1..5c3d097433 100644 --- a/services/core/PlatformDriverAgent/platform_driver/agent.py +++ b/services/core/PlatformDriverAgent/platform_driver/agent.py @@ -487,7 +487,10 @@ def heart_beat(self): """ _log.debug("sending heartbeat") for device in self.instances.values(): - device.heart_beat() + try: + device.heart_beat() + except (Exception, gevent.Timeout) as e: + _log.warning(f'Failed to set heart_beat point on device: {device.device_name} -- {e}.') @RPC.export def revert_point(self, path, point_name, **kwargs): diff --git a/services/core/PlatformDriverAgent/platform_driver/interfaces/bacnet.py b/services/core/PlatformDriverAgent/platform_driver/interfaces/bacnet.py index b2fc973e10..d7f7c606e1 100644 --- a/services/core/PlatformDriverAgent/platform_driver/interfaces/bacnet.py +++ b/services/core/PlatformDriverAgent/platform_driver/interfaces/bacnet.py @@ -22,7 +22,7 @@ # ===----------------------------------------------------------------------=== # }}} - +import gevent import logging from datetime import datetime, timedelta @@ -98,9 +98,8 @@ def ping_target(self): pinged = True except errors.Unreachable: _log.warning("Unable to reach BACnet proxy.") - - except errors.VIPError: - _log.warning("Error trying to ping device.") + except (Exception, gevent.Timeout) as e: + _log.warning(f"Error trying to ping device: {e}") self.scheduled_ping = None