Пример #1
0
async def async_setup_entry(hass, config_entry, async_add_entities):
    """Set up the Axis camera video stream."""
    filter_urllib3_logging()

    serial_number = config_entry.data[CONF_MAC]
    device = hass.data[AXIS_DOMAIN][serial_number]

    config = {
        CONF_NAME:
        config_entry.data[CONF_NAME],
        CONF_USERNAME:
        config_entry.data[CONF_DEVICE][CONF_USERNAME],
        CONF_PASSWORD:
        config_entry.data[CONF_DEVICE][CONF_PASSWORD],
        CONF_MJPEG_URL:
        AXIS_VIDEO.format(
            config_entry.data[CONF_DEVICE][CONF_HOST],
            config_entry.data[CONF_DEVICE][CONF_PORT],
        ),
        CONF_STILL_IMAGE_URL:
        AXIS_IMAGE.format(
            config_entry.data[CONF_DEVICE][CONF_HOST],
            config_entry.data[CONF_DEVICE][CONF_PORT],
        ),
        CONF_AUTHENTICATION:
        HTTP_DIGEST_AUTHENTICATION,
    }
    async_add_entities([AxisCamera(config, device)])
Пример #2
0
async def async_setup_entry(hass, config_entry, async_add_entities):
    """Set up the Axis camera video stream."""
    filter_urllib3_logging()

    device = hass.data[AXIS_DOMAIN][config_entry.unique_id]

    if not device.option_camera:
        return

    config = {
        CONF_NAME:
        config_entry.data[CONF_NAME],
        CONF_USERNAME:
        config_entry.data[CONF_USERNAME],
        CONF_PASSWORD:
        config_entry.data[CONF_PASSWORD],
        CONF_MJPEG_URL:
        AXIS_VIDEO.format(
            host=config_entry.data[CONF_HOST],
            port=config_entry.data[CONF_PORT],
        ),
        CONF_STILL_IMAGE_URL:
        AXIS_IMAGE.format(
            host=config_entry.data[CONF_HOST],
            port=config_entry.data[CONF_PORT],
        ),
        CONF_AUTHENTICATION:
        HTTP_DIGEST_AUTHENTICATION,
    }
    async_add_entities([AxisCamera(config, device)])
Пример #3
0
async def async_setup_entry(hass, config_entry, async_add_entities):
    """Set up the Axis camera video stream."""
    filter_urllib3_logging()

    device = hass.data[AXIS_DOMAIN][config_entry.unique_id]

    if not device.api.vapix.params.image_format:
        return

    async_add_entities([AxisCamera(device)])
Пример #4
0
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the ZoneMinder cameras."""
    filter_urllib3_logging()
    cameras = []
    for zm_client in hass.data[ZONEMINDER_DOMAIN].values():
        if not (monitors := zm_client.get_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))
Пример #5
0
async def async_setup_entry(
    hass: HomeAssistant,
    config_entry: ConfigEntry,
    async_add_entities: AddEntitiesCallback,
) -> None:
    """Set up the Axis camera video stream."""
    filter_urllib3_logging()

    device = hass.data[AXIS_DOMAIN][config_entry.unique_id]

    if not device.api.vapix.params.image_format:
        return

    async_add_entities([AxisCamera(device)])
Пример #6
0
def setup_platform(
    hass: HomeAssistant,
    config: ConfigType,
    add_entities: AddEntitiesCallback,
    discovery_info: DiscoveryInfoType | None = None,
) -> None:
    """Set up the ZoneMinder cameras."""
    filter_urllib3_logging()
    cameras = []
    for zm_client in hass.data[ZONEMINDER_DOMAIN].values():
        if not (monitors := zm_client.get_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))
Пример #7
0
async def async_setup_entry(hass, config_entry, async_add_entities):
    """Set up the Axis camera video stream."""
    filter_urllib3_logging()

    serial_number = config_entry.data[CONF_MAC]
    device = hass.data[AXIS_DOMAIN][serial_number]

    config = {
        CONF_NAME: config_entry.data[CONF_NAME],
        CONF_USERNAME: config_entry.data[CONF_DEVICE][CONF_USERNAME],
        CONF_PASSWORD: config_entry.data[CONF_DEVICE][CONF_PASSWORD],
        CONF_MJPEG_URL: AXIS_VIDEO.format(
            config_entry.data[CONF_DEVICE][CONF_HOST],
            config_entry.data[CONF_DEVICE][CONF_PORT]),
        CONF_STILL_IMAGE_URL: AXIS_IMAGE.format(
            config_entry.data[CONF_DEVICE][CONF_HOST],
            config_entry.data[CONF_DEVICE][CONF_PORT]),
        CONF_AUTHENTICATION: HTTP_DIGEST_AUTHENTICATION,
    }
    async_add_entities([AxisCamera(config, device)])
Пример #8
0
async def async_setup_entry(
    hass, config_entry, async_add_entities, discovery_info=None
):
    """Set up the Agent cameras."""
    filter_urllib3_logging()
    cameras = []

    server = hass.data[AGENT_DOMAIN][config_entry.entry_id][CONNECTION]
    if not server.devices:
        _LOGGER.warning("Could not fetch cameras from Agent server")
        return

    for device in server.devices:
        if device.typeID == 2:
            camera = AgentCamera(device)
            cameras.append(camera)

    async_add_entities(cameras)

    platform = entity_platform.async_get_current_platform()
    for service, method in CAMERA_SERVICES.items():
        platform.async_register_entity_service(service, {}, method)
Пример #9
0
async def async_setup_entry(hass, config_entry, async_add_entities):
    """Set up the Axis camera video stream."""
    filter_urllib3_logging()

    device = hass.data[AXIS_DOMAIN][config_entry.unique_id]

    config = {
        CONF_NAME:
        config_entry.data[CONF_NAME],
        CONF_USERNAME:
        config_entry.data[CONF_USERNAME],
        CONF_PASSWORD:
        config_entry.data[CONF_PASSWORD],
        CONF_MJPEG_URL:
        (f"http://{config_entry.data[CONF_HOST]}"
         f":{config_entry.data[CONF_PORT]}/axis-cgi/mjpg/video.cgi"),
        CONF_STILL_IMAGE_URL:
        (f"http://{config_entry.data[CONF_HOST]}"
         f":{config_entry.data[CONF_PORT]}/axis-cgi/jpg/image.cgi"),
        CONF_AUTHENTICATION:
        HTTP_DIGEST_AUTHENTICATION,
    }
    async_add_entities([AxisCamera(config, device)])