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',
'motionSensor': 'motion',
'doorSensor': 'door',
'leakSensor': 'moisture'}
'wetLeakSensor': 'moisture'}
@asyncio.coroutine
@ -28,13 +28,14 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
address = discovery_info['address']
device = plm.devices[address]
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',
device.address.hex, device.states[state_key].name)
_LOGGER.debug('Adding device %s entity %s to Binary Sensor platform',
device.address.hex, device.states[state_key].name)
new_entity = InsteonPLMBinarySensor(device, state_key)
new_entity = InsteonPLMBinarySensor(device, state_key)
async_add_devices([new_entity])
async_add_devices([new_entity])
class InsteonPLMBinarySensor(InsteonPLMEntity, BinarySensorDevice):
@ -53,5 +54,4 @@ class InsteonPLMBinarySensor(InsteonPLMEntity, BinarySensorDevice):
@property
def is_on(self):
"""Return the boolean response if the node is on."""
sensorstate = self._insteon_device_state.value
return bool(sensorstate)
return bool(self._insteon_device_state.value)

View File

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

View File

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