Switched to async/await. Bumped pyxeoma version (#13404)

This commit is contained in:
Jerad Meisner 2018-03-23 10:22:01 -07:00 committed by Paulus Schoutsen
parent 23165cbd1a
commit 8852e52601
2 changed files with 8 additions and 10 deletions

View File

@ -4,7 +4,6 @@ Support for Xeoma Cameras.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/camera.xeoma/ https://home-assistant.io/components/camera.xeoma/
""" """
import asyncio
import logging import logging
import voluptuous as vol import voluptuous as vol
@ -14,7 +13,7 @@ from homeassistant.const import (
CONF_HOST, CONF_NAME, CONF_PASSWORD, CONF_USERNAME) CONF_HOST, CONF_NAME, CONF_PASSWORD, CONF_USERNAME)
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
REQUIREMENTS = ['pyxeoma==1.3'] REQUIREMENTS = ['pyxeoma==1.4.0']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -41,8 +40,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
}) })
@asyncio.coroutine async def async_setup_platform(hass, config, async_add_devices,
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): discovery_info=None):
"""Discover and setup Xeoma Cameras.""" """Discover and setup Xeoma Cameras."""
from pyxeoma.xeoma import Xeoma, XeomaError from pyxeoma.xeoma import Xeoma, XeomaError
@ -53,8 +52,8 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
xeoma = Xeoma(host, login, password) xeoma = Xeoma(host, login, password)
try: try:
yield from xeoma.async_test_connection() await xeoma.async_test_connection()
discovered_image_names = yield from xeoma.async_get_image_names() discovered_image_names = await xeoma.async_get_image_names()
discovered_cameras = [ discovered_cameras = [
{ {
CONF_IMAGE_NAME: image_name, CONF_IMAGE_NAME: image_name,
@ -103,12 +102,11 @@ class XeomaCamera(Camera):
self._password = password self._password = password
self._last_image = None self._last_image = None
@asyncio.coroutine async def async_camera_image(self):
def async_camera_image(self):
"""Return a still image response from the camera.""" """Return a still image response from the camera."""
from pyxeoma.xeoma import XeomaError from pyxeoma.xeoma import XeomaError
try: try:
image = yield from self._xeoma.async_get_camera_image( image = await self._xeoma.async_get_camera_image(
self._image, self._username, self._password) self._image, self._username, self._password)
self._last_image = image self._last_image = image
except XeomaError as err: except XeomaError as err:

View File

@ -1048,7 +1048,7 @@ pywebpush==1.6.0
pywemo==0.4.25 pywemo==0.4.25
# homeassistant.components.camera.xeoma # homeassistant.components.camera.xeoma
pyxeoma==1.3 pyxeoma==1.4.0
# homeassistant.components.zabbix # homeassistant.components.zabbix
pyzabbix==0.7.4 pyzabbix==0.7.4