Update docstrings and log messages (#7526)
This commit is contained in:
parent
6e6a000217
commit
71b4afb780
8 changed files with 45 additions and 43 deletions
|
@ -31,7 +31,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||
|
||||
# pylint: disable=unused-argument
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Add device specified by serial number."""
|
||||
"""Set up Blinkstick device specified by serial number."""
|
||||
from blinkstick import blinkstick
|
||||
|
||||
name = config.get(CONF_NAME)
|
||||
|
|
|
@ -20,14 +20,13 @@ _LOGGER = logging.getLogger(__name__)
|
|||
CONF_SENDER_ID = 'sender_id'
|
||||
|
||||
DEFAULT_NAME = 'EnOcean Light'
|
||||
|
||||
DEPENDENCIES = ['enocean']
|
||||
|
||||
SUPPORT_ENOCEAN = SUPPORT_BRIGHTNESS
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
vol.Optional(CONF_ID, default=[]): vol.All(cv.ensure_list,
|
||||
[vol.Coerce(int)]),
|
||||
vol.Optional(CONF_ID, default=[]):
|
||||
vol.All(cv.ensure_list, [vol.Coerce(int)]),
|
||||
vol.Required(CONF_SENDER_ID): vol.All(cv.ensure_list, [vol.Coerce(int)]),
|
||||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
||||
})
|
||||
|
|
|
@ -35,26 +35,26 @@ SUPPORT_FLUX_LED_RGBW = (SUPPORT_WHITE_VALUE | SUPPORT_EFFECT |
|
|||
MODE_RGB = 'rgb'
|
||||
MODE_RGBW = 'rgbw'
|
||||
|
||||
# List of Supported Effects which aren't already declared in LIGHT
|
||||
EFFECT_RED_FADE = "red_fade"
|
||||
EFFECT_GREEN_FADE = "green_fade"
|
||||
EFFECT_BLUE_FADE = "blue_fade"
|
||||
EFFECT_YELLOW_FADE = "yellow_fade"
|
||||
EFFECT_CYAN_FADE = "cyan_fade"
|
||||
EFFECT_PURPLE_FADE = "purple_fade"
|
||||
EFFECT_WHITE_FADE = "white_fade"
|
||||
EFFECT_RED_GREEN_CROSS_FADE = "rg_cross_fade"
|
||||
EFFECT_RED_BLUE_CROSS_FADE = "rb_cross_fade"
|
||||
EFFECT_GREEN_BLUE_CROSS_FADE = "gb_cross_fade"
|
||||
EFFECT_COLORSTROBE = "colorstrobe"
|
||||
EFFECT_RED_STROBE = "red_strobe"
|
||||
EFFECT_GREEN_STROBE = "green_strobe"
|
||||
EFFECT_BLUE_STOBE = "blue_strobe"
|
||||
EFFECT_YELLOW_STROBE = "yellow_strobe"
|
||||
EFFECT_CYAN_STROBE = "cyan_strobe"
|
||||
EFFECT_PURPLE_STROBE = "purple_strobe"
|
||||
EFFECT_WHITE_STROBE = "white_strobe"
|
||||
EFFECT_COLORJUMP = "colorjump"
|
||||
# List of supported effects which aren't already declared in LIGHT
|
||||
EFFECT_RED_FADE = 'red_fade'
|
||||
EFFECT_GREEN_FADE = 'green_fade'
|
||||
EFFECT_BLUE_FADE = 'blue_fade'
|
||||
EFFECT_YELLOW_FADE = 'yellow_fade'
|
||||
EFFECT_CYAN_FADE = 'cyan_fade'
|
||||
EFFECT_PURPLE_FADE = 'purple_fade'
|
||||
EFFECT_WHITE_FADE = 'white_fade'
|
||||
EFFECT_RED_GREEN_CROSS_FADE = 'rg_cross_fade'
|
||||
EFFECT_RED_BLUE_CROSS_FADE = 'rb_cross_fade'
|
||||
EFFECT_GREEN_BLUE_CROSS_FADE = 'gb_cross_fade'
|
||||
EFFECT_COLORSTROBE = 'colorstrobe'
|
||||
EFFECT_RED_STROBE = 'red_strobe'
|
||||
EFFECT_GREEN_STROBE = 'green_strobe'
|
||||
EFFECT_BLUE_STOBE = 'blue_strobe'
|
||||
EFFECT_YELLOW_STROBE = 'yellow_strobe'
|
||||
EFFECT_CYAN_STROBE = 'cyan_strobe'
|
||||
EFFECT_PURPLE_STROBE = 'purple_strobe'
|
||||
EFFECT_WHITE_STROBE = 'white_strobe'
|
||||
EFFECT_COLORJUMP = 'colorjump'
|
||||
|
||||
FLUX_EFFECT_LIST = [
|
||||
EFFECT_COLORLOOP,
|
||||
|
@ -121,7 +121,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
ipaddr = device['ipaddr']
|
||||
if ipaddr in light_ips:
|
||||
continue
|
||||
device['name'] = device['id'] + " " + ipaddr
|
||||
device['name'] = '{} {}'.format(device['id'], ipaddr)
|
||||
device[ATTR_MODE] = 'rgbw'
|
||||
device[CONF_PROTOCOL] = None
|
||||
light = FluxLight(device)
|
||||
|
@ -167,7 +167,7 @@ class FluxLight(Light):
|
|||
@property
|
||||
def unique_id(self):
|
||||
"""Return the ID of this light."""
|
||||
return "{}.{}".format(self.__class__, self._ipaddr)
|
||||
return '{}.{}'.format(self.__class__, self._ipaddr)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
|
|
@ -84,7 +84,7 @@ def setup_light(device_id, name, insteonhub, hass, add_devices_callback):
|
|||
request_id = _CONFIGURING.pop(device_id)
|
||||
configurator = get_component('configurator')
|
||||
configurator.request_done(request_id)
|
||||
_LOGGER.info("Device configuration done!")
|
||||
_LOGGER.debug("Device configuration done")
|
||||
|
||||
conf_lights = config_from_file(hass.config.path(INSTEON_LOCAL_LIGHTS_CONF))
|
||||
if device_id not in conf_lights:
|
||||
|
@ -107,7 +107,7 @@ def config_from_file(filename, config=None):
|
|||
with open(filename, 'w') as fdesc:
|
||||
fdesc.write(json.dumps(config))
|
||||
except IOError as error:
|
||||
_LOGGER.error('Saving config file failed: %s', error)
|
||||
_LOGGER.error("Saving config file failed: %s", error)
|
||||
return False
|
||||
return True
|
||||
else:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Support for INSTEON lights via PowerLinc Modem.
|
||||
Support for Insteon lights via PowerLinc Modem.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/insteon_plm/
|
||||
|
@ -12,16 +12,16 @@ from homeassistant.components.light import (
|
|||
ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light)
|
||||
from homeassistant.loader import get_component
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DEPENDENCIES = ['insteon_plm']
|
||||
|
||||
MAX_BRIGHTNESS = 255
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
||||
"""Set up the INSTEON PLM device class for the hass platform."""
|
||||
"""Set up the Insteon PLM device."""
|
||||
plm = hass.data['insteon_plm']
|
||||
|
||||
device_list = []
|
||||
|
@ -30,7 +30,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||
address = device.get('address_hex')
|
||||
dimmable = bool('dimmable' in device.get('capabilities'))
|
||||
|
||||
_LOGGER.info('Registered %s with light platform.', name)
|
||||
_LOGGER.info("Registered %s with light platform", name)
|
||||
|
||||
device_list.append(
|
||||
InsteonPLMDimmerDevice(hass, plm, address, name, dimmable)
|
||||
|
@ -72,14 +72,14 @@ class InsteonPLMDimmerDevice(Light):
|
|||
def brightness(self):
|
||||
"""Return the brightness of this light between 0..255."""
|
||||
onlevel = self._plm.get_device_attr(self._address, 'onlevel')
|
||||
_LOGGER.debug('on level for %s is %s', self._address, onlevel)
|
||||
_LOGGER.debug("on level for %s is %s", self._address, onlevel)
|
||||
return int(onlevel)
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
"""Return the boolean response if the node is on."""
|
||||
onlevel = self._plm.get_device_attr(self._address, 'onlevel')
|
||||
_LOGGER.debug('on level for %s is %s', self._address, onlevel)
|
||||
_LOGGER.debug("on level for %s is %s", self._address, onlevel)
|
||||
return bool(onlevel)
|
||||
|
||||
@property
|
||||
|
@ -101,7 +101,7 @@ class InsteonPLMDimmerDevice(Light):
|
|||
@callback
|
||||
def async_light_update(self, message):
|
||||
"""Receive notification from transport that new data exists."""
|
||||
_LOGGER.info('Received update calback from PLM for %s', self._address)
|
||||
_LOGGER.info("Received update calback from PLM for %s", self._address)
|
||||
self._hass.async_add_job(self.async_update_ha_state())
|
||||
|
||||
@asyncio.coroutine
|
||||
|
|
|
@ -24,13 +24,12 @@ def setup_platform(hass, config: ConfigType,
|
|||
add_devices: Callable[[list], None], discovery_info=None):
|
||||
"""Set up the ISY994 light platform."""
|
||||
if isy.ISY is None or not isy.ISY.connected:
|
||||
_LOGGER.error('A connection has not been made to the ISY controller.')
|
||||
_LOGGER.error("A connection has not been made to the ISY controller")
|
||||
return False
|
||||
|
||||
devices = []
|
||||
|
||||
for node in isy.filter_nodes(isy.NODES, units=UOM,
|
||||
states=STATES):
|
||||
for node in isy.filter_nodes(isy.NODES, units=UOM, states=STATES):
|
||||
if node.dimmable or '51' in node.uom:
|
||||
devices.append(ISYLightDevice(node))
|
||||
|
||||
|
@ -57,12 +56,12 @@ 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.off():
|
||||
_LOGGER.debug('Unable to turn on light.')
|
||||
_LOGGER.debug("Unable to turn on light")
|
||||
|
||||
def turn_on(self, brightness=None, **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.')
|
||||
_LOGGER.debug("Unable to turn on light")
|
||||
|
||||
@property
|
||||
def supported_features(self):
|
||||
|
|
|
@ -4,7 +4,6 @@ Support for LimitlessLED bulbs.
|
|||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/light.limitlessled/
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
"""Support for the IKEA Tradfri platform."""
|
||||
"""
|
||||
Support for the IKEA Tradfri platform.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/light.tradfri/
|
||||
"""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.light import (
|
||||
|
|
Loading…
Add table
Reference in a new issue