Update docstrings
This commit is contained in:
parent
bd8881cbe1
commit
635369ad65
3 changed files with 18 additions and 20 deletions
|
@ -41,7 +41,7 @@ def turn_off(hass, entity_id):
|
|||
|
||||
|
||||
def setup(hass, config):
|
||||
"""Set up input booleans."""
|
||||
""" Set up input boolean. """
|
||||
if not isinstance(config.get(DOMAIN), dict):
|
||||
_LOGGER.error('Expected %s config to be a dictionary', DOMAIN)
|
||||
return False
|
||||
|
@ -68,7 +68,7 @@ def setup(hass, config):
|
|||
return False
|
||||
|
||||
def toggle_service(service):
|
||||
"""Handle a calls to the input boolean services."""
|
||||
""" Handle a calls to the input boolean services. """
|
||||
target_inputs = component.extract_from_service(service)
|
||||
|
||||
for input_b in target_inputs:
|
||||
|
@ -86,10 +86,10 @@ def setup(hass, config):
|
|||
|
||||
|
||||
class InputBoolean(ToggleEntity):
|
||||
"""Represent a boolean input within Home Assistant."""
|
||||
""" Represent a boolean input. """
|
||||
|
||||
def __init__(self, object_id, name, state, icon):
|
||||
"""Initialize a boolean input."""
|
||||
""" Initialize a boolean input. """
|
||||
self.entity_id = ENTITY_ID_FORMAT.format(object_id)
|
||||
self._name = name
|
||||
self._state = state
|
||||
|
|
|
@ -14,9 +14,7 @@ from homeassistant.helpers.entity import Entity
|
|||
from homeassistant.util import slugify
|
||||
|
||||
DOMAIN = 'input_select'
|
||||
|
||||
ENTITY_ID_FORMAT = DOMAIN + '.{}'
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
CONF_NAME = 'name'
|
||||
|
@ -31,7 +29,7 @@ SERVICE_SELECT_OPTION = 'select_option'
|
|||
|
||||
|
||||
def select_option(hass, entity_id, option):
|
||||
"""Set input_boolean to False."""
|
||||
""" Set input_select to False. """
|
||||
hass.services.call(DOMAIN, SERVICE_SELECT_OPTION, {
|
||||
ATTR_ENTITY_ID: entity_id,
|
||||
ATTR_OPTION: option,
|
||||
|
@ -39,7 +37,7 @@ def select_option(hass, entity_id, option):
|
|||
|
||||
|
||||
def setup(hass, config):
|
||||
"""Set up input booleans."""
|
||||
""" Set up input select. """
|
||||
if not isinstance(config.get(DOMAIN), dict):
|
||||
_LOGGER.error('Expected %s config to be a dictionary', DOMAIN)
|
||||
return False
|
||||
|
@ -79,7 +77,7 @@ def setup(hass, config):
|
|||
return False
|
||||
|
||||
def select_option_service(call):
|
||||
"""Handle a calls to the input boolean services."""
|
||||
""" Handle a calls to the input select services. """
|
||||
target_inputs = component.extract_from_service(call)
|
||||
|
||||
for input_select in target_inputs:
|
||||
|
@ -94,11 +92,11 @@ def setup(hass, config):
|
|||
|
||||
|
||||
class InputSelect(Entity):
|
||||
"""Represent a select input within Home Assistant."""
|
||||
""" Represent a select input. """
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(self, object_id, name, state, options, icon):
|
||||
"""Initialize a boolean input."""
|
||||
""" Initialize a select input. """
|
||||
self.entity_id = ENTITY_ID_FORMAT.format(object_id)
|
||||
self._name = name
|
||||
self._current_option = state
|
||||
|
@ -107,33 +105,33 @@ class InputSelect(Entity):
|
|||
|
||||
@property
|
||||
def should_poll(self):
|
||||
"""If entitiy should be polled."""
|
||||
""" If entity should be polled. """
|
||||
return False
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Name of the boolean input."""
|
||||
""" Name of the select input. """
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
"""Icon to be used for this entity."""
|
||||
""" Icon to be used for this entity. """
|
||||
return self._icon
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
"""State of the component."""
|
||||
""" State of the component. """
|
||||
return self._current_option
|
||||
|
||||
@property
|
||||
def state_attributes(self):
|
||||
"""State attributes."""
|
||||
""" State attributes. """
|
||||
return {
|
||||
ATTR_OPTIONS: self._options,
|
||||
}
|
||||
|
||||
def select_option(self, option):
|
||||
"""Select new option."""
|
||||
""" Select new option. """
|
||||
if option not in self._options:
|
||||
_LOGGER.warning('Invalid option: %s (possible options: %s)',
|
||||
option, ', '.join(self._options))
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""
|
||||
homeassistant.components.insteon
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
homeassistant.components.insteon_hub
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Support for Insteon Hub.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/insteon/
|
||||
https://home-assistant.io/components/insteon_hub/
|
||||
"""
|
||||
import logging
|
||||
import homeassistant.bootstrap as bootstrap
|
||||
|
|
Loading…
Add table
Reference in a new issue