Skip to content

Commit

Permalink
flash hallway light when leaving as confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
lociii committed Oct 14, 2018
1 parent 355df02 commit 1e75271
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions appdaemon/apps/globals.py
Expand Up @@ -4,6 +4,8 @@
NIGHT_OFFSET_LIGHT = -900
NIGHT_OFFSET_COVER = 900

HALLWAY_LIGHT = 'light.flur__flur'

# all covers
COVERS_ALL = [
'cover.schlafzimmer__rolladen_schlafzimmer',
Expand Down
19 changes: 18 additions & 1 deletion appdaemon/apps/presence/presence.py
Expand Up @@ -3,7 +3,7 @@
from globals import DAY_START, NIGHT_START
from globals import COVERS_ALL, COVERS_NIGHT_ABSENT
from globals import LIGHTS_ALL, LIGHTS_NIGHT_ABSENT, LIGHTS_NIGHT_RETURNING
from globals import FANS
from globals import FANS, HALLWAY_LIGHT
from globals import GOOGLE_TTS_DEVICE
from globals import SENSOR_APARTMENT_PRESENCE

Expand Down Expand Up @@ -40,6 +40,19 @@ def leaving(self, entity, attribute, old, new, kwargs):
# start fan loop, activate for 10 minutes every 15 minutes
self.absent_turn_on_fans()

def flash_hallway_light(self, *args, **kwargs):
self.turn_on(HALLWAY_LIGHT)
time.sleep(1)
self.turn_off(HALLWAY_LIGHT)
time.sleep(1)
self.turn_on(HALLWAY_LIGHT)
time.sleep(1)
self.turn_off(HALLWAY_LIGHT)
time.sleep(1)
self.turn_on(HALLWAY_LIGHT)
time.sleep(1)
self.turn_off(HALLWAY_LIGHT)

def absent_turn_on_fans(self, *args, **kwargs):
self.log('absent - turn fans on')

Expand All @@ -63,6 +76,8 @@ def absent_turn_off_fans(self, *args, **kwargs):
def leaving_night(self, entity, attribute, old, new, kwargs):
self.log('leaving at night')

self.flash_hallway_light()

# close all covers
for cover in COVERS_ALL:
self.call_service('cover/close_cover', entity_id=cover)
Expand All @@ -79,6 +94,8 @@ def leaving_night(self, entity, attribute, old, new, kwargs):
def leaving_day(self, entity, attribute, old, new, kwargs):
self.log('leaving at day')

self.flash_hallway_light()

# turn all lights off
for light in LIGHTS_ALL:
self.turn_off(entity_id=light)
Expand Down

0 comments on commit 1e75271

Please sign in to comment.