Use constants from const.py (#21068)

* Use constants from const.py

* Fix lint issues
This commit is contained in:
Fabian Affolter 2019-02-19 14:09:06 +01:00 committed by GitHub
parent 9d3eaada27
commit 2d2c6cf4a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 105 additions and 188 deletions

View file

@ -1,22 +1,16 @@
""" """Support for INSTEON Modems (PLM and Hub)."""
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/
"""
import collections import collections
import logging import logging
from typing import Dict from typing import Dict
import voluptuous as vol import voluptuous as vol
import homeassistant.helpers.config_validation as cv from homeassistant.const import (
from homeassistant.const import (CONF_PORT, EVENT_HOMEASSISTANT_STOP, CONF_ADDRESS, CONF_ENTITY_ID, CONF_HOST, CONF_PLATFORM, CONF_PORT,
CONF_PLATFORM, EVENT_HOMEASSISTANT_STOP)
CONF_ENTITY_ID,
CONF_HOST)
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers import discovery from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
REQUIREMENTS = ['insteonplm==0.15.2'] REQUIREMENTS = ['insteonplm==0.15.2']
@ -31,7 +25,6 @@ CONF_HUB_PASSWORD = 'password'
CONF_HUB_VERSION = 'hub_version' CONF_HUB_VERSION = 'hub_version'
CONF_OVERRIDE = 'device_override' CONF_OVERRIDE = 'device_override'
CONF_PLM_HUB_MSG = 'Must configure either a PLM port or a Hub host' CONF_PLM_HUB_MSG = 'Must configure either a PLM port or a Hub host'
CONF_ADDRESS = 'address'
CONF_CAT = 'cat' CONF_CAT = 'cat'
CONF_SUBCAT = 'subcat' CONF_SUBCAT = 'subcat'
CONF_FIRMWARE = 'firmware' CONF_FIRMWARE = 'firmware'

View file

@ -1,29 +1,26 @@
""" """Support for INSTEON dimmers via PowerLinc Modem."""
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/
"""
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.components.insteon import InsteonEntity from homeassistant.components.insteon import InsteonEntity
DEPENDENCIES = ['insteon']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
SENSOR_TYPES = {'openClosedSensor': 'opening', DEPENDENCIES = ['insteon']
'ioLincSensor': 'opening',
'motionSensor': 'motion', SENSOR_TYPES = {
'doorSensor': 'door', 'openClosedSensor': 'opening',
'wetLeakSensor': 'moisture', 'ioLincSensor': 'opening',
'lightSensor': 'light', 'motionSensor': 'motion',
'batterySensor': 'battery'} 'doorSensor': 'door',
'wetLeakSensor': 'moisture',
'lightSensor': 'light',
'batterySensor': 'battery',
}
async def async_setup_platform(hass, config, async_add_entities, async def async_setup_platform(
discovery_info=None): hass, config, async_add_entities, discovery_info=None):
"""Set up the INSTEON device class for the hass platform.""" """Set up the INSTEON device class for the hass platform."""
insteon_modem = hass.data['insteon'].get('modem') 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'] state_key = discovery_info['state_key']
name = device.states[state_key].name name = device.states[state_key].name
if name != 'dryLeakSensor': 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) device.address.hex, device.states[state_key].name)
new_entity = InsteonBinarySensor(device, state_key) new_entity = InsteonBinarySensor(device, state_key)
@ -58,8 +55,7 @@ class InsteonBinarySensor(InsteonEntity, BinarySensorDevice):
"""Return the boolean response if the node is on.""" """Return the boolean response if the node is on."""
on_val = bool(self._insteon_device_state.value) on_val = bool(self._insteon_device_state.value)
if self._insteon_device_state.name in ['lightSensor', if self._insteon_device_state.name in ['lightSensor', 'ioLincSensor']:
'ioLincSensor']:
return not on_val return not on_val
return on_val return on_val

View file

@ -1,16 +1,11 @@
""" """Support for Insteon covers via PowerLinc Modem."""
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/
"""
import logging import logging
import math 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.insteon import InsteonEntity
from homeassistant.components.cover import (CoverDevice, ATTR_POSITION,
SUPPORT_OPEN, SUPPORT_CLOSE,
SUPPORT_SET_POSITION)
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -18,8 +13,8 @@ DEPENDENCIES = ['insteon']
SUPPORTED_FEATURES = SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_SET_POSITION SUPPORTED_FEATURES = SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_SET_POSITION
async def async_setup_platform(hass, config, async_add_entities, async def async_setup_platform(
discovery_info=None): hass, config, async_add_entities, discovery_info=None):
"""Set up the Insteon platform.""" """Set up the Insteon platform."""
if not discovery_info: if not discovery_info:
return return

View file

@ -1,34 +1,28 @@
""" """Support for INSTEON fans via PowerLinc Modem."""
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/
"""
import logging import logging
from homeassistant.components.fan import (SPEED_OFF, from homeassistant.components.fan import (
SPEED_LOW, SPEED_HIGH, SPEED_LOW, SPEED_MEDIUM, SPEED_OFF, SUPPORT_SET_SPEED,
SPEED_MEDIUM, FanEntity)
SPEED_HIGH,
FanEntity,
SUPPORT_SET_SPEED)
from homeassistant.const import STATE_OFF
from homeassistant.components.insteon import InsteonEntity from homeassistant.components.insteon import InsteonEntity
from homeassistant.const import STATE_OFF
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]
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['insteon']
async def async_setup_platform(hass, config, async_add_entities, SPEED_TO_HEX = {
discovery_info=None): 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.""" """Set up the INSTEON device class for the hass platform."""
insteon_modem = hass.data['insteon'].get('modem') insteon_modem = hass.data['insteon'].get('modem')

View file

@ -1,9 +1,4 @@
""" """Support for Insteon lights via PowerLinc Modem."""
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/
"""
import logging import logging
from homeassistant.components.insteon import InsteonEntity from homeassistant.components.insteon import InsteonEntity
@ -17,8 +12,8 @@ DEPENDENCIES = ['insteon']
MAX_BRIGHTNESS = 255 MAX_BRIGHTNESS = 255
async def async_setup_platform(hass, config, async_add_entities, async def async_setup_platform(
discovery_info=None): hass, config, async_add_entities, discovery_info=None):
"""Set up the Insteon component.""" """Set up the Insteon component."""
insteon_modem = hass.data['insteon'].get('modem') insteon_modem = hass.data['insteon'].get('modem')

View file

@ -1,9 +1,4 @@
""" """Support for INSTEON dimmers via PowerLinc Modem."""
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/
"""
import logging import logging
from homeassistant.components.insteon import InsteonEntity from homeassistant.components.insteon import InsteonEntity
@ -14,8 +9,8 @@ DEPENDENCIES = ['insteon']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup_platform(hass, config, async_add_entities, async def async_setup_platform(
discovery_info=None): hass, config, async_add_entities, discovery_info=None):
"""Set up the INSTEON device class for the hass platform.""" """Set up the INSTEON device class for the hass platform."""
insteon_modem = hass.data['insteon'].get('modem') insteon_modem = hass.data['insteon'].get('modem')

View file

@ -1,9 +1,4 @@
""" """Support for INSTEON dimmers via PowerLinc Modem."""
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/
"""
import logging import logging
from homeassistant.components.insteon import InsteonEntity from homeassistant.components.insteon import InsteonEntity
@ -14,8 +9,8 @@ DEPENDENCIES = ['insteon']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup_platform(hass, config, async_add_entities, async def async_setup_platform(
discovery_info=None): hass, config, async_add_entities, discovery_info=None):
"""Set up the INSTEON device class for the hass platform.""" """Set up the INSTEON device class for the hass platform."""
insteon_modem = hass.data['insteon'].get('modem') 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 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) device.address.hex, device.states[state_key].name)
new_entity = None new_entity = None

View file

@ -5,12 +5,10 @@ from homeassistant.components.binary_sensor import (
PLATFORM_SCHEMA, BinarySensorDevice) PLATFORM_SCHEMA, BinarySensorDevice)
from homeassistant.components.knx import ( from homeassistant.components.knx import (
ATTR_DISCOVER_DEVICES, DATA_KNX, KNXAutomation) 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 from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
CONF_ADDRESS = 'address'
CONF_DEVICE_CLASS = 'device_class'
CONF_SIGNIFICANT_BIT = 'significant_bit' CONF_SIGNIFICANT_BIT = 'significant_bit'
CONF_DEFAULT_SIGNIFICANT_BIT = 1 CONF_DEFAULT_SIGNIFICANT_BIT = 1
CONF_AUTOMATION = 'automation' CONF_AUTOMATION = 'automation'
@ -32,10 +30,7 @@ AUTOMATION_SCHEMA = vol.Schema({
vol.Required(CONF_ACTION): cv.SCRIPT_SCHEMA, vol.Required(CONF_ACTION): cv.SCRIPT_SCHEMA,
}) })
AUTOMATIONS_SCHEMA = vol.All( AUTOMATIONS_SCHEMA = vol.All(cv.ensure_list, [AUTOMATION_SCHEMA])
cv.ensure_list,
[AUTOMATION_SCHEMA]
)
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_ADDRESS): cv.string, 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, async def async_setup_platform(
discovery_info=None): hass, config, async_add_entities, discovery_info=None):
"""Set up binary sensor(s) for KNX platform.""" """Set up binary sensor(s) for KNX platform."""
if discovery_info is not None: if discovery_info is not None:
async_add_entities_discovery(hass, discovery_info, async_add_entities) async_add_entities_discovery(hass, discovery_info, async_add_entities)

View file

@ -1,17 +1,14 @@
"""Support for KNX/IP climate devices.""" """Support for KNX/IP climate devices."""
import voluptuous as vol 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_ADDRESS = 'setpoint_shift_address'
CONF_SETPOINT_SHIFT_STATE_ADDRESS = 'setpoint_shift_state_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_OPERATION_MODE_COMFORT_ADDRESS): cv.string,
vol.Optional(CONF_ON_OFF_ADDRESS): cv.string, vol.Optional(CONF_ON_OFF_ADDRESS): cv.string,
vol.Optional(CONF_ON_OFF_STATE_ADDRESS): cv.string, vol.Optional(CONF_ON_OFF_STATE_ADDRESS): cv.string,
vol.Optional(CONF_OPERATION_MODES): vol.All(cv.ensure_list, vol.Optional(CONF_OPERATION_MODES):
[vol.In(OPERATION_MODES)]), vol.All(cv.ensure_list, [vol.In(OPERATION_MODES)]),
vol.Optional(CONF_MIN_TEMP): vol.Coerce(float), vol.Optional(CONF_MIN_TEMP): vol.Coerce(float),
vol.Optional(CONF_MAX_TEMP): vol.Coerce(float), vol.Optional(CONF_MAX_TEMP): vol.Coerce(float),
}) })
async def async_setup_platform(hass, config, async_add_entities, async def async_setup_platform(
discovery_info=None): hass, config, async_add_entities, discovery_info=None):
"""Set up climate(s) for KNX platform.""" """Set up climate(s) for KNX platform."""
if discovery_info is not None: if discovery_info is not None:
async_add_entities_discovery(hass, discovery_info, async_add_entities) 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_step=config.get(CONF_SETPOINT_SHIFT_STEP),
setpoint_shift_max=config.get(CONF_SETPOINT_SHIFT_MAX), setpoint_shift_max=config.get(CONF_SETPOINT_SHIFT_MAX),
setpoint_shift_min=config.get(CONF_SETPOINT_SHIFT_MIN), setpoint_shift_min=config.get(CONF_SETPOINT_SHIFT_MIN),
group_address_on_off=config.get( group_address_on_off=config.get(CONF_ON_OFF_ADDRESS),
CONF_ON_OFF_ADDRESS), group_address_on_off_state=config.get(CONF_ON_OFF_STATE_ADDRESS),
group_address_on_off_state=config.get(
CONF_ON_OFF_STATE_ADDRESS),
min_temp=config.get(CONF_MIN_TEMP), min_temp=config.get(CONF_MIN_TEMP),
max_temp=config.get(CONF_MAX_TEMP), max_temp=config.get(CONF_MAX_TEMP),
mode=climate_mode) mode=climate_mode)

View file

@ -3,19 +3,15 @@ from enum import Enum
import voluptuous as vol import voluptuous as vol
from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX
from homeassistant.components.light import ( from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_HS_COLOR, PLATFORM_SCHEMA, ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_HS_COLOR, PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP, SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP, Light)
Light) from homeassistant.const import CONF_ADDRESS, CONF_NAME
from homeassistant.const import CONF_NAME
from homeassistant.core import callback from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
import homeassistant.util.color as color_util 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_STATE_ADDRESS = 'state_address'
CONF_BRIGHTNESS_ADDRESS = 'brightness_address' CONF_BRIGHTNESS_ADDRESS = 'brightness_address'
CONF_BRIGHTNESS_STATE_ADDRESS = 'brightness_state_address' CONF_BRIGHTNESS_STATE_ADDRESS = 'brightness_state_address'

View file

@ -1,14 +1,13 @@
"""Support for KNX/IP notification services.""" """Support for KNX/IP notification services."""
import voluptuous as vol import voluptuous as vol
from homeassistant.components.knx import DATA_KNX, ATTR_DISCOVER_DEVICES from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX
from homeassistant.components.notify import PLATFORM_SCHEMA, \ from homeassistant.components.notify import (
BaseNotificationService PLATFORM_SCHEMA, BaseNotificationService)
from homeassistant.const import CONF_NAME from homeassistant.const import CONF_ADDRESS, CONF_NAME
from homeassistant.core import callback from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
CONF_ADDRESS = 'address'
DEFAULT_NAME = 'KNX Notify' DEFAULT_NAME = 'KNX Notify'
DEPENDENCIES = ['knx'] DEPENDENCIES = ['knx']

View file

@ -3,11 +3,10 @@ import voluptuous as vol
from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX
from homeassistant.components.scene import CONF_PLATFORM, Scene 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 from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
CONF_ADDRESS = 'address'
CONF_SCENE_NUMBER = 'scene_number' CONF_SCENE_NUMBER = 'scene_number'
DEFAULT_NAME = 'KNX SCENE' DEFAULT_NAME = 'KNX SCENE'

View file

@ -3,14 +3,11 @@ import voluptuous as vol
from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX
from homeassistant.components.sensor import PLATFORM_SCHEMA 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 from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
CONF_ADDRESS = 'address'
CONF_TYPE = 'type'
DEFAULT_NAME = 'KNX Sensor' DEFAULT_NAME = 'KNX Sensor'
DEPENDENCIES = ['knx'] DEPENDENCIES = ['knx']

View file

@ -3,11 +3,10 @@ import voluptuous as vol
from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice 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 from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
CONF_ADDRESS = 'address'
CONF_STATE_ADDRESS = 'state_address' CONF_STATE_ADDRESS = 'state_address'
DEFAULT_NAME = 'KNX Switch' DEFAULT_NAME = 'KNX Switch'

View file

@ -1,14 +1,9 @@
""" """Support for LED lights that can be controlled using PWM."""
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/
"""
import logging import logging
import voluptuous as vol 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 ( from homeassistant.components.light import (
Light, ATTR_BRIGHTNESS, ATTR_HS_COLOR, ATTR_TRANSITION, Light, ATTR_BRIGHTNESS, ATTR_HS_COLOR, ATTR_TRANSITION,
SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_TRANSITION, PLATFORM_SCHEMA) SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_TRANSITION, PLATFORM_SCHEMA)
@ -24,7 +19,6 @@ CONF_LEDS = 'leds'
CONF_DRIVER = 'driver' CONF_DRIVER = 'driver'
CONF_PINS = 'pins' CONF_PINS = 'pins'
CONF_FREQUENCY = 'frequency' CONF_FREQUENCY = 'frequency'
CONF_ADDRESS = 'address'
CONF_DRIVER_GPIO = 'gpio' CONF_DRIVER_GPIO = 'gpio'
CONF_DRIVER_PCA9685 = 'pca9685' CONF_DRIVER_PCA9685 = 'pca9685'
@ -46,11 +40,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
{ {
vol.Required(CONF_NAME): cv.string, vol.Required(CONF_NAME): cv.string,
vol.Required(CONF_DRIVER): vol.In(CONF_DRIVER_TYPES), vol.Required(CONF_DRIVER): vol.In(CONF_DRIVER_TYPES),
vol.Required(CONF_PINS): vol.All(cv.ensure_list, vol.Required(CONF_PINS):
[cv.positive_int]), vol.All(cv.ensure_list, [cv.positive_int]),
vol.Required(CONF_TYPE): vol.In(CONF_LED_TYPES), vol.Required(CONF_TYPE): vol.In(CONF_LED_TYPES),
vol.Optional(CONF_FREQUENCY): cv.positive_int, vol.Optional(CONF_FREQUENCY): cv.positive_int,
vol.Optional(CONF_ADDRESS): cv.byte vol.Optional(CONF_ADDRESS): cv.byte,
} }
]) ])
}) })

View file

@ -14,7 +14,6 @@ DOMAIN = 'raspihats'
CONF_I2C_HATS = 'i2c_hats' CONF_I2C_HATS = 'i2c_hats'
CONF_BOARD = 'board' CONF_BOARD = 'board'
CONF_ADDRESS = 'address'
CONF_CHANNELS = 'channels' CONF_CHANNELS = 'channels'
CONF_INDEX = 'index' CONF_INDEX = 'index'
CONF_INVERT_LOGIC = 'invert_logic' CONF_INVERT_LOGIC = 'invert_logic'

View file

@ -6,10 +6,10 @@ import voluptuous as vol
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
PLATFORM_SCHEMA, BinarySensorDevice) PLATFORM_SCHEMA, BinarySensorDevice)
from homeassistant.components.raspihats import ( from homeassistant.components.raspihats import (
CONF_ADDRESS, CONF_BOARD, CONF_CHANNELS, CONF_I2C_HATS, CONF_INDEX, CONF_BOARD, CONF_CHANNELS, CONF_I2C_HATS, CONF_INDEX, CONF_INVERT_LOGIC,
CONF_INVERT_LOGIC, I2C_HAT_NAMES, I2C_HATS_MANAGER, I2CHatsException) I2C_HAT_NAMES, I2C_HATS_MANAGER, I2CHatsException)
from homeassistant.const import ( 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 import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View file

@ -4,11 +4,10 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components.raspihats import ( from homeassistant.components.raspihats import (
CONF_ADDRESS, CONF_BOARD, CONF_CHANNELS, CONF_I2C_HATS, CONF_INDEX, CONF_BOARD, CONF_CHANNELS, CONF_I2C_HATS, CONF_INDEX, CONF_INITIAL_STATE,
CONF_INITIAL_STATE, CONF_INVERT_LOGIC, I2C_HAT_NAMES, I2C_HATS_MANAGER, CONF_INVERT_LOGIC, I2C_HAT_NAMES, I2C_HATS_MANAGER, I2CHatsException)
I2CHatsException)
from homeassistant.components.switch import PLATFORM_SCHEMA 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 import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import ToggleEntity from homeassistant.helpers.entity import ToggleEntity

View file

@ -1,15 +1,11 @@
""" """Support for Etherscan sensors."""
Support for Etherscan sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.etherscan/
"""
from datetime import timedelta from datetime import timedelta
import voluptuous as vol import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA 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 import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
@ -17,8 +13,6 @@ REQUIREMENTS = ['python-etherscan-api==0.0.3']
ATTRIBUTION = "Data provided by etherscan.io" ATTRIBUTION = "Data provided by etherscan.io"
CONF_ADDRESS = 'address'
CONF_TOKEN = 'token'
CONF_TOKEN_ADDRESS = 'token_address' CONF_TOKEN_ADDRESS = 'token_address'
SCAN_INTERVAL = timedelta(minutes=5) SCAN_INTERVAL = timedelta(minutes=5)

View file

@ -1,21 +1,15 @@
""" """Support for Ripple sensors."""
Support for Ripple sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.ripple/
"""
from datetime import timedelta from datetime import timedelta
import voluptuous as vol import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA 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 from homeassistant.helpers.entity import Entity
REQUIREMENTS = ['python-ripple-api==0.0.3'] REQUIREMENTS = ['python-ripple-api==0.0.3']
CONF_ADDRESS = 'address'
ATTRIBUTION = "Data provided by ripple.com" ATTRIBUTION = "Data provided by ripple.com"
DEFAULT_NAME = 'Ripple Balance' DEFAULT_NAME = 'Ripple Balance'

View file

@ -1,19 +1,14 @@
""" """Support for watching multiple cryptocurrencies."""
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
from datetime import timedelta from datetime import timedelta
import logging
import voluptuous as vol import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA 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
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.aiohttp_client import async_get_clientsession 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'] REQUIREMENTS = ['python-sochain-api==0.0.2']
@ -21,7 +16,6 @@ _LOGGER = logging.getLogger(__name__)
ATTRIBUTION = "Data provided by chain.so" ATTRIBUTION = "Data provided by chain.so"
CONF_ADDRESS = 'address'
CONF_NETWORK = 'network' CONF_NETWORK = 'network'
DEFAULT_NAME = 'Crypto Balance' DEFAULT_NAME = 'Crypto Balance'