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

@@ -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