From 2d2c6cf4a191679ff1cbe19228e96a09c3bd2dd8 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 19 Feb 2019 14:09:06 +0100 Subject: [PATCH] Use constants from const.py (#21068) * Use constants from const.py * Fix lint issues --- homeassistant/components/insteon/__init__.py | 17 +++----- .../components/insteon/binary_sensor.py | 36 +++++++--------- homeassistant/components/insteon/cover.py | 17 +++----- homeassistant/components/insteon/fan.py | 42 ++++++++----------- homeassistant/components/insteon/light.py | 11 ++--- homeassistant/components/insteon/sensor.py | 11 ++--- homeassistant/components/insteon/switch.py | 13 ++---- homeassistant/components/knx/binary_sensor.py | 13 ++---- homeassistant/components/knx/climate.py | 33 +++++++-------- homeassistant/components/knx/light.py | 10 ++--- homeassistant/components/knx/notify.py | 9 ++-- homeassistant/components/knx/scene.py | 3 +- homeassistant/components/knx/sensor.py | 5 +-- homeassistant/components/knx/switch.py | 3 +- .../components/light/rpi_gpio_pwm.py | 16 +++---- .../components/raspihats/__init__.py | 1 - .../components/raspihats/binary_sensor.py | 6 +-- homeassistant/components/raspihats/switch.py | 7 ++-- homeassistant/components/sensor/etherscan.py | 12 ++---- homeassistant/components/sensor/ripple.py | 12 ++---- homeassistant/components/sensor/sochain.py | 16 +++---- 21 files changed, 105 insertions(+), 188 deletions(-) diff --git a/homeassistant/components/insteon/__init__.py b/homeassistant/components/insteon/__init__.py index e82e47dc5f4..a462ac0f63e 100644 --- a/homeassistant/components/insteon/__init__.py +++ b/homeassistant/components/insteon/__init__.py @@ -1,22 +1,16 @@ -""" -Support for INSTEON Modems (PLM and Hub). - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/insteon/ -""" +"""Support for INSTEON Modems (PLM and Hub).""" import collections import logging from typing import Dict import voluptuous as vol -import homeassistant.helpers.config_validation as cv -from homeassistant.const import (CONF_PORT, EVENT_HOMEASSISTANT_STOP, - CONF_PLATFORM, - CONF_ENTITY_ID, - CONF_HOST) +from homeassistant.const import ( + CONF_ADDRESS, CONF_ENTITY_ID, CONF_HOST, CONF_PLATFORM, CONF_PORT, + EVENT_HOMEASSISTANT_STOP) from homeassistant.core import callback from homeassistant.helpers import discovery +import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import Entity REQUIREMENTS = ['insteonplm==0.15.2'] @@ -31,7 +25,6 @@ CONF_HUB_PASSWORD = 'password' CONF_HUB_VERSION = 'hub_version' CONF_OVERRIDE = 'device_override' CONF_PLM_HUB_MSG = 'Must configure either a PLM port or a Hub host' -CONF_ADDRESS = 'address' CONF_CAT = 'cat' CONF_SUBCAT = 'subcat' CONF_FIRMWARE = 'firmware' diff --git a/homeassistant/components/insteon/binary_sensor.py b/homeassistant/components/insteon/binary_sensor.py index 5b0a291e92b..06eddb9a004 100644 --- a/homeassistant/components/insteon/binary_sensor.py +++ b/homeassistant/components/insteon/binary_sensor.py @@ -1,29 +1,26 @@ -""" -Support for INSTEON dimmers via PowerLinc Modem. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/binary_sensor.insteon/ -""" +"""Support for INSTEON dimmers via PowerLinc Modem.""" import logging from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.insteon import InsteonEntity -DEPENDENCIES = ['insteon'] - _LOGGER = logging.getLogger(__name__) -SENSOR_TYPES = {'openClosedSensor': 'opening', - 'ioLincSensor': 'opening', - 'motionSensor': 'motion', - 'doorSensor': 'door', - 'wetLeakSensor': 'moisture', - 'lightSensor': 'light', - 'batterySensor': 'battery'} +DEPENDENCIES = ['insteon'] + +SENSOR_TYPES = { + 'openClosedSensor': 'opening', + 'ioLincSensor': 'opening', + 'motionSensor': 'motion', + 'doorSensor': 'door', + 'wetLeakSensor': 'moisture', + 'lightSensor': 'light', + 'batterySensor': 'battery', +} -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up the INSTEON device class for the hass platform.""" insteon_modem = hass.data['insteon'].get('modem') @@ -32,7 +29,7 @@ async def async_setup_platform(hass, config, async_add_entities, state_key = discovery_info['state_key'] name = device.states[state_key].name if name != 'dryLeakSensor': - _LOGGER.debug('Adding device %s entity %s to Binary Sensor platform', + _LOGGER.debug("Adding device %s entity %s to Binary Sensor platform", device.address.hex, device.states[state_key].name) new_entity = InsteonBinarySensor(device, state_key) @@ -58,8 +55,7 @@ class InsteonBinarySensor(InsteonEntity, BinarySensorDevice): """Return the boolean response if the node is on.""" on_val = bool(self._insteon_device_state.value) - if self._insteon_device_state.name in ['lightSensor', - 'ioLincSensor']: + if self._insteon_device_state.name in ['lightSensor', 'ioLincSensor']: return not on_val return on_val diff --git a/homeassistant/components/insteon/cover.py b/homeassistant/components/insteon/cover.py index f0cf93c13e9..7de2e872489 100644 --- a/homeassistant/components/insteon/cover.py +++ b/homeassistant/components/insteon/cover.py @@ -1,16 +1,11 @@ -""" -Support for Insteon covers via PowerLinc Modem. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/cover.insteon/ -""" +"""Support for Insteon covers via PowerLinc Modem.""" import logging import math +from homeassistant.components.cover import ( + ATTR_POSITION, SUPPORT_CLOSE, SUPPORT_OPEN, SUPPORT_SET_POSITION, + CoverDevice) from homeassistant.components.insteon import InsteonEntity -from homeassistant.components.cover import (CoverDevice, ATTR_POSITION, - SUPPORT_OPEN, SUPPORT_CLOSE, - SUPPORT_SET_POSITION) _LOGGER = logging.getLogger(__name__) @@ -18,8 +13,8 @@ DEPENDENCIES = ['insteon'] SUPPORTED_FEATURES = SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_SET_POSITION -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up the Insteon platform.""" if not discovery_info: return diff --git a/homeassistant/components/insteon/fan.py b/homeassistant/components/insteon/fan.py index 604063a9aa3..2b6097a4ba2 100644 --- a/homeassistant/components/insteon/fan.py +++ b/homeassistant/components/insteon/fan.py @@ -1,34 +1,28 @@ -""" -Support for INSTEON fans via PowerLinc Modem. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/fan.insteon/ -""" +"""Support for INSTEON fans via PowerLinc Modem.""" import logging -from homeassistant.components.fan import (SPEED_OFF, - SPEED_LOW, - SPEED_MEDIUM, - SPEED_HIGH, - FanEntity, - SUPPORT_SET_SPEED) -from homeassistant.const import STATE_OFF +from homeassistant.components.fan import ( + SPEED_HIGH, SPEED_LOW, SPEED_MEDIUM, SPEED_OFF, SUPPORT_SET_SPEED, + FanEntity) from homeassistant.components.insteon import InsteonEntity - -DEPENDENCIES = ['insteon'] - -SPEED_TO_HEX = {SPEED_OFF: 0x00, - SPEED_LOW: 0x3f, - SPEED_MEDIUM: 0xbe, - SPEED_HIGH: 0xff} - -FAN_SPEEDS = [STATE_OFF, SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH] +from homeassistant.const import STATE_OFF _LOGGER = logging.getLogger(__name__) +DEPENDENCIES = ['insteon'] -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +SPEED_TO_HEX = { + SPEED_OFF: 0x00, + SPEED_LOW: 0x3f, + SPEED_MEDIUM: 0xbe, + SPEED_HIGH: 0xff, +} + +FAN_SPEEDS = [STATE_OFF, SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH] + + +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up the INSTEON device class for the hass platform.""" insteon_modem = hass.data['insteon'].get('modem') diff --git a/homeassistant/components/insteon/light.py b/homeassistant/components/insteon/light.py index 4829ce631a6..e8ffc226716 100644 --- a/homeassistant/components/insteon/light.py +++ b/homeassistant/components/insteon/light.py @@ -1,9 +1,4 @@ -""" -Support for Insteon lights via PowerLinc Modem. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/light.insteon/ -""" +"""Support for Insteon lights via PowerLinc Modem.""" import logging from homeassistant.components.insteon import InsteonEntity @@ -17,8 +12,8 @@ DEPENDENCIES = ['insteon'] MAX_BRIGHTNESS = 255 -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up the Insteon component.""" insteon_modem = hass.data['insteon'].get('modem') diff --git a/homeassistant/components/insteon/sensor.py b/homeassistant/components/insteon/sensor.py index 7854967395b..d895d972027 100644 --- a/homeassistant/components/insteon/sensor.py +++ b/homeassistant/components/insteon/sensor.py @@ -1,9 +1,4 @@ -""" -Support for INSTEON dimmers via PowerLinc Modem. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/sensor.insteon/ -""" +"""Support for INSTEON dimmers via PowerLinc Modem.""" import logging from homeassistant.components.insteon import InsteonEntity @@ -14,8 +9,8 @@ DEPENDENCIES = ['insteon'] _LOGGER = logging.getLogger(__name__) -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up the INSTEON device class for the hass platform.""" insteon_modem = hass.data['insteon'].get('modem') diff --git a/homeassistant/components/insteon/switch.py b/homeassistant/components/insteon/switch.py index 454b3ef39cb..2a6b97a39d1 100644 --- a/homeassistant/components/insteon/switch.py +++ b/homeassistant/components/insteon/switch.py @@ -1,9 +1,4 @@ -""" -Support for INSTEON dimmers via PowerLinc Modem. - -For more details about this component, please refer to the documentation at -https://home-assistant.io/components/switch.insteon/ -""" +"""Support for INSTEON dimmers via PowerLinc Modem.""" import logging from homeassistant.components.insteon import InsteonEntity @@ -14,8 +9,8 @@ DEPENDENCIES = ['insteon'] _LOGGER = logging.getLogger(__name__) -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up the INSTEON device class for the hass platform.""" insteon_modem = hass.data['insteon'].get('modem') @@ -25,7 +20,7 @@ async def async_setup_platform(hass, config, async_add_entities, state_name = device.states[state_key].name - _LOGGER.debug('Adding device %s entity %s to Switch platform', + _LOGGER.debug("Adding device %s entity %s to Switch platform", device.address.hex, device.states[state_key].name) new_entity = None diff --git a/homeassistant/components/knx/binary_sensor.py b/homeassistant/components/knx/binary_sensor.py index ca7037fe81d..c84e5820f04 100644 --- a/homeassistant/components/knx/binary_sensor.py +++ b/homeassistant/components/knx/binary_sensor.py @@ -5,12 +5,10 @@ from homeassistant.components.binary_sensor import ( PLATFORM_SCHEMA, BinarySensorDevice) from homeassistant.components.knx import ( ATTR_DISCOVER_DEVICES, DATA_KNX, KNXAutomation) -from homeassistant.const import CONF_NAME +from homeassistant.const import CONF_ADDRESS, CONF_DEVICE_CLASS, CONF_NAME from homeassistant.core import callback import homeassistant.helpers.config_validation as cv -CONF_ADDRESS = 'address' -CONF_DEVICE_CLASS = 'device_class' CONF_SIGNIFICANT_BIT = 'significant_bit' CONF_DEFAULT_SIGNIFICANT_BIT = 1 CONF_AUTOMATION = 'automation' @@ -32,10 +30,7 @@ AUTOMATION_SCHEMA = vol.Schema({ vol.Required(CONF_ACTION): cv.SCRIPT_SCHEMA, }) -AUTOMATIONS_SCHEMA = vol.All( - cv.ensure_list, - [AUTOMATION_SCHEMA] -) +AUTOMATIONS_SCHEMA = vol.All(cv.ensure_list, [AUTOMATION_SCHEMA]) PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_ADDRESS): cv.string, @@ -48,8 +43,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ }) -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up binary sensor(s) for KNX platform.""" if discovery_info is not None: async_add_entities_discovery(hass, discovery_info, async_add_entities) diff --git a/homeassistant/components/knx/climate.py b/homeassistant/components/knx/climate.py index 7e172287d4d..96b9f2ea91f 100644 --- a/homeassistant/components/knx/climate.py +++ b/homeassistant/components/knx/climate.py @@ -1,17 +1,14 @@ """Support for KNX/IP climate devices.""" import voluptuous as vol -import homeassistant.helpers.config_validation as cv -from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA -from homeassistant.components.climate.const import ( - SUPPORT_ON_OFF, SUPPORT_OPERATION_MODE, - SUPPORT_TARGET_TEMPERATURE, STATE_HEAT, - STATE_IDLE, STATE_MANUAL, STATE_DRY, - STATE_FAN_ONLY, STATE_ECO) -from homeassistant.const import ( - ATTR_TEMPERATURE, CONF_NAME, TEMP_CELSIUS) -from homeassistant.core import callback -from homeassistant.components.knx import DATA_KNX, ATTR_DISCOVER_DEVICES +from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateDevice +from homeassistant.components.climate.const import ( + STATE_DRY, STATE_ECO, STATE_FAN_ONLY, STATE_HEAT, STATE_IDLE, STATE_MANUAL, + SUPPORT_ON_OFF, SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE) +from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX +from homeassistant.const import ATTR_TEMPERATURE, CONF_NAME, TEMP_CELSIUS +from homeassistant.core import callback +import homeassistant.helpers.config_validation as cv CONF_SETPOINT_SHIFT_ADDRESS = 'setpoint_shift_address' CONF_SETPOINT_SHIFT_STATE_ADDRESS = 'setpoint_shift_state_address' @@ -81,15 +78,15 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Optional(CONF_OPERATION_MODE_COMFORT_ADDRESS): cv.string, vol.Optional(CONF_ON_OFF_ADDRESS): cv.string, vol.Optional(CONF_ON_OFF_STATE_ADDRESS): cv.string, - vol.Optional(CONF_OPERATION_MODES): vol.All(cv.ensure_list, - [vol.In(OPERATION_MODES)]), + vol.Optional(CONF_OPERATION_MODES): + vol.All(cv.ensure_list, [vol.In(OPERATION_MODES)]), vol.Optional(CONF_MIN_TEMP): vol.Coerce(float), vol.Optional(CONF_MAX_TEMP): vol.Coerce(float), }) -async def async_setup_platform(hass, config, async_add_entities, - discovery_info=None): +async def async_setup_platform( + hass, config, async_add_entities, discovery_info=None): """Set up climate(s) for KNX platform.""" if discovery_info is not None: async_add_entities_discovery(hass, discovery_info, async_add_entities) @@ -148,10 +145,8 @@ def async_add_entities_config(hass, config, async_add_entities): setpoint_shift_step=config.get(CONF_SETPOINT_SHIFT_STEP), setpoint_shift_max=config.get(CONF_SETPOINT_SHIFT_MAX), setpoint_shift_min=config.get(CONF_SETPOINT_SHIFT_MIN), - group_address_on_off=config.get( - CONF_ON_OFF_ADDRESS), - group_address_on_off_state=config.get( - CONF_ON_OFF_STATE_ADDRESS), + group_address_on_off=config.get(CONF_ON_OFF_ADDRESS), + group_address_on_off_state=config.get(CONF_ON_OFF_STATE_ADDRESS), min_temp=config.get(CONF_MIN_TEMP), max_temp=config.get(CONF_MAX_TEMP), mode=climate_mode) diff --git a/homeassistant/components/knx/light.py b/homeassistant/components/knx/light.py index f2a6f15e08b..baba7edd21a 100644 --- a/homeassistant/components/knx/light.py +++ b/homeassistant/components/knx/light.py @@ -3,19 +3,15 @@ from enum import Enum import voluptuous as vol +from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX from homeassistant.components.light import ( ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_HS_COLOR, PLATFORM_SCHEMA, - SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP, - Light) -from homeassistant.const import CONF_NAME + SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP, Light) +from homeassistant.const import CONF_ADDRESS, CONF_NAME from homeassistant.core import callback import homeassistant.helpers.config_validation as cv import homeassistant.util.color as color_util -from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX - - -CONF_ADDRESS = 'address' CONF_STATE_ADDRESS = 'state_address' CONF_BRIGHTNESS_ADDRESS = 'brightness_address' CONF_BRIGHTNESS_STATE_ADDRESS = 'brightness_state_address' diff --git a/homeassistant/components/knx/notify.py b/homeassistant/components/knx/notify.py index 2488114aa41..1e1d7f185f0 100644 --- a/homeassistant/components/knx/notify.py +++ b/homeassistant/components/knx/notify.py @@ -1,14 +1,13 @@ """Support for KNX/IP notification services.""" import voluptuous as vol -from homeassistant.components.knx import DATA_KNX, ATTR_DISCOVER_DEVICES -from homeassistant.components.notify import PLATFORM_SCHEMA, \ - BaseNotificationService -from homeassistant.const import CONF_NAME +from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX +from homeassistant.components.notify import ( + PLATFORM_SCHEMA, BaseNotificationService) +from homeassistant.const import CONF_ADDRESS, CONF_NAME from homeassistant.core import callback import homeassistant.helpers.config_validation as cv -CONF_ADDRESS = 'address' DEFAULT_NAME = 'KNX Notify' DEPENDENCIES = ['knx'] diff --git a/homeassistant/components/knx/scene.py b/homeassistant/components/knx/scene.py index 008e81508b9..b1bb2bf3109 100644 --- a/homeassistant/components/knx/scene.py +++ b/homeassistant/components/knx/scene.py @@ -3,11 +3,10 @@ import voluptuous as vol from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX from homeassistant.components.scene import CONF_PLATFORM, Scene -from homeassistant.const import CONF_NAME +from homeassistant.const import CONF_ADDRESS, CONF_NAME from homeassistant.core import callback import homeassistant.helpers.config_validation as cv -CONF_ADDRESS = 'address' CONF_SCENE_NUMBER = 'scene_number' DEFAULT_NAME = 'KNX SCENE' diff --git a/homeassistant/components/knx/sensor.py b/homeassistant/components/knx/sensor.py index 6a2d8144b1e..abbb61e150d 100644 --- a/homeassistant/components/knx/sensor.py +++ b/homeassistant/components/knx/sensor.py @@ -3,14 +3,11 @@ import voluptuous as vol from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX from homeassistant.components.sensor import PLATFORM_SCHEMA -from homeassistant.const import CONF_NAME +from homeassistant.const import CONF_ADDRESS, CONF_NAME, CONF_TYPE from homeassistant.core import callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import Entity -CONF_ADDRESS = 'address' -CONF_TYPE = 'type' - DEFAULT_NAME = 'KNX Sensor' DEPENDENCIES = ['knx'] diff --git a/homeassistant/components/knx/switch.py b/homeassistant/components/knx/switch.py index 305234e1eec..cef14fb74dc 100644 --- a/homeassistant/components/knx/switch.py +++ b/homeassistant/components/knx/switch.py @@ -3,11 +3,10 @@ import voluptuous as vol from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice -from homeassistant.const import CONF_NAME +from homeassistant.const import CONF_ADDRESS, CONF_NAME from homeassistant.core import callback import homeassistant.helpers.config_validation as cv -CONF_ADDRESS = 'address' CONF_STATE_ADDRESS = 'state_address' DEFAULT_NAME = 'KNX Switch' diff --git a/homeassistant/components/light/rpi_gpio_pwm.py b/homeassistant/components/light/rpi_gpio_pwm.py index a3fe0f6b71e..b0b9ef1b763 100644 --- a/homeassistant/components/light/rpi_gpio_pwm.py +++ b/homeassistant/components/light/rpi_gpio_pwm.py @@ -1,14 +1,9 @@ -""" -Support for LED lights that can be controlled using PWM. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/light.pwm/ -""" +"""Support for LED lights that can be controlled using PWM.""" import logging import voluptuous as vol -from homeassistant.const import CONF_NAME, CONF_TYPE, STATE_ON +from homeassistant.const import CONF_NAME, CONF_TYPE, STATE_ON, CONF_ADDRESS from homeassistant.components.light import ( Light, ATTR_BRIGHTNESS, ATTR_HS_COLOR, ATTR_TRANSITION, SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_TRANSITION, PLATFORM_SCHEMA) @@ -24,7 +19,6 @@ CONF_LEDS = 'leds' CONF_DRIVER = 'driver' CONF_PINS = 'pins' CONF_FREQUENCY = 'frequency' -CONF_ADDRESS = 'address' CONF_DRIVER_GPIO = 'gpio' CONF_DRIVER_PCA9685 = 'pca9685' @@ -46,11 +40,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ { vol.Required(CONF_NAME): cv.string, vol.Required(CONF_DRIVER): vol.In(CONF_DRIVER_TYPES), - vol.Required(CONF_PINS): vol.All(cv.ensure_list, - [cv.positive_int]), + vol.Required(CONF_PINS): + vol.All(cv.ensure_list, [cv.positive_int]), vol.Required(CONF_TYPE): vol.In(CONF_LED_TYPES), vol.Optional(CONF_FREQUENCY): cv.positive_int, - vol.Optional(CONF_ADDRESS): cv.byte + vol.Optional(CONF_ADDRESS): cv.byte, } ]) }) diff --git a/homeassistant/components/raspihats/__init__.py b/homeassistant/components/raspihats/__init__.py index 69b03a36769..622b98223aa 100644 --- a/homeassistant/components/raspihats/__init__.py +++ b/homeassistant/components/raspihats/__init__.py @@ -14,7 +14,6 @@ DOMAIN = 'raspihats' CONF_I2C_HATS = 'i2c_hats' CONF_BOARD = 'board' -CONF_ADDRESS = 'address' CONF_CHANNELS = 'channels' CONF_INDEX = 'index' CONF_INVERT_LOGIC = 'invert_logic' diff --git a/homeassistant/components/raspihats/binary_sensor.py b/homeassistant/components/raspihats/binary_sensor.py index 04885402e72..b0ebc2e3579 100644 --- a/homeassistant/components/raspihats/binary_sensor.py +++ b/homeassistant/components/raspihats/binary_sensor.py @@ -6,10 +6,10 @@ import voluptuous as vol from homeassistant.components.binary_sensor import ( PLATFORM_SCHEMA, BinarySensorDevice) from homeassistant.components.raspihats import ( - CONF_ADDRESS, CONF_BOARD, CONF_CHANNELS, CONF_I2C_HATS, CONF_INDEX, - CONF_INVERT_LOGIC, I2C_HAT_NAMES, I2C_HATS_MANAGER, I2CHatsException) + CONF_BOARD, CONF_CHANNELS, CONF_I2C_HATS, CONF_INDEX, CONF_INVERT_LOGIC, + I2C_HAT_NAMES, I2C_HATS_MANAGER, I2CHatsException) from homeassistant.const import ( - CONF_DEVICE_CLASS, CONF_NAME, DEVICE_DEFAULT_NAME) + CONF_ADDRESS, CONF_DEVICE_CLASS, CONF_NAME, DEVICE_DEFAULT_NAME) import homeassistant.helpers.config_validation as cv _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/raspihats/switch.py b/homeassistant/components/raspihats/switch.py index 10bb2f748c4..26fcda3c8d7 100644 --- a/homeassistant/components/raspihats/switch.py +++ b/homeassistant/components/raspihats/switch.py @@ -4,11 +4,10 @@ import logging import voluptuous as vol from homeassistant.components.raspihats import ( - CONF_ADDRESS, CONF_BOARD, CONF_CHANNELS, CONF_I2C_HATS, CONF_INDEX, - CONF_INITIAL_STATE, CONF_INVERT_LOGIC, I2C_HAT_NAMES, I2C_HATS_MANAGER, - I2CHatsException) + CONF_BOARD, CONF_CHANNELS, CONF_I2C_HATS, CONF_INDEX, CONF_INITIAL_STATE, + CONF_INVERT_LOGIC, I2C_HAT_NAMES, I2C_HATS_MANAGER, I2CHatsException) from homeassistant.components.switch import PLATFORM_SCHEMA -from homeassistant.const import CONF_NAME, DEVICE_DEFAULT_NAME +from homeassistant.const import CONF_ADDRESS, CONF_NAME, DEVICE_DEFAULT_NAME import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import ToggleEntity diff --git a/homeassistant/components/sensor/etherscan.py b/homeassistant/components/sensor/etherscan.py index 3b76d888e26..082295bfea5 100644 --- a/homeassistant/components/sensor/etherscan.py +++ b/homeassistant/components/sensor/etherscan.py @@ -1,15 +1,11 @@ -""" -Support for Etherscan sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.etherscan/ -""" +"""Support for Etherscan sensors.""" from datetime import timedelta import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA -from homeassistant.const import ATTR_ATTRIBUTION, CONF_NAME +from homeassistant.const import ( + ATTR_ATTRIBUTION, CONF_ADDRESS, CONF_NAME, CONF_TOKEN) import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import Entity @@ -17,8 +13,6 @@ REQUIREMENTS = ['python-etherscan-api==0.0.3'] ATTRIBUTION = "Data provided by etherscan.io" -CONF_ADDRESS = 'address' -CONF_TOKEN = 'token' CONF_TOKEN_ADDRESS = 'token_address' SCAN_INTERVAL = timedelta(minutes=5) diff --git a/homeassistant/components/sensor/ripple.py b/homeassistant/components/sensor/ripple.py index 4abbc4efe06..54530571c3e 100644 --- a/homeassistant/components/sensor/ripple.py +++ b/homeassistant/components/sensor/ripple.py @@ -1,21 +1,15 @@ -""" -Support for Ripple sensors. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.ripple/ -""" +"""Support for Ripple sensors.""" from datetime import timedelta import voluptuous as vol -import homeassistant.helpers.config_validation as cv from homeassistant.components.sensor import PLATFORM_SCHEMA -from homeassistant.const import (CONF_NAME, ATTR_ATTRIBUTION) +from homeassistant.const import ATTR_ATTRIBUTION, CONF_ADDRESS, CONF_NAME +import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import Entity REQUIREMENTS = ['python-ripple-api==0.0.3'] -CONF_ADDRESS = 'address' ATTRIBUTION = "Data provided by ripple.com" DEFAULT_NAME = 'Ripple Balance' diff --git a/homeassistant/components/sensor/sochain.py b/homeassistant/components/sensor/sochain.py index d5bd4e5da82..ef6a53b7091 100644 --- a/homeassistant/components/sensor/sochain.py +++ b/homeassistant/components/sensor/sochain.py @@ -1,19 +1,14 @@ -""" -Support for watching multiple cryptocurrencies. - -For more details about this platform, please refer to the documentation at -https://home-assistant.io/components/sensor.sochain/ -""" -import logging +"""Support for watching multiple cryptocurrencies.""" from datetime import timedelta +import logging import voluptuous as vol -import homeassistant.helpers.config_validation as cv from homeassistant.components.sensor import PLATFORM_SCHEMA -from homeassistant.const import (CONF_NAME, ATTR_ATTRIBUTION) -from homeassistant.helpers.entity import Entity +from homeassistant.const import ATTR_ATTRIBUTION, CONF_ADDRESS, CONF_NAME from homeassistant.helpers.aiohttp_client import async_get_clientsession +import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.entity import Entity REQUIREMENTS = ['python-sochain-api==0.0.2'] @@ -21,7 +16,6 @@ _LOGGER = logging.getLogger(__name__) ATTRIBUTION = "Data provided by chain.so" -CONF_ADDRESS = 'address' CONF_NETWORK = 'network' DEFAULT_NAME = 'Crypto Balance'