Add support for connecting to multiple zoneminder instances (#19955)
* Add support for connecting to multiple zoneminder instances * Lint * Lint * Clean up and better error handling * Fix config validation * Lint
This commit is contained in:
1 parent
fe93ea9bdf
commit
bc30491dc0
4 files changed
+78
-54
No files matched your search
@@ -19,17 +19,18 @@ DEPENDENCIES = ['zoneminder']
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
"""Set up the ZoneMinder cameras."""
|
||||
filter_urllib3_logging()
|
||||
zm_client = hass.data[ZONEMINDER_DOMAIN]
|
||||
|
||||
monitors = zm_client.get_monitors()
|
||||
if not monitors:
|
||||
_LOGGER.warning("Could not fetch monitors from ZoneMinder")
|
||||
return
|
||||
|
||||
cameras = []
|
||||
for monitor in monitors:
|
||||
_LOGGER.info("Initializing camera %s", monitor.id)
|
||||
cameras.append(ZoneMinderCamera(monitor, zm_client.verify_ssl))
|
||||
for zm_client in hass.data[ZONEMINDER_DOMAIN].values():
|
||||
monitors = zm_client.get_monitors()
|
||||
if not monitors:
|
||||
_LOGGER.warning(
|
||||
"Could not fetch monitors from ZoneMinder host: %s"
|
||||
)
|
||||
return
|
||||
|
||||
for monitor in monitors:
|
||||
_LOGGER.info("Initializing camera %s", monitor.id)
|
||||
cameras.append(ZoneMinderCamera(monitor, zm_client.verify_ssl))
|
||||
add_entities(cameras)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user