Skip to content

Commit

Permalink
Clean up MjpegCamera by removing unnused hass object in __init__ (#16628
Browse files Browse the repository at this point in the history
)
  • Loading branch information
rohankapoorcom authored and MartinHjelmare committed Sep 15, 2018
1 parent 00918af commit 19514ea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/camera/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/camera/mjpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/camera/zoneminder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 19514ea

Please sign in to comment.