From 8db1b74a3c7c36ed6ae8d4680d424ee16f0d6fdb Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 27 Sep 2014 07:18:55 -0700 Subject: [PATCH] device_sun_light_trigger: added option to disable turning devices off when all people gone --- config/home-assistant.conf.example | 2 ++ homeassistant/components/device_sun_light_trigger.py | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config/home-assistant.conf.example b/config/home-assistant.conf.example index 4af628853b7..38dd4d53f70 100644 --- a/config/home-assistant.conf.example +++ b/config/home-assistant.conf.example @@ -36,6 +36,8 @@ download_dir=downloads light_group=group.living_room # Optional: specify which light profile to use when turning lights on light_profile=relax +# Optional: disable lights being turned off when everybody leaves the house +# disable_turn_off=1 # A comma seperated list of states that have to be tracked as a single group # Grouped states should share the same type of states (ON/OFF or HOME/NOT_HOME) diff --git a/homeassistant/components/device_sun_light_trigger.py b/homeassistant/components/device_sun_light_trigger.py index 99ba0906be5..7a2ff2f5bdd 100644 --- a/homeassistant/components/device_sun_light_trigger.py +++ b/homeassistant/components/device_sun_light_trigger.py @@ -27,6 +27,8 @@ CONF_LIGHT_GROUP = 'light_group' def setup(hass, config): """ Triggers to turn lights on or off based on device precense. """ + disable_turn_off = 'disable_turn_off' in config[DOMAIN] + light_group = config[DOMAIN].get(CONF_LIGHT_GROUP, light.GROUP_NAME_ALL_LIGHTS) @@ -143,10 +145,11 @@ def setup(hass, config): # Did all devices leave the house? elif (entity == device_tracker.ENTITY_ID_ALL_DEVICES and - new_state.state == components.STATE_NOT_HOME and lights_are_on): + new_state.state == components.STATE_NOT_HOME and lights_are_on + and not disable_turn_off): logger.info( - "Everyone has left but there are devices on. Turning them off") + "Everyone has left but there are lights on. Turning them off") light.turn_off(hass)