Skip to content

Commit

Permalink
feat(nexa): simplify version checking (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersevenrud committed Apr 10, 2024
1 parent 4ce3b91 commit e175ab5
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions custom_components/nexa_bridge_x/nexa.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,15 +313,18 @@ async def test_connection(self) -> NexaInfoData:
if key not in result:
raise NexaApiNotCompatibleError("Device response invalid")

check_type = self.legacy and "Bridge1" or "Bridge2"
check_ver = self.legacy and "1" or "2"

if result["systemType"] != check_type:
raise NexaApiNotCompatibleError("Device system not compatible")

if result["systemType"] not in ["Bridge1", "Bridge2"]:
raise NexaApiNotCompatibleError("Device system not compatible")

#check_type = self.legacy and "Bridge1" or "Bridge2"
#check_ver = self.legacy and "1" or "2"
#
#if result["systemType"] != check_type:
# raise NexaApiNotCompatibleError("Device system not compatible")
#
# TODO: Add semver check in the future if there are firmware diffs
if not str(result["version"]).startswith(check_ver):
raise NexaApiNotCompatibleError("Endpoint not compatible")
#if not str(result["version"]).startswith(check_ver):
# raise NexaApiNotCompatibleError("Endpoint not compatible")

return result

Expand Down

0 comments on commit e175ab5

Please sign in to comment.