Skip to content

Commit

Permalink
Add error correction to detection sensibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
RenierM26 committed Feb 15, 2021
1 parent ca98990 commit 1af449e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions pyezviz/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def load(self):

def switch_status(self):
"""load device switches"""

if self._device.get("switchStatusInfos"):
for switch in self._device.get("switchStatusInfos"):
self._switch.update({switch["type"]: switch["enable"]})
Expand Down
11 changes: 4 additions & 7 deletions pyezviz/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,13 +722,10 @@ def get_detection_sensibility(self, serial, type_value="0", max_retries=0):
if response_json["resultCode"] != "0":
return "Unknown"

# Looks like 0 or 1 should return item 0
if type_value == "1":
return response_json["algorithmConfig"]["algorithmList"][0]["value"]

for idx in response_json["algorithmConfig"]["algorithmList"]:
if idx["type"] == type_value:
return idx["value"]
if response_json["algorithmConfig"]["algorithmList"]:
for idx in response_json["algorithmConfig"]["algorithmList"]:
if idx["type"] == type_value:
return idx["value"]

return "Unkown"

Expand Down
1 change: 1 addition & 0 deletions pyezviz/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class SensorType(Enum):
wan_ip = "None"
PIR_Status = "motion"


class BinarySensorType(Enum):
"""Binary_sensors and their types to expose in HA"""

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name='pyezviz',
version="0.1.7.0",
version="0.1.7.1",
license='Apache Software License 2.0',
author='Pierre Ourdouille',
author_email='[email protected]',
Expand Down

0 comments on commit 1af449e

Please sign in to comment.