Fix blank line regression
parent
dfae1a44a6
commit
2a0d459722
|
@ -49,18 +49,21 @@ _LOGGER = logging.getLogger(__name__)
|
|||
def is_on(hass, entity_id=None):
|
||||
""" Returns 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. """
|
||||
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. """
|
||||
data = {ATTR_ENTITY_ID: entity_id} if entity_id else None
|
||||
|
||||
hass.services.call(DOMAIN, SERVICE_TURN_OFF, data)
|
||||
|
||||
|
||||
|
@ -85,6 +88,7 @@ def setup(hass, config):
|
|||
switch.update_ha_state(True)
|
||||
|
||||
hass.services.register(DOMAIN, SERVICE_TURN_OFF, handle_switch_service)
|
||||
|
||||
hass.services.register(DOMAIN, SERVICE_TURN_ON, handle_switch_service)
|
||||
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue