From 2a0d459722a0f3e112ff9f9c384920d0d53da330 Mon Sep 17 00:00:00 2001 From: pavoni Date: Sat, 29 Aug 2015 00:27:28 +0100 Subject: [PATCH] Fix blank line regression --- homeassistant/components/switch/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/homeassistant/components/switch/__init__.py b/homeassistant/components/switch/__init__.py index 60411b2815e..4f83b8aa24f 100644 --- a/homeassistant/components/switch/__init__.py +++ b/homeassistant/components/switch/__init__.py @@ -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