Tons of ZoneMinder API errors

I’m not really sure how long this has been going on, but I had some issues with hass going unresponsive yesterday and today, and my homeassistant.log file is absolutely chock-a-block with variations on this theme (roughly once per minute):

2018-11-01 21:41:55 ERROR (SyncWorker_55) [zoneminder.zm] Unable to get API response from ZoneMinder
2018-11-01 21:41:55 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.run_state fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
await self.async_device_update()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/sensor/zoneminder.py", line 140, in update
self._state = self._client.get_active_state()
  File "/usr/local/lib/python3.6/site-packages/zoneminder/zm.py", line 130, in get_active_state
for state in self.get_run_states():
  File "/usr/local/lib/python3.6/site-packages/zoneminder/zm.py", line 121, in get_run_states
for i in raw_states['states']:
KeyError: 'states'

My six cameras all show up in the Hass interface, but I get all empty results in the sensors (run state, events in last hour for each camera). As far as I can recall, these sensors were working a couple of days ago. I am running hass.io 0.81.2.

My ZoneMinder v1.32.2 setup is a separate physical machine running Ubuntu 18.04 reverse proxy’d by an Apache instance running on the physical machine running Hass.

Apache proxies Hass and ZM on the same machine, with separate domains for each, both with valid SSL.

did you check the ZM logs? any crashes? I had this happen a couple of times, but something caused ZM to change state from ‘Running’ to ‘Stopped’ - changing back to running fixed it.

I didn’t check the logs, but I rebooted the ZoneMinder machine. My log file is still full of error messages and the ZoneMinder sensors aren’t working.

The same problem with ZoneMinder v1.36.33 installed on the same host with Home Assistant