Skip to content

Commit

Permalink
Added warning for missing registry config when loading drivers.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidraker committed May 17, 2024
1 parent 21edda2 commit 72646ad
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions services/core/PlatformDriverAgent/platform_driver/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,17 @@ def setup_device(self):

self.heart_beat_point = config.get("heart_beat_point")

# Check for duplicate names in registry entries and warn if this will cause rows to be skipped.
point_names = [r['Volttron Point Name'] for r in registry_config]
seen = set(point_names)
duplicates = [n for n in point_names if n not in seen or seen.remove(n)]
if duplicates:
_log.warning(f'Duplicate point names detected in registry file for {self.device_path}. '
f'Only the last registry row will be used for points with names: {set(duplicates)}')
# Warn if there is no registry:
if registry_config is None:
_log.warning(f'No registry was found for device: devices/{self.device_path}')
else:
# Check for duplicate names in registry entries and warn if this will cause rows to be skipped.
point_names = [r['Volttron Point Name'] for r in registry_config]
seen = set(point_names)
duplicates = [n for n in point_names if n not in seen or seen.remove(n)]
if duplicates:
_log.warning(f'Duplicate point names detected in registry file for devices/{self.device_path}. '
f'Only the last registry row will be used for points with names: {set(duplicates)}')

self.interface = self.get_interface(driver_type, driver_config, registry_config)
self.meta_data = {}
Expand Down

0 comments on commit 72646ad

Please sign in to comment.