Updated docstrings (#7383)
* Updated docstrings * Updated docstrings * Updated docstrings * Update docstrings * Update more docstrings
This commit is contained in:
parent
6aac53399d
commit
86cfc2a0ed
35 changed files with 56 additions and 56 deletions
|
@ -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
|
||||||
|
|
|
@ -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):
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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):
|
||||||
|
|
|
@ -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."""
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -27,7 +27,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
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
|
||||||
|
|
|
@ -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()
|
||||||
|
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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(
|
||||||
|
|
|
@ -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'])
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue