Add condition for API failure (#7181)
* Add condition for API failure If you are not running the latest ve3rsion of ZM this will cause exceptions to fire. This fix handles a response from ZM but a non successful attempt. This resolves the issue https://github.com/home-assistant/home-assistant/issues/7178 * Fixed houndci-bot issuespull/7175/head^2
parent
921760f8c1
commit
2f4b2ddc0a
|
@ -101,11 +101,17 @@ class ZoneMinderCamera(MjpegCamera):
|
||||||
status_response = zoneminder.get_state(
|
status_response = zoneminder.get_state(
|
||||||
'api/monitors/alarm/id:%i/command:status.json' % self._monitor_id
|
'api/monitors/alarm/id:%i/command:status.json' % self._monitor_id
|
||||||
)
|
)
|
||||||
|
|
||||||
if not status_response:
|
if not status_response:
|
||||||
_LOGGER.warning('Could not get status for monitor %i',
|
_LOGGER.warning('Could not get status for monitor %i',
|
||||||
self._monitor_id)
|
self._monitor_id)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if status_response['success'] is False:
|
||||||
|
_LOGGER.warning('Alarm status API call failed for monitor %i',
|
||||||
|
self._monitor_id)
|
||||||
|
return
|
||||||
|
|
||||||
self._is_recording = status_response['status'] == ZM_STATE_ALARM
|
self._is_recording = status_response['status'] == ZM_STATE_ALARM
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
Loading…
Reference in New Issue