diff --git a/py2n/__init__.py b/py2n/__init__.py index 7d18e79..e8783fd 100644 --- a/py2n/__init__.py +++ b/py2n/__init__.py @@ -78,20 +78,21 @@ async def update(self) -> None: pySwitches = [] for switch in switches: - for caps in switch_caps: - if caps["switch"] == switch["switch"]: - enabled = caps["enabled"] - mode = caps["mode"] if enabled else None - break - pySwitches.append( - Py2NDeviceSwitch( - id= switch["switch"], - enabled= enabled, - active= switch["active"], - locked=switch["locked"], - mode=mode, + if switch['active']: + for caps in switch_caps: + if caps["switch"] == switch["switch"]: + enabled = caps["enabled"] + mode = caps["mode"] if enabled else None + break + pySwitches.append( + Py2NDeviceSwitch( + id= switch["switch"], + enabled= enabled, + active= switch["active"], + locked=switch["locked"], + mode=mode, + ) ) - ) ports = await get_ports(self.aiohttp_session, self.options)