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
https://home-assistant.io/components/camera.xeoma/
"""
import asyncio
import logging
import voluptuous as vol
@ -14,7 +13,7 @@ from homeassistant.const import (
CONF_HOST, CONF_NAME, CONF_PASSWORD, CONF_USERNAME)
from homeassistant.helpers import config_validation as cv
REQUIREMENTS = ['pyxeoma==1.3']
REQUIREMENTS = ['pyxeoma==1.4.0']
_LOGGER = logging.getLogger(__name__)
@ -41,8 +40,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
})
@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
async def async_setup_platform(hass, config, async_add_devices,
discovery_info=None):
"""Discover and setup Xeoma Cameras."""
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)
try:
yield from xeoma.async_test_connection()
discovered_image_names = yield from xeoma.async_get_image_names()
await xeoma.async_test_connection()
discovered_image_names = await xeoma.async_get_image_names()
discovered_cameras = [
{
CONF_IMAGE_NAME: image_name,
@ -103,12 +102,11 @@ class XeomaCamera(Camera):
self._password = password
self._last_image = None
@asyncio.coroutine
def async_camera_image(self):
async 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(
image = await self._xeoma.async_get_camera_image(
self._image, self._username, self._password)
self._last_image = image
except XeomaError as err:

View file

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