Small zwave_js code cleanup (#95745)

pull/95758/head
Raman Gupta 2023-07-03 03:30:53 -04:00 committed by GitHub
parent cdea33d191
commit de7677b28d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -317,7 +317,9 @@ class ControllerEvents:
self.discovered_value_ids: dict[str, set[str]] = defaultdict(set)
self.driver_events = driver_events
self.dev_reg = driver_events.dev_reg
self.registered_unique_ids: dict[str, dict[str, set[str]]] = defaultdict(dict)
self.registered_unique_ids: dict[str, dict[str, set[str]]] = defaultdict(
lambda: defaultdict(set)
)
self.node_events = NodeEvents(hass, self)
@callback
@ -488,9 +490,6 @@ class NodeEvents:
LOGGER.debug("Processing node %s", node)
# register (or update) node in device registry
device = self.controller_events.register_node_in_dev_reg(node)
# We only want to create the defaultdict once, even on reinterviews
if device.id not in self.controller_events.registered_unique_ids:
self.controller_events.registered_unique_ids[device.id] = defaultdict(set)
# Remove any old value ids if this is a reinterview.
self.controller_events.discovered_value_ids.pop(device.id, None)