Skip to content

Commit 3d144b8

Browse files
authored
Change how inactive systems are detected (#383)
* Change how inactive systems are detected * Another check
1 parent 9df39e4 commit 3d144b8

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

simplipy/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ async def async_get_systems(self) -> dict[int, SystemV2 | SystemV3]:
348348
await self.async_update_subscription_data()
349349

350350
for sid, subscription in self.subscription_data.items():
351-
if not subscription["status"]["isActive"]:
351+
if subscription["activated"] == 0 or not subscription["status"]["isActive"]:
352352
LOGGER.info("Skipping inactive subscription: %s", sid)
353353
continue
354354

@@ -357,7 +357,7 @@ async def async_get_systems(self) -> dict[int, SystemV2 | SystemV3]:
357357
continue
358358

359359
system: SystemV2 | SystemV3
360-
if (_ := subscription["location"]["system"]["version"]) == 2:
360+
if subscription["location"]["system"]["version"] == 2:
361361
system = SystemV2(self, sid)
362362
else:
363363
system = SystemV3(self, sid)

tests/system/test_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async def test_deactivated_system(
3434
authenticated_simplisafe_server: A authenticated API connection.
3535
subscriptions_response: An API response payload.
3636
"""
37-
subscriptions_response["subscriptions"][0]["status"]["isActive"] = False
37+
subscriptions_response["subscriptions"][0]["activated"] = 0
3838

3939
async with authenticated_simplisafe_server:
4040
authenticated_simplisafe_server.add(

0 commit comments

Comments
 (0)