* Fix binary sensor

* Add 'stopped' to states

* Add '%' to states for light

* ISY light brightness support

* Method case

* Z-Wave unit 51 is a light
pull/3456/merge
Teagan Glenn 2016-09-19 21:16:51 -06:00 committed by Paulus Schoutsen
parent d6ad4bc22b
commit 35603268ca
3 changed files with 12 additions and 12 deletions

View File

@ -59,7 +59,7 @@ class ISYBinarySensorDevice(isy.ISYDevice, BinarySensorDevice):
@property
def is_on(self) -> bool:
"""Get whether the ISY994 binary sensor device is on."""
return bool(self.state)
return bool(self.value)
class ISYBinarySensorProgram(ISYBinarySensorDevice):
@ -69,8 +69,3 @@ class ISYBinarySensorProgram(ISYBinarySensorDevice):
"""Initialize the ISY994 binary sensor program."""
ISYBinarySensorDevice.__init__(self, node)
self._name = name
@property
def is_on(self):
"""Get whether the ISY994 binary sensor program is on."""
return bool(self.value)

View File

@ -21,7 +21,7 @@ VALUE_TO_STATE = {
}
UOM = ['97']
STATES = [STATE_OPEN, STATE_CLOSED, 'closing', 'opening']
STATES = [STATE_OPEN, STATE_CLOSED, 'closing', 'opening', 'stopped']
# pylint: disable=unused-argument

View File

@ -7,7 +7,7 @@ https://home-assistant.io/components/light.isy994/
import logging
from typing import Callable
from homeassistant.components.light import Light
from homeassistant.components.light import Light, SUPPORT_BRIGHTNESS
import homeassistant.components.isy994 as isy
from homeassistant.const import STATE_ON, STATE_OFF, STATE_UNKNOWN
from homeassistant.helpers.typing import ConfigType
@ -19,8 +19,8 @@ VALUE_TO_STATE = {
True: STATE_ON,
}
UOM = ['2', '78']
STATES = [STATE_OFF, STATE_ON, 'true', 'false']
UOM = ['2', '51', '78']
STATES = [STATE_OFF, STATE_ON, 'true', 'false', '%']
# pylint: disable=unused-argument
@ -35,7 +35,7 @@ def setup_platform(hass, config: ConfigType,
for node in isy.filter_nodes(isy.NODES, units=UOM,
states=STATES):
if node.dimmable:
if node.dimmable or node.uom == '51':
devices.append(ISYLightDevice(node))
add_devices(devices)
@ -60,10 +60,15 @@ class ISYLightDevice(isy.ISYDevice, Light):
def turn_off(self, **kwargs) -> None:
"""Send the turn off command to the ISY994 light device."""
if not self._node.fastOff():
if not self._node.fastoff():
_LOGGER.debug('Unable to turn on light.')
def turn_on(self, brightness=100, **kwargs) -> None:
"""Send the turn on command to the ISY994 light device."""
if not self._node.on(val=brightness):
_LOGGER.debug('Unable to turn on light.')
@property
def supported_features(self):
"""Flag supported features."""
return SUPPORT_BRIGHTNESS