Fix Insteon Leak Sensor (#13515)

* update leak sensor

* Fix error when insteon state type is unknown

* Bump insteon version to 0.8.3

* Update requirements all and test

* Fix requirements conflicts due to lack of commit sync

* Requirements sync

* Rerun script/gen_requirements_all.py

* Try requirements update again

* Update requirements
This commit is contained in:
Tom Harris 2018-03-29 20:10:27 -04:00 committed by Paulus Schoutsen
parent 3fdb0002a7
commit f391cbae27
3 changed files with 26 additions and 23 deletions

View File

@ -17,7 +17,7 @@ _LOGGER = logging.getLogger(__name__)
SENSOR_TYPES = {'openClosedSensor': 'opening', SENSOR_TYPES = {'openClosedSensor': 'opening',
'motionSensor': 'motion', 'motionSensor': 'motion',
'doorSensor': 'door', 'doorSensor': 'door',
'leakSensor': 'moisture'} 'wetLeakSensor': 'moisture'}
@asyncio.coroutine @asyncio.coroutine
@ -28,7 +28,8 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
address = discovery_info['address'] address = discovery_info['address']
device = plm.devices[address] device = plm.devices[address]
state_key = discovery_info['state_key'] 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) device.address.hex, device.states[state_key].name)
@ -53,5 +54,4 @@ class InsteonPLMBinarySensor(InsteonPLMEntity, BinarySensorDevice):
@property @property
def is_on(self): def is_on(self):
"""Return the boolean response if the node is on.""" """Return the boolean response if the node is on."""
sensorstate = self._insteon_device_state.value return bool(self._insteon_device_state.value)
return bool(sensorstate)

View File

@ -16,7 +16,7 @@ import homeassistant.helpers.config_validation as cv
from homeassistant.helpers import discovery from homeassistant.helpers import discovery
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
REQUIREMENTS = ['insteonplm==0.8.2'] REQUIREMENTS = ['insteonplm==0.8.3']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -64,8 +64,9 @@ def async_setup(hass, config):
"""Detect device from transport to be delegated to platform.""" """Detect device from transport to be delegated to platform."""
for state_key in device.states: for state_key in device.states:
platform_info = ipdb[device.states[state_key]] platform_info = ipdb[device.states[state_key]]
if platform_info:
platform = platform_info.platform platform = platform_info.platform
if platform is not None: if platform:
_LOGGER.info("New INSTEON PLM device: %s (%s) %s", _LOGGER.info("New INSTEON PLM device: %s (%s) %s",
device.address, device.address,
device.states[state_key].name, device.states[state_key].name,
@ -127,13 +128,15 @@ class IPDB(object):
from insteonplm.states.sensor import (VariableSensor, from insteonplm.states.sensor import (VariableSensor,
OnOffSensor, OnOffSensor,
SmokeCO2Sensor, SmokeCO2Sensor,
IoLincSensor) IoLincSensor,
LeakSensorDryWet)
self.states = [State(OnOffSwitch_OutletTop, 'switch'), self.states = [State(OnOffSwitch_OutletTop, 'switch'),
State(OnOffSwitch_OutletBottom, 'switch'), State(OnOffSwitch_OutletBottom, 'switch'),
State(OpenClosedRelay, 'switch'), State(OpenClosedRelay, 'switch'),
State(OnOffSwitch, 'switch'), State(OnOffSwitch, 'switch'),
State(LeakSensorDryWet, 'binary_sensor'),
State(IoLincSensor, 'binary_sensor'), State(IoLincSensor, 'binary_sensor'),
State(SmokeCO2Sensor, 'sensor'), State(SmokeCO2Sensor, 'sensor'),
State(OnOffSensor, 'binary_sensor'), State(OnOffSensor, 'binary_sensor'),

View File

@ -417,7 +417,7 @@ influxdb==5.0.0
insteonlocal==0.53 insteonlocal==0.53
# homeassistant.components.insteon_plm # homeassistant.components.insteon_plm
insteonplm==0.8.2 insteonplm==0.8.3
# homeassistant.components.verisure # homeassistant.components.verisure
jsonpath==0.75 jsonpath==0.75