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