From 8d9da4e7b921fe094a452c5db49574517e285fa7 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Wed, 10 Oct 2018 23:52:45 +0200 Subject: [PATCH] Upgrade construct to 2.9.45 (#16362) --- homeassistant/components/climate/eq3btsmart.py | 2 +- .../components/device_tracker/xiaomi_miio.py | 14 +++++++------- homeassistant/components/fan/xiaomi_miio.py | 12 ++++++------ homeassistant/components/light/xiaomi_miio.py | 17 ++++++++--------- homeassistant/components/remote/xiaomi_miio.py | 2 +- .../components/sensor/eddystone_temperature.py | 16 ++++++++-------- homeassistant/components/sensor/xiaomi_miio.py | 10 +++++----- homeassistant/components/switch/xiaomi_miio.py | 14 +++++++------- homeassistant/components/vacuum/xiaomi_miio.py | 2 +- requirements_all.txt | 2 +- 10 files changed, 45 insertions(+), 46 deletions(-) diff --git a/homeassistant/components/climate/eq3btsmart.py b/homeassistant/components/climate/eq3btsmart.py index eae7bc1d9b9..b88500f7fb2 100644 --- a/homeassistant/components/climate/eq3btsmart.py +++ b/homeassistant/components/climate/eq3btsmart.py @@ -15,7 +15,7 @@ from homeassistant.const import ( CONF_MAC, CONF_DEVICES, TEMP_CELSIUS, ATTR_TEMPERATURE, PRECISION_HALVES) import homeassistant.helpers.config_validation as cv -REQUIREMENTS = ['python-eq3bt==0.1.9', 'construct==2.9.41'] +REQUIREMENTS = ['python-eq3bt==0.1.9', 'construct==2.9.45'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/device_tracker/xiaomi_miio.py b/homeassistant/components/device_tracker/xiaomi_miio.py index 060849a3268..d8767a4cd46 100644 --- a/homeassistant/components/device_tracker/xiaomi_miio.py +++ b/homeassistant/components/device_tracker/xiaomi_miio.py @@ -8,10 +8,12 @@ import logging import voluptuous as vol +from homeassistant.components.device_tracker import ( + DOMAIN, PLATFORM_SCHEMA, DeviceScanner) +from homeassistant.const import CONF_HOST, CONF_TOKEN import homeassistant.helpers.config_validation as cv -from homeassistant.components.device_tracker import (DOMAIN, PLATFORM_SCHEMA, - DeviceScanner) -from homeassistant.const import (CONF_HOST, CONF_TOKEN) + +REQUIREMENTS = ['python-miio==0.4.2', 'construct==2.9.45'] _LOGGER = logging.getLogger(__name__) @@ -20,8 +22,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_TOKEN): vol.All(cv.string, vol.Length(min=32, max=32)), }) -REQUIREMENTS = ['python-miio==0.4.2', 'construct==2.9.41'] - def get_scanner(hass, config): """Return a Xiaomi MiIO device scanner.""" @@ -56,7 +56,7 @@ class XiaomiMiioDeviceScanner(DeviceScanner): self.device = device async def async_scan_devices(self): - """Scan for devices and return a list containing found device ids.""" + """Scan for devices and return a list containing found device IDs.""" from miio import DeviceException devices = [] @@ -68,7 +68,7 @@ class XiaomiMiioDeviceScanner(DeviceScanner): devices.append(device['mac']) except DeviceException as ex: - _LOGGER.error("Got exception while fetching the state: %s", ex) + _LOGGER.error("Unable to fetch the state: %s", ex) return devices diff --git a/homeassistant/components/fan/xiaomi_miio.py b/homeassistant/components/fan/xiaomi_miio.py index fdbf06818b9..67a12442629 100644 --- a/homeassistant/components/fan/xiaomi_miio.py +++ b/homeassistant/components/fan/xiaomi_miio.py @@ -11,13 +11,15 @@ import logging import voluptuous as vol -from homeassistant.components.fan import (FanEntity, PLATFORM_SCHEMA, - SUPPORT_SET_SPEED, DOMAIN, ) -from homeassistant.const import (CONF_NAME, CONF_HOST, CONF_TOKEN, - ATTR_ENTITY_ID, ) +from homeassistant.components.fan import ( + DOMAIN, PLATFORM_SCHEMA, SUPPORT_SET_SPEED, FanEntity) +from homeassistant.const import ( + ATTR_ENTITY_ID, CONF_HOST, CONF_NAME, CONF_TOKEN) from homeassistant.exceptions import PlatformNotReady import homeassistant.helpers.config_validation as cv +REQUIREMENTS = ['python-miio==0.4.2', 'construct==2.9.45'] + _LOGGER = logging.getLogger(__name__) DEFAULT_NAME = 'Xiaomi Miio Device' @@ -49,8 +51,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ 'zhimi.humidifier.ca1']), }) -REQUIREMENTS = ['python-miio==0.4.2', 'construct==2.9.41'] - ATTR_MODEL = 'model' # Air Purifier diff --git a/homeassistant/components/light/xiaomi_miio.py b/homeassistant/components/light/xiaomi_miio.py index ce1e504b54c..26a63b2f16b 100644 --- a/homeassistant/components/light/xiaomi_miio.py +++ b/homeassistant/components/light/xiaomi_miio.py @@ -5,23 +5,24 @@ For more details about this platform, please refer to the documentation https://home-assistant.io/components/light.xiaomi_miio/ """ import asyncio +import datetime +from datetime import timedelta from functools import partial import logging from math import ceil -from datetime import timedelta -import datetime import voluptuous as vol -import homeassistant.helpers.config_validation as cv from homeassistant.components.light import ( - PLATFORM_SCHEMA, ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, - ATTR_COLOR_TEMP, SUPPORT_COLOR_TEMP, Light, ATTR_ENTITY_ID, DOMAIN, ) - -from homeassistant.const import (CONF_NAME, CONF_HOST, CONF_TOKEN, ) + ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_ENTITY_ID, DOMAIN, PLATFORM_SCHEMA, + SUPPORT_BRIGHTNESS, SUPPORT_COLOR_TEMP, Light) +from homeassistant.const import CONF_HOST, CONF_NAME, CONF_TOKEN from homeassistant.exceptions import PlatformNotReady +import homeassistant.helpers.config_validation as cv from homeassistant.util import dt +REQUIREMENTS = ['python-miio==0.4.2', 'construct==2.9.45'] + _LOGGER = logging.getLogger(__name__) DEFAULT_NAME = 'Xiaomi Philips Light' @@ -43,8 +44,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ 'philips.light.mono1']), }) -REQUIREMENTS = ['python-miio==0.4.2', 'construct==2.9.41'] - # The light does not accept cct values < 1 CCT_MIN = 1 CCT_MAX = 100 diff --git a/homeassistant/components/remote/xiaomi_miio.py b/homeassistant/components/remote/xiaomi_miio.py index 6d82da9e9fd..5a914fc3652 100644 --- a/homeassistant/components/remote/xiaomi_miio.py +++ b/homeassistant/components/remote/xiaomi_miio.py @@ -22,7 +22,7 @@ from homeassistant.exceptions import PlatformNotReady import homeassistant.helpers.config_validation as cv from homeassistant.util.dt import utcnow -REQUIREMENTS = ['python-miio==0.4.2', 'construct==2.9.41'] +REQUIREMENTS = ['python-miio==0.4.2', 'construct==2.9.45'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/eddystone_temperature.py b/homeassistant/components/sensor/eddystone_temperature.py index ef362e17aa6..ae3d498d30c 100644 --- a/homeassistant/components/sensor/eddystone_temperature.py +++ b/homeassistant/components/sensor/eddystone_temperature.py @@ -11,14 +11,14 @@ import logging import voluptuous as vol -import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import ( - CONF_NAME, TEMP_CELSIUS, STATE_UNKNOWN, EVENT_HOMEASSISTANT_STOP, - EVENT_HOMEASSISTANT_START) + CONF_NAME, EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, + STATE_UNKNOWN, TEMP_CELSIUS) +import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.entity import Entity -REQUIREMENTS = ['beacontools[scan]==1.2.3', 'construct==2.9.41'] +REQUIREMENTS = ['beacontools[scan]==1.2.3', 'construct==2.9.45'] _LOGGER = logging.getLogger(__name__) @@ -43,12 +43,12 @@ def setup_platform(hass, config, add_entities, discovery_info=None): """Validate configuration, create devices and start monitoring thread.""" bt_device_id = config.get("bt_device_id") - beacons = config.get("beacons") + beacons = config.get(CONF_BEACONS) devices = [] for dev_name, properties in beacons.items(): - namespace = get_from_conf(properties, "namespace", 20) - instance = get_from_conf(properties, "instance", 12) + namespace = get_from_conf(properties, CONF_NAMESPACE, 20) + instance = get_from_conf(properties, CONF_INSTANCE, 12) name = properties.get(CONF_NAME, dev_name) if instance is None or namespace is None: diff --git a/homeassistant/components/sensor/xiaomi_miio.py b/homeassistant/components/sensor/xiaomi_miio.py index 4cdf166cf99..dd0785120ea 100644 --- a/homeassistant/components/sensor/xiaomi_miio.py +++ b/homeassistant/components/sensor/xiaomi_miio.py @@ -8,11 +8,13 @@ import logging import voluptuous as vol +from homeassistant.components.sensor import PLATFORM_SCHEMA +from homeassistant.const import CONF_HOST, CONF_NAME, CONF_TOKEN +from homeassistant.exceptions import PlatformNotReady import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import Entity -from homeassistant.components.sensor import PLATFORM_SCHEMA -from homeassistant.const import (CONF_NAME, CONF_HOST, CONF_TOKEN) -from homeassistant.exceptions import PlatformNotReady + +REQUIREMENTS = ['python-miio==0.4.2', 'construct==2.9.45'] _LOGGER = logging.getLogger(__name__) @@ -25,8 +27,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, }) -REQUIREMENTS = ['python-miio==0.4.2', 'construct==2.9.41'] - ATTR_POWER = 'power' ATTR_CHARGING = 'charging' ATTR_BATTERY_LEVEL = 'battery_level' diff --git a/homeassistant/components/switch/xiaomi_miio.py b/homeassistant/components/switch/xiaomi_miio.py index 2ac009f4334..0152615109c 100644 --- a/homeassistant/components/switch/xiaomi_miio.py +++ b/homeassistant/components/switch/xiaomi_miio.py @@ -10,12 +10,14 @@ import logging import voluptuous as vol -import homeassistant.helpers.config_validation as cv -from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA, - DOMAIN, ) -from homeassistant.const import (CONF_NAME, CONF_HOST, CONF_TOKEN, - ATTR_ENTITY_ID, ) +from homeassistant.components.switch import ( + DOMAIN, PLATFORM_SCHEMA, SwitchDevice) +from homeassistant.const import ( + ATTR_ENTITY_ID, CONF_HOST, CONF_NAME, CONF_TOKEN) from homeassistant.exceptions import PlatformNotReady +import homeassistant.helpers.config_validation as cv + +REQUIREMENTS = ['python-miio==0.4.2', 'construct==2.9.45'] _LOGGER = logging.getLogger(__name__) @@ -39,8 +41,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ 'chuangmi.plug.v3']), }) -REQUIREMENTS = ['python-miio==0.4.2', 'construct==2.9.41'] - ATTR_POWER = 'power' ATTR_TEMPERATURE = 'temperature' ATTR_LOAD_POWER = 'load_power' diff --git a/homeassistant/components/vacuum/xiaomi_miio.py b/homeassistant/components/vacuum/xiaomi_miio.py index 97a285f90f5..d1d45f5ecd2 100644 --- a/homeassistant/components/vacuum/xiaomi_miio.py +++ b/homeassistant/components/vacuum/xiaomi_miio.py @@ -21,7 +21,7 @@ from homeassistant.const import ( ATTR_ENTITY_ID, CONF_HOST, CONF_NAME, CONF_TOKEN, STATE_OFF, STATE_ON) import homeassistant.helpers.config_validation as cv -REQUIREMENTS = ['python-miio==0.4.2', 'construct==2.9.41'] +REQUIREMENTS = ['python-miio==0.4.2', 'construct==2.9.45'] _LOGGER = logging.getLogger(__name__) diff --git a/requirements_all.txt b/requirements_all.txt index 2ef85e05166..e0118145c4a 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -253,7 +253,7 @@ concord232==0.15 # homeassistant.components.sensor.xiaomi_miio # homeassistant.components.switch.xiaomi_miio # homeassistant.components.vacuum.xiaomi_miio -construct==2.9.41 +construct==2.9.45 # homeassistant.scripts.credstash # credstash==1.14.0