Skip to content

Commit

Permalink
Merge pull request #56 from nabbi/monitor-non-int-status
Browse files Browse the repository at this point in the history
Monitor status might not be an int
  • Loading branch information
nabbi authored Dec 31, 2023
2 parents 8e2efda + bfe7c5f commit 11e22fb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions zoneminder/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,10 @@ def is_recording(self) -> Optional[bool]:
status = status_response.get("status")
# ZoneMinder API returns an empty string to indicate that this monitor
# cannot record right now
if status == "":
try:
return int(status) == STATE_ALARM
except ValueError:
return False
return int(status) == STATE_ALARM

@property
def is_available(self) -> bool:
Expand Down

0 comments on commit 11e22fb

Please sign in to comment.