Updated docstrings (#7383)

* Updated docstrings

* Updated docstrings

* Updated docstrings

* Update docstrings

* Update more docstrings
This commit is contained in:
Alok Saboo 2017-04-30 23:10:08 -04:00 committed by Paulus Schoutsen
parent 6aac53399d
commit 86cfc2a0ed
35 changed files with 56 additions and 56 deletions

View file

@ -55,7 +55,7 @@ class NetatmoCamera(Camera):
"""Representation of the images published from a Netatmo camera.""" """Representation of the images published from a Netatmo camera."""
def __init__(self, data, camera_name, home, camera_type, verify_ssl): def __init__(self, data, camera_name, home, camera_type, verify_ssl):
"""Setup for access to the Netatmo camera images.""" """Set up access to the Netatmo camera images."""
super(NetatmoCamera, self).__init__() super(NetatmoCamera, self).__init__()
self._data = data self._data = data
self._camera_name = camera_name self._camera_name = camera_name

View file

@ -48,7 +48,7 @@ class ProliphixThermostat(ClimateDevice):
@property @property
def should_poll(self): def should_poll(self):
"""Polling needed for thermostat.""" """Set up polling needed for thermostat."""
return True return True
def update(self): def update(self):

View file

@ -17,7 +17,7 @@ _LOGGER = logging.getLogger(__name__)
def setup_scanner(hass, config, see, discovery_info=None): def setup_scanner(hass, config, see, discovery_info=None):
"""Set up the MySensors tracker.""" """Set up the MySensors tracker."""
def mysensors_callback(gateway, msg): def mysensors_callback(gateway, msg):
"""Callback for mysensors platform.""" """Set up callback for mysensors platform."""
node = gateway.sensors[msg.node_id] node = gateway.sensors[msg.node_id]
if node.sketch_name is None: if node.sketch_name is None:
_LOGGER.debug("No sketch_name: node %s", msg.node_id) _LOGGER.debug("No sketch_name: node %s", msg.node_id)

View file

@ -234,7 +234,7 @@ class Config(object):
return is_default_exposed or explicit_expose return is_default_exposed or explicit_expose
def _load_numbers_json(self): def _load_numbers_json(self):
"""Helper method to load numbers json.""" """Set up helper method to load numbers json."""
try: try:
with open(self.hass.config.path(NUMBERS_FILE), with open(self.hass.config.path(NUMBERS_FILE),
encoding='utf-8') as fil: encoding='utf-8') as fil:
@ -247,7 +247,7 @@ class Config(object):
return {} return {}
def _save_numbers_json(self): def _save_numbers_json(self):
"""Helper method to save numbers json.""" """Set up helper method to save numbers json."""
try: try:
with open(self.hass.config.path(NUMBERS_FILE), 'w', with open(self.hass.config.path(NUMBERS_FILE), 'w',
encoding='utf-8') as fil: encoding='utf-8') as fil:

View file

@ -54,7 +54,7 @@ class BlinkStickLight(Light):
@property @property
def should_poll(self): def should_poll(self):
"""Polling needed.""" """Set up polling."""
return True return True
@property @property

View file

@ -34,7 +34,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the EnOcean light platform.""" """Set up the EnOcean light platform."""
sender_id = config.get(CONF_SENDER_ID) sender_id = config.get(CONF_SENDER_ID)
devname = config.get(CONF_NAME) devname = config.get(CONF_NAME)
dev_id = config.get(CONF_ID) dev_id = config.get(CONF_ID)

View file

@ -94,7 +94,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Flux lights.""" """Set up the Flux lights."""
import flux_led import flux_led
lights = [] lights = []
light_ips = [] light_ips = []

View file

@ -18,7 +18,7 @@ SUPPORT_HOMEMATIC = SUPPORT_BRIGHTNESS
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Homematic light platform.""" """Set up the Homematic light platform."""
if discovery_info is None: if discovery_info is None:
return return

View file

@ -104,7 +104,7 @@ def _find_host_from_config(hass, filename=PHUE_CONFIG_FILE):
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Hue lights.""" """Set up the Hue lights."""
# Default needed in case of discovery # Default needed in case of discovery
filename = config.get(CONF_FILENAME, PHUE_CONFIG_FILE) filename = config.get(CONF_FILENAME, PHUE_CONFIG_FILE)
allow_unreachable = config.get(CONF_ALLOW_UNREACHABLE, allow_unreachable = config.get(CONF_ALLOW_UNREACHABLE,
@ -140,7 +140,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
def setup_bridge(host, hass, add_devices, filename, allow_unreachable, def setup_bridge(host, hass, add_devices, filename, allow_unreachable,
allow_in_emulated_hue, allow_hue_groups): allow_in_emulated_hue, allow_hue_groups):
"""Setup a phue bridge based on host parameter.""" """Set up a phue bridge based on host parameter."""
import phue import phue
try: try:
@ -273,7 +273,7 @@ def request_configuration(host, hass, add_devices, filename,
# pylint: disable=unused-argument # pylint: disable=unused-argument
def hue_configuration_callback(data): def hue_configuration_callback(data):
"""The actions to do when our configuration callback is called.""" """Set up actions to do when our configuration callback is called."""
setup_bridge(host, hass, add_devices, filename, allow_unreachable, setup_bridge(host, hass, add_devices, filename, allow_unreachable,
allow_in_emulated_hue, allow_hue_groups) allow_in_emulated_hue, allow_hue_groups)

View file

@ -36,7 +36,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup a Hyperion server remote.""" """Set up a Hyperion server remote."""
host = config.get(CONF_HOST) host = config.get(CONF_HOST)
port = config.get(CONF_PORT) port = config.get(CONF_PORT)
default_color = config.get(CONF_DEFAULT_COLOR) default_color = config.get(CONF_DEFAULT_COLOR)

View file

@ -14,7 +14,7 @@ SUPPORT_INSTEON_HUB = SUPPORT_BRIGHTNESS
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Insteon Hub light platform.""" """Set up the Insteon Hub light platform."""
devs = [] devs = []
for device in INSTEON.devices: for device in INSTEON.devices:
if device.DeviceCategory == "Switched Lighting Control": if device.DeviceCategory == "Switched Lighting Control":

View file

@ -64,7 +64,7 @@ def request_configuration(device_id, insteonhub, model, hass,
return return
def insteon_light_config_callback(data): def insteon_light_config_callback(data):
"""The actions to do when our configuration callback is called.""" """Set up actions to do when our configuration callback is called."""
setup_light(device_id, data.get('name'), insteonhub, hass, setup_light(device_id, data.get('name'), insteonhub, hass,
add_devices_callback) add_devices_callback)

View file

@ -25,7 +25,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the KNX light platform.""" """Set up the KNX light platform."""
add_devices([KNXLight(hass, KNXConfig(config))]) add_devices([KNXLight(hass, KNXConfig(config))])

View file

@ -48,7 +48,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the LIFX platform.""" """Set up the LIFX platform."""
server_addr = config.get(CONF_SERVER) server_addr = config.get(CONF_SERVER)
broadcast_addr = config.get(CONF_BROADCAST) broadcast_addr = config.get(CONF_BROADCAST)
@ -121,7 +121,7 @@ class LIFX(object):
# pylint: disable=unused-argument # pylint: disable=unused-argument
def poll(self, now): def poll(self, now):
"""Polling for the light.""" """Set up polling for the light."""
self.probe() self.probe()
def probe(self, address=None): def probe(self, address=None):

View file

@ -95,7 +95,7 @@ def rewrite_legacy(config):
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the LimitlessLED lights.""" """Set up the LimitlessLED lights."""
from limitlessled.bridge import Bridge from limitlessled.bridge import Bridge
# Two legacy configuration formats are supported to maintain backwards # Two legacy configuration formats are supported to maintain backwards
@ -123,7 +123,7 @@ def state(new_state):
Specify True (turn on) or False (turn off). Specify True (turn on) or False (turn off).
""" """
def decorator(function): def decorator(function):
"""Decorator function.""" """Set up the decorator function."""
# pylint: disable=no-member,protected-access # pylint: disable=no-member,protected-access
def wrapper(self, **kwargs): def wrapper(self, **kwargs):
"""Wrap a group state change.""" """Wrap a group state change."""

View file

@ -57,7 +57,7 @@ class LiteJetLight(Light):
@property @property
def name(self): def name(self):
"""The light's name.""" """Set up the light's name."""
return self._name return self._name
@property @property

View file

@ -13,7 +13,7 @@ _LOGGER = logging.getLogger(__name__)
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup Lutron lights.""" """Set up Lutron lights."""
devs = [] devs = []
for (area_name, device) in hass.data[LUTRON_DEVICES]['light']: for (area_name, device) in hass.data[LUTRON_DEVICES]['light']:
dev = LutronLight(area_name, device, hass.data[LUTRON_CONTROLLER]) dev = LutronLight(area_name, device, hass.data[LUTRON_CONTROLLER])
@ -82,6 +82,6 @@ class LutronLight(LutronDevice, Light):
return self._lutron_device.last_level() > 0 return self._lutron_device.last_level() > 0
def update(self): def update(self):
"""Called when forcing a refresh of the device.""" """Call when forcing a refresh of the device."""
if self._prev_brightness is None: if self._prev_brightness is None:
self._prev_brightness = to_hass_level(self._lutron_device.level) self._prev_brightness = to_hass_level(self._lutron_device.level)

View file

@ -16,7 +16,7 @@ DEPENDENCIES = ['lutron_caseta']
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup Lutron Caseta lights.""" """Set up Lutron Caseta lights."""
devs = [] devs = []
bridge = hass.data[LUTRON_CASETA_SMARTBRIDGE] bridge = hass.data[LUTRON_CASETA_SMARTBRIDGE]
light_devices = bridge.get_devices_by_types(["WallDimmer", "PlugInDimmer"]) light_devices = bridge.get_devices_by_types(["WallDimmer", "PlugInDimmer"])
@ -59,6 +59,6 @@ class LutronCasetaLight(LutronCasetaDevice, Light):
return self._state["current_state"] > 0 return self._state["current_state"] > 0
def update(self): def update(self):
"""Called when forcing a refresh of the device.""" """Call when forcing a refresh of the device."""
self._state = self._smartbridge.get_device_by_id(self._device_id) self._state = self._smartbridge.get_device_by_id(self._device_id)
_LOGGER.debug(self._state) _LOGGER.debug(self._state)

View file

@ -71,7 +71,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
@asyncio.coroutine @asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Setup a MQTT JSON Light.""" """Set up a MQTT JSON Light."""
if discovery_info is not None: if discovery_info is not None:
config = PLATFORM_SCHEMA(discovery_info) config = PLATFORM_SCHEMA(discovery_info)
async_add_devices([MqttJson( async_add_devices([MqttJson(

View file

@ -65,7 +65,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
@asyncio.coroutine @asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Setup a MQTT Template light.""" """Set up a MQTT Template light."""
if discovery_info is not None: if discovery_info is not None:
config = PLATFORM_SCHEMA(discovery_info) config = PLATFORM_SCHEMA(discovery_info)

View file

@ -25,7 +25,7 @@ SUPPORT_MYSENSORS = (SUPPORT_BRIGHTNESS | SUPPORT_RGB_COLOR |
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the mysensors platform for sensors.""" """Set up the mysensors platform for sensors."""
# Only act if loaded via mysensors by discovery event. # Only act if loaded via mysensors by discovery event.
# Otherwise gateway is not setup. # Otherwise gateway is not setup.
if discovery_info is None: if discovery_info is None:
@ -65,7 +65,7 @@ class MySensorsLight(mysensors.MySensorsDeviceEntity, Light):
"""Represent the value of a MySensors Light child node.""" """Represent the value of a MySensors Light child node."""
def __init__(self, *args): def __init__(self, *args):
"""Setup instance attributes.""" """Set up instance attributes."""
mysensors.MySensorsDeviceEntity.__init__(self, *args) mysensors.MySensorsDeviceEntity.__init__(self, *args)
self._state = None self._state = None
self._brightness = None self._brightness = None

View file

@ -39,7 +39,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Osram Lightify lights.""" """Set up the Osram Lightify lights."""
import lightify import lightify
host = config.get(CONF_HOST) host = config.get(CONF_HOST)
if host: if host:
@ -57,7 +57,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
def setup_bridge(bridge, add_devices_callback): def setup_bridge(bridge, add_devices_callback):
"""Setup the Lightify bridge.""" """Set up the Lightify bridge."""
lights = {} lights = {}
@util.Throttle(MIN_TIME_BETWEEN_SCANS, MIN_TIME_BETWEEN_FORCED_SCANS) @util.Throttle(MIN_TIME_BETWEEN_SCANS, MIN_TIME_BETWEEN_FORCED_SCANS)

View file

@ -20,14 +20,14 @@ SUPPORT_RFXTRX = SUPPORT_BRIGHTNESS
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the RFXtrx platform.""" """Set up the RFXtrx platform."""
import RFXtrx as rfxtrxmod import RFXtrx as rfxtrxmod
lights = rfxtrx.get_devices_from_config(config, RfxtrxLight) lights = rfxtrx.get_devices_from_config(config, RfxtrxLight)
add_devices(lights) add_devices(lights)
def light_update(event): def light_update(event):
"""Callback for light updates from the RFXtrx gateway.""" """Define callback for light updates from the RFXtrx gateway."""
if not isinstance(event.device, rfxtrxmod.LightingDevice) or \ if not isinstance(event.device, rfxtrxmod.LightingDevice) or \
not event.device.known_to_be_dimmable: not event.device.known_to_be_dimmable:
return return

View file

@ -55,7 +55,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the pwm lights.""" """Set up the pwm lights."""
from pwmled.led import SimpleLed from pwmled.led import SimpleLed
from pwmled.led.rgb import RgbLed from pwmled.led.rgb import RgbLed
from pwmled.led.rgbw import RgbwLed from pwmled.led.rgbw import RgbwLed

View file

@ -24,7 +24,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the SCSGate switches.""" """Set up the SCSGate switches."""
devices = config.get(CONF_DEVICES) devices = config.get(CONF_DEVICES)
lights = [] lights = []
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -17,7 +17,7 @@ _LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup lights.""" """Set up lights."""
if discovery_info is None: if discovery_info is None:
return return
add_devices(TelldusLiveLight(hass, light) for light in discovery_info) add_devices(TelldusLiveLight(hass, light) for light in discovery_info)
@ -32,7 +32,7 @@ class TelldusLiveLight(TelldusLiveEntity, Light):
self._last_brightness = self.brightness self._last_brightness = self.brightness
def changed(self): def changed(self):
"""A property of the device might have changed.""" """Define a property of the device that might have changed."""
self._last_brightness = self.brightness self._last_brightness = self.brightness
super().changed() super().changed()

View file

@ -20,7 +20,7 @@ SUPPORT_TELLSTICK = SUPPORT_BRIGHTNESS
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup Tellstick lights.""" """Set up Tellstick lights."""
if (discovery_info is None or if (discovery_info is None or
discovery_info[ATTR_DISCOVER_DEVICES] is None): discovery_info[ATTR_DISCOVER_DEVICES] is None):
return return

View file

@ -20,7 +20,7 @@ ALLOWED_TEMPERATURES = {
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the IKEA Tradfri Light platform.""" """Set up the IKEA Tradfri Light platform."""
if discovery_info is None: if discovery_info is None:
return return

View file

@ -20,7 +20,7 @@ SUPPORT_VERA = SUPPORT_BRIGHTNESS
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup Vera lights.""" """Set up Vera lights."""
add_devices( add_devices(
VeraLight(device, VERA_CONTROLLER) for device in VERA_DEVICES['light']) VeraLight(device, VERA_CONTROLLER) for device in VERA_DEVICES['light'])
@ -67,5 +67,5 @@ class VeraLight(VeraDevice, Light):
return self._state return self._state
def update(self): def update(self):
"""Called by the vera device callback to update state.""" """Call to update state."""
self._state = self.vera_device.is_switched_on() self._state = self.vera_device.is_switched_on()

View file

@ -26,7 +26,7 @@ SUPPORT_WEMO = (SUPPORT_BRIGHTNESS | SUPPORT_COLOR_TEMP | SUPPORT_RGB_COLOR |
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup WeMo bridges and register connected lights.""" """Set up WeMo bridges and register connected lights."""
import pywemo.discovery as discovery import pywemo.discovery as discovery
if discovery_info is not None: if discovery_info is not None:
@ -39,7 +39,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
def setup_bridge(bridge, add_devices): def setup_bridge(bridge, add_devices):
"""Setup a WeMo link.""" """Set up a WeMo link."""
lights = {} lights = {}
@util.Throttle(MIN_TIME_BETWEEN_SCANS, MIN_TIME_BETWEEN_FORCED_SCANS) @util.Throttle(MIN_TIME_BETWEEN_SCANS, MIN_TIME_BETWEEN_FORCED_SCANS)
@ -97,7 +97,7 @@ class WemoLight(Light):
@property @property
def is_on(self): def is_on(self):
"""True if device is on.""" """Set True if device is on."""
return self.device.state['onoff'] != 0 return self.device.state['onoff'] != 0
@property @property

View file

@ -22,7 +22,7 @@ RGB_MODES = ['hsb', 'rgb']
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Wink lights.""" """Set up the Wink lights."""
import pywink import pywink
for light in pywink.get_light_bulbs(): for light in pywink.get_light_bulbs():
@ -53,7 +53,7 @@ class WinkLight(WinkDevice, Light):
@property @property
def rgb_color(self): def rgb_color(self):
"""Current bulb color in RGB.""" """Define current bulb color in RGB."""
if not self.wink.supports_hue_saturation(): if not self.wink.supports_hue_saturation():
return None return None
elif self.wink.color_model() not in RGB_MODES: elif self.wink.color_model() not in RGB_MODES:
@ -72,14 +72,14 @@ class WinkLight(WinkDevice, Light):
@property @property
def xy_color(self): def xy_color(self):
"""Current bulb color in CIE 1931 (XY) color space.""" """Define current bulb color in CIE 1931 (XY) color space."""
if not self.wink.supports_xy_color(): if not self.wink.supports_xy_color():
return None return None
return self.wink.color_xy() return self.wink.color_xy()
@property @property
def color_temp(self): def color_temp(self):
"""Current bulb color in degrees Kelvin.""" """Define current bulb color in degrees Kelvin."""
if not self.wink.supports_temperature(): if not self.wink.supports_temperature():
return None return None
return color_util.color_temperature_kelvin_to_mired( return color_util.color_temperature_kelvin_to_mired(

View file

@ -40,7 +40,7 @@ def get_unit_status(code):
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the x10 Light platform.""" """Set up the x10 Light platform."""
try: try:
x10_command('info') x10_command('info')
except CalledProcessError as err: except CalledProcessError as err:

View file

@ -54,7 +54,7 @@ SUPPORT_YEELIGHT_RGB = (SUPPORT_YEELIGHT |
def _cmd(func): def _cmd(func):
"""A wrapper to catch exceptions from the bulb.""" """Define a wrapper to catch exceptions from the bulb."""
def _wrap(self, *args, **kwargs): def _wrap(self, *args, **kwargs):
import yeelight import yeelight
try: try:
@ -67,7 +67,7 @@ def _cmd(func):
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Yeelight bulbs.""" """Set up Yeelight bulbs."""
lights = [] lights = []
if discovery_info is not None: if discovery_info is not None:
_LOGGER.debug("Adding autodetected %s", discovery_info['hostname']) _LOGGER.debug("Adding autodetected %s", discovery_info['hostname'])

View file

@ -17,7 +17,7 @@ DEPENDENCIES = ['zha']
@asyncio.coroutine @asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Setup Zigbee Home Automation lights.""" """Set up Zigbee Home Automation lights."""
discovery_info = zha.get_discovery_info(hass, discovery_info) discovery_info = zha.get_discovery_info(hass, discovery_info)
if discovery_info is None: if discovery_info is None:
return return

View file

@ -113,19 +113,19 @@ class ZwaveDimmer(zwave.ZWaveDeviceEntity, Light):
self._brightness, self._state = brightness_state(self.values.primary) self._brightness, self._state = brightness_state(self.values.primary)
def value_added(self): def value_added(self):
"""Called when a new value is added to this entity.""" """Call when a new value is added to this entity."""
self._supported_features = SUPPORT_BRIGHTNESS self._supported_features = SUPPORT_BRIGHTNESS
if self.values.dimming_duration is not None: if self.values.dimming_duration is not None:
self._supported_features |= SUPPORT_TRANSITION self._supported_features |= SUPPORT_TRANSITION
def value_changed(self): def value_changed(self):
"""Called when a value for this entity's node has changed.""" """Call when a value for this entity's node has changed."""
if self._refresh_value: if self._refresh_value:
if self._refreshing: if self._refreshing:
self._refreshing = False self._refreshing = False
else: else:
def _refresh_value(): def _refresh_value():
"""Used timer callback for delayed value refresh.""" """Use timer callback for delayed value refresh."""
self._refreshing = True self._refreshing = True
self.values.primary.refresh() self.values.primary.refresh()
@ -218,7 +218,7 @@ class ZwaveColorLight(ZwaveDimmer):
super().__init__(values, refresh, delay) super().__init__(values, refresh, delay)
def value_added(self): def value_added(self):
"""Called when a new value is added to this entity.""" """Call when a new value is added to this entity."""
super().value_added() super().value_added()
self._supported_features |= SUPPORT_RGB_COLOR self._supported_features |= SUPPORT_RGB_COLOR