@@ -154,7 +154,7 @@ def get_prefixed_host(self):
154154        else :
155155            return  "http://"  +  host 
156156
157-     def  update_devices (self ):
157+     def  update_devices (self ,  ignore_removed   =   True ):
158158        """Update the device.""" 
159159        _LOGGER .info ("Updating Devices ..." )
160160        if  self ._devices  is  None :
@@ -172,12 +172,13 @@ def update_devices(self):
172172                device  =  FritzhomeDevice (self , node = element )
173173                self ._devices [device .ain ] =  device 
174174
175-         for  identifier  in  list (self ._devices .keys ()):
176-             if  identifier  not  in 
177-                 element .attrib ["identifier" ] for  element  in  device_elements 
178-             ]:
179-                 _LOGGER .info ("Removing no more existing device "  +  identifier )
180-                 self ._devices .pop (identifier )
175+         if  not  ignore_removed :
176+             for  identifier  in  list (self ._devices .keys ()):
177+                 if  identifier  not  in 
178+                     element .attrib ["identifier" ] for  element  in  device_elements 
179+                 ]:
180+                     _LOGGER .info ("Removing no more existing device "  +  identifier )
181+                     self ._devices .pop (identifier )
181182
182183        return  True 
183184
@@ -400,7 +401,7 @@ def has_templates(self):
400401            return  False 
401402        return  True 
402403
403-     def  update_templates (self ):
404+     def  update_templates (self ,  ignore_removed   =   True ):
404405        """Update the template.""" 
405406        _LOGGER .info ("Updating Templates ..." )
406407        if  self ._templates  is  None :
@@ -418,12 +419,13 @@ def update_templates(self):
418419                template  =  FritzhomeTemplate (self , node = element )
419420                self ._templates [template .ain ] =  template 
420421
421-         for  identifier  in  list (self ._templates .keys ()):
422-             if  identifier  not  in 
423-                 element .attrib ["identifier" ] for  element  in  template_elements 
424-             ]:
425-                 _LOGGER .info ("Removing no more existing template "  +  identifier )
426-                 self ._templates .pop (identifier )
422+         if  not  ignore_removed :
423+             for  identifier  in  list (self ._templates .keys ()):
424+                 if  identifier  not  in 
425+                     element .attrib ["identifier" ] for  element  in  template_elements 
426+                 ]:
427+                     _LOGGER .info ("Removing no more existing template "  +  identifier )
428+                     self ._templates .pop (identifier )
427429
428430        return  True 
429431
0 commit comments