From 4144e4f8421c2f5130a674fa1fb7e4df09f5a325 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 19 Mar 2023 12:47:07 +0100 Subject: [PATCH] Fixed self._ip_to_dev expansion --- platypush/plugins/switch/tplink/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platypush/plugins/switch/tplink/__init__.py b/platypush/plugins/switch/tplink/__init__.py index 1011a8b703..c6b456e0e3 100644 --- a/platypush/plugins/switch/tplink/__init__.py +++ b/platypush/plugins/switch/tplink/__init__.py @@ -86,7 +86,7 @@ class SwitchTplinkPlugin(RunnablePlugin, SwitchEntityManager): devices: Optional[Mapping[str, SmartDevice]] = None, publish_entities: bool = True, ): - for (addr, info) in self._static_devices.items(): + for addr, info in self._static_devices.items(): try: dev = info['type'](addr) self._alias_to_dev[info.get('name', dev.alias)] = dev @@ -94,7 +94,7 @@ class SwitchTplinkPlugin(RunnablePlugin, SwitchEntityManager): except SmartDeviceException as e: self.logger.warning('Could not communicate with device %s: %s', addr, e) - for (ip, dev) in (devices or {}).items(): + for ip, dev in (devices or {}).items(): self._ip_to_dev[ip] = dev self._alias_to_dev[dev.alias] = dev @@ -225,7 +225,7 @@ class SwitchTplinkPlugin(RunnablePlugin, SwitchEntityManager): return [self._serialize(dev) for dev in self._scan().values()] def main(self): - devices = {ip: self._serialize(dev) for ip, dev in self._ip_to_dev} + devices = {ip: self._serialize(dev) for ip, dev in self._ip_to_dev.items()} while not self.should_stop(): new_devices = self._scan(publish_entities=False)