Fix PEP257 issues

This commit is contained in:
Fabian Affolter committed 2016-03-08 13:35:39 +01:00
1 parent 652f059d6a
commit 49ebc6d0b0
29 files changed
+294 -309

No files matched your search

+12 -14
View File
@@ -1,6 +1,4 @@
"""
homeassistant.components.switch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Component to interface with various switches that can be controlled remotely.
For more details about this component, please refer to the documentation
@@ -53,38 +51,38 @@ _LOGGER = logging.getLogger(__name__)
def is_on(hass, entity_id=None):
""" Returns if the switch is on based on the statemachine. """
"""Return if the switch is on based on the statemachine."""
entity_id = entity_id or ENTITY_ID_ALL_SWITCHES
return hass.states.is_state(entity_id, STATE_ON)
def turn_on(hass, entity_id=None):
""" Turns all or specified switch on. """
"""Turn all or specified switch on."""
data = {ATTR_ENTITY_ID: entity_id} if entity_id else None
hass.services.call(DOMAIN, SERVICE_TURN_ON, data)
def turn_off(hass, entity_id=None):
""" Turns all or specified switch off. """
"""Turn all or specified switch off."""
data = {ATTR_ENTITY_ID: entity_id} if entity_id else None
hass.services.call(DOMAIN, SERVICE_TURN_OFF, data)
def toggle(hass, entity_id=None):
""" Toggle all or specified switch. """
"""Toggle all or specified switch."""
data = {ATTR_ENTITY_ID: entity_id} if entity_id else None
hass.services.call(DOMAIN, SERVICE_TOGGLE, data)
def setup(hass, config):
""" Track states and offer events for switches. """
"""Track states and offer events for switches."""
component = EntityComponent(
_LOGGER, DOMAIN, hass, SCAN_INTERVAL, DISCOVERY_PLATFORMS,
GROUP_NAME_ALL_SWITCHES)
component.setup(config)
def handle_switch_service(service):
""" Handles calls to the switch services. """
"""Handle calls to the switch services."""
target_switches = component.extract_from_service(service)
for switch in target_switches:
@@ -111,27 +109,27 @@ def setup(hass, config):
class SwitchDevice(ToggleEntity):
""" Represents a switch within Home Assistant. """
# pylint: disable=no-self-use
"""Representation of a switch."""
# pylint: disable=no-self-use
@property
def current_power_mwh(self):
""" Current power usage in mwh. """
"""Return the current power usage in mWh."""
return None
@property
def today_power_mw(self):
""" Today total power usage in mw. """
"""Return the today total power usage in mW."""
return None
@property
def is_standby(self):
""" Is the device in standby. """
"""Return true if device is in standby."""
return None
@property
def state_attributes(self):
""" Returns optional state attributes. """
"""Return the optional state attributes."""
data = {}
for prop, attr in PROP_TO_ATTR.items():