Use constants from const.py (#21068)

* Use constants from const.py

* Fix lint issues
This commit is contained in:
Fabian Affolter authored and GitHub committed 2019-02-19 14:09:06 +01:00
1 parent 9d3eaada27
commit 2d2c6cf4a1
21 files changed
+105 -188

No files matched your search

+5 -12
View File
@@ -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'
@@ -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
+6 -11
View File
@@ -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
+18 -24
View File
@@ -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')
+3 -8
View File
@@ -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')
+3 -8
View File
@@ -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')
+4 -9
View File
@@ -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