mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
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:
parent
3fdb0002a7
commit
f391cbae27
@ -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,13 +28,14 @@ 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',
|
||||||
|
device.address.hex, device.states[state_key].name)
|
||||||
|
|
||||||
_LOGGER.debug('Adding device %s entity %s to Binary Sensor platform',
|
new_entity = InsteonPLMBinarySensor(device, state_key)
|
||||||
device.address.hex, device.states[state_key].name)
|
|
||||||
|
|
||||||
new_entity = InsteonPLMBinarySensor(device, state_key)
|
async_add_devices([new_entity])
|
||||||
|
|
||||||
async_add_devices([new_entity])
|
|
||||||
|
|
||||||
|
|
||||||
class InsteonPLMBinarySensor(InsteonPLMEntity, BinarySensorDevice):
|
class InsteonPLMBinarySensor(InsteonPLMEntity, BinarySensorDevice):
|
||||||
@ -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)
|
|
||||||
|
@ -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,19 +64,20 @@ 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]]
|
||||||
platform = platform_info.platform
|
if platform_info:
|
||||||
if platform is not None:
|
platform = platform_info.platform
|
||||||
_LOGGER.info("New INSTEON PLM device: %s (%s) %s",
|
if platform:
|
||||||
device.address,
|
_LOGGER.info("New INSTEON PLM device: %s (%s) %s",
|
||||||
device.states[state_key].name,
|
device.address,
|
||||||
platform)
|
device.states[state_key].name,
|
||||||
|
platform)
|
||||||
|
|
||||||
hass.async_add_job(
|
hass.async_add_job(
|
||||||
discovery.async_load_platform(
|
discovery.async_load_platform(
|
||||||
hass, platform, DOMAIN,
|
hass, platform, DOMAIN,
|
||||||
discovered={'address': device.address.hex,
|
discovered={'address': device.address.hex,
|
||||||
'state_key': state_key},
|
'state_key': state_key},
|
||||||
hass_config=config))
|
hass_config=config))
|
||||||
|
|
||||||
_LOGGER.info("Looking for PLM on %s", port)
|
_LOGGER.info("Looking for PLM on %s", port)
|
||||||
conn = yield from insteonplm.Connection.create(
|
conn = yield from insteonplm.Connection.create(
|
||||||
@ -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'),
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user