Clean up MjpegCamera by removing unnused hass object in __init__ (#16628)
This commit is contained in:
parent
00918af94d
commit
19514ea500
3 changed files with 6 additions and 6 deletions
|
@ -50,7 +50,7 @@ class AxisCamera(MjpegCamera):
|
|||
|
||||
def __init__(self, hass, config, port):
|
||||
"""Initialize Axis Communications camera component."""
|
||||
super().__init__(hass, config)
|
||||
super().__init__(config)
|
||||
self.port = port
|
||||
dispatcher_connect(
|
||||
hass, DOMAIN + '_' + config[CONF_NAME] + '_new_ip', self._new_ip)
|
||||
|
|
|
@ -47,7 +47,7 @@ def async_setup_platform(hass, config, async_add_entities,
|
|||
"""Set up a MJPEG IP Camera."""
|
||||
if discovery_info:
|
||||
config = PLATFORM_SCHEMA(discovery_info)
|
||||
async_add_entities([MjpegCamera(hass, config)])
|
||||
async_add_entities([MjpegCamera(config)])
|
||||
|
||||
|
||||
def extract_image_from_mjpeg(stream):
|
||||
|
@ -65,7 +65,7 @@ def extract_image_from_mjpeg(stream):
|
|||
class MjpegCamera(Camera):
|
||||
"""An implementation of an IP camera that is reachable over a URL."""
|
||||
|
||||
def __init__(self, hass, device_info):
|
||||
def __init__(self, device_info):
|
||||
"""Initialize a MJPEG camera."""
|
||||
super().__init__()
|
||||
self._name = device_info.get(CONF_NAME)
|
||||
|
|
|
@ -28,21 +28,21 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
cameras = []
|
||||
for monitor in monitors:
|
||||
_LOGGER.info("Initializing camera %s", monitor.id)
|
||||
cameras.append(ZoneMinderCamera(hass, monitor))
|
||||
cameras.append(ZoneMinderCamera(monitor))
|
||||
add_entities(cameras)
|
||||
|
||||
|
||||
class ZoneMinderCamera(MjpegCamera):
|
||||
"""Representation of a ZoneMinder Monitor Stream."""
|
||||
|
||||
def __init__(self, hass, monitor):
|
||||
def __init__(self, monitor):
|
||||
"""Initialize as a subclass of MjpegCamera."""
|
||||
device_info = {
|
||||
CONF_NAME: monitor.name,
|
||||
CONF_MJPEG_URL: monitor.mjpeg_image_url,
|
||||
CONF_STILL_IMAGE_URL: monitor.still_image_url
|
||||
}
|
||||
super().__init__(hass, device_info)
|
||||
super().__init__(device_info)
|
||||
self._is_recording = None
|
||||
self._monitor = monitor
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue