Home Information - Your home, your data, organized.
Python
Added name update for ZoneMinder sync operation.
Anthony Cassandra88cbcb4b1026
diff --git a/src/hi/integrations/zoneminder/zm_manager.py b/src/hi/integrations/zoneminder/zm_manager.pyindex d2d22e42..7e2fc890 100644--- a/src/hi/integrations/zoneminder/zm_manager.py+++ b/src/hi/integrations/zoneminder/zm_manager.py@@ -162,8 +162,9 @@ class ZoneMinderManager( Singleton ):integration_key_to_monitor = dict()for zm_monitor in self.zm_client.monitors().list():integration_key = self._monitor_to_integration_key( zm_monitor_id = zm_monitor.id() )+ integration_key_to_monitor[integration_key] = zm_monitor- result.message_list.append(+ logger.debug('[ZM Monitor] Id:{} Name:{} Enabled:{} Status:{} Type:{} Dims:{}'.format(zm_monitor.id(),zm_monitor.name(),@@ -173,7 +174,6 @@ class ZoneMinderManager( Singleton ):zm_monitor.dimensions(),))- integration_key_to_monitor[integration_key] = zm_monitorcontinuereturn integration_key_to_monitor@@ -243,10 +243,12 @@ class ZoneMinderManager( Singleton ):zm_monitor : ZmMonitor,result : ProcessingResult ):- # Currently nothing stored locally that will change (other than entity existence)-- result.message_list.append( f'No updates needed for camera entity: {entity}' )-+ if entity.name != zm_monitor.name():+ result.message_list.append(f'Name changed for {entity}. Setting to "{zm_monitor.name()}"')+ entity.name = zm_monitor.name()+ entity.save()+ else:+ result.message_list.append( f'No changes found for {entity}.' )returndef _remove_entity( self,