diff --git a/.gitignore b/.gitignore index fe26f43e8bc412..0d55cae3c9df19 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,9 @@ Icon # Thumbnails ._* +# IntelliJ IDEA .idea +*.iml # pytest .cache diff --git a/homeassistant/components/camera/xeoma.py b/homeassistant/components/camera/xeoma.py index 72f40cb83a4f37..b4bcad0064d689 100755 --- a/homeassistant/components/camera/xeoma.py +++ b/homeassistant/components/camera/xeoma.py @@ -14,7 +14,7 @@ CONF_HOST, CONF_NAME, CONF_PASSWORD, CONF_USERNAME) from homeassistant.helpers import config_validation as cv -REQUIREMENTS = ['pyxeoma==1.2'] +REQUIREMENTS = ['pyxeoma==1.3'] _LOGGER = logging.getLogger(__name__) @@ -22,6 +22,8 @@ CONF_HIDE = 'hide' CONF_IMAGE_NAME = 'image_name' CONF_NEW_VERSION = 'new_version' +CONF_VIEWER_PASSWORD = 'viewer_password' +CONF_VIEWER_USERNAME = 'viewer_username' CAMERAS_SCHEMA = vol.Schema({ vol.Required(CONF_IMAGE_NAME): cv.string, @@ -48,9 +50,8 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None): host = config[CONF_HOST] login = config.get(CONF_USERNAME) password = config.get(CONF_PASSWORD) - new_version = config[CONF_NEW_VERSION] - xeoma = Xeoma(host, new_version, login, password) + xeoma = Xeoma(host, login, password) try: yield from xeoma.async_test_connection() @@ -59,9 +60,12 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None): { CONF_IMAGE_NAME: image_name, CONF_HIDE: False, - CONF_NAME: image_name + CONF_NAME: image_name, + CONF_VIEWER_USERNAME: username, + CONF_VIEWER_PASSWORD: pw + } - for image_name in discovered_image_names + for image_name, username, pw in discovered_image_names ] for cam in config[CONF_CAMERAS]: @@ -77,8 +81,9 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None): cameras = list(filter(lambda c: not c[CONF_HIDE], discovered_cameras)) async_add_devices( - [XeomaCamera(xeoma, camera[CONF_IMAGE_NAME], camera[CONF_NAME]) - for camera in cameras]) + [XeomaCamera(xeoma, camera[CONF_IMAGE_NAME], camera[CONF_NAME], + camera[CONF_VIEWER_USERNAME], + camera[CONF_VIEWER_PASSWORD]) for camera in cameras]) except XeomaError as err: _LOGGER.error("Error: %s", err.message) return @@ -87,12 +92,14 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None): class XeomaCamera(Camera): """Implementation of a Xeoma camera.""" - def __init__(self, xeoma, image, name): + def __init__(self, xeoma, image, name, username, password): """Initialize a Xeoma camera.""" super().__init__() self._xeoma = xeoma self._name = name self._image = image + self._username = username + self._password = password self._last_image = None @asyncio.coroutine @@ -100,7 +107,8 @@ def async_camera_image(self): """Return a still image response from the camera.""" from pyxeoma.xeoma import XeomaError try: - image = yield from self._xeoma.async_get_camera_image(self._image) + image = yield from self._xeoma.async_get_camera_image( + self._image, self._username, self._password) self._last_image = image except XeomaError as err: _LOGGER.error("Error fetching image: %s", err.message) diff --git a/requirements_all.txt b/requirements_all.txt index 804409c946f371..6a1d1eeb59f6ef 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1015,7 +1015,7 @@ pywebpush==1.5.0 pywemo==0.4.25 # homeassistant.components.camera.xeoma -pyxeoma==1.2 +pyxeoma==1.3 # homeassistant.components.zabbix pyzabbix==0.7.4