From de7677b28d59ee2e227a69166adfe523a0804d2c Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Mon, 3 Jul 2023 03:30:53 -0400 Subject: [PATCH] Small zwave_js code cleanup (#95745) --- homeassistant/components/zwave_js/__init__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/zwave_js/__init__.py b/homeassistant/components/zwave_js/__init__.py index b847b76ca17..8c1dd9b2197 100644 --- a/homeassistant/components/zwave_js/__init__.py +++ b/homeassistant/components/zwave_js/__init__.py @@ -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)