This commit is contained in:
Paulus Schoutsen 2019-07-31 12:25:30 -07:00
parent da05dfe708
commit 4de97abc3a
2676 changed files with 163166 additions and 140084 deletions

View file

@ -8,28 +8,30 @@ from . import InsteonEntity
_LOGGER = logging.getLogger(__name__)
SENSOR_TYPES = {
'openClosedSensor': 'opening',
'ioLincSensor': 'opening',
'motionSensor': 'motion',
'doorSensor': 'door',
'wetLeakSensor': 'moisture',
'lightSensor': 'light',
'batterySensor': 'battery',
"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')
insteon_modem = hass.data["insteon"].get("modem")
address = discovery_info['address']
address = discovery_info["address"]
device = insteon_modem.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)
if name != "dryLeakSensor":
_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)
@ -54,7 +56,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