projects
/
svn42.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7e34685
)
works
author
realraum
<realraum@realraum.at>
Tue, 28 Sep 2010 01:37:55 +0000
(
01:37
+0000)
committer
realraum
<realraum@realraum.at>
Tue, 28 Sep 2010 01:37:55 +0000
(
01:37
+0000)
switch-power.py
patch
|
blob
|
history
diff --git
a/switch-power.py
b/switch-power.py
index
77e3369
..
186ccd1
100755
(executable)
--- a/
switch-power.py
+++ b/
switch-power.py
@@
-131,9
+131,9
@@
def isWolfHour():
######### ALGOS ###############
######### ALGOS ###############
-def switchLogo(status_presense):
+def switchLogo(status_presence):
logo_action=None
logo_action=None
- if status_presense:
+ if status_presence:
logo_action=True
else:
if haveDaylight():
logo_action=True
else:
if haveDaylight():
@@
-143,14
+143,13
@@
def switchLogo(status_presense):
logo_action=False
else:
logo_action=True
logo_action=False
else:
logo_action=True
- logging.info("switchLogo: presence:%s daylight:%s wolfhour:%s =>action:%s switching:"+uwscfg.slug_ids_logo % (status_presense,haveDaylight(),isWolfHour(),logo_action))
if not logo_action is None:
for id in uwscfg.slug_ids_logo.split(" "):
switchPower(id,logo_action)
######### EVENTS ###############
unixts_last_movement=0
if not logo_action is None:
for id in uwscfg.slug_ids_logo.split(" "):
switchPower(id,logo_action)
######### EVENTS ###############
unixts_last_movement=0
-status_presense=None
+status_presence=None
room_is_bright=None
def eventRoomGotBright():
room_is_bright=None
def eventRoomGotBright():
@@
-164,24
+163,24
@@
def eventRoomGotDark():
room_is_bright=False
def eventDaylightStart():
room_is_bright=False
def eventDaylightStart():
- global status_presense
+ global status_presence
logging.debug("eventDaylightStart()")
logging.debug("eventDaylightStart()")
- switchLogo(status_presense)
+ switchLogo(status_presence)
def eventDaylightStop():
def eventDaylightStop():
- global status_presense
+ global status_presence
logging.debug("eventDaylightStop()")
logging.debug("eventDaylightStop()")
- switchLogo(status_presense)
+ switchLogo(status_presence)
def eventWolfHourStart():
def eventWolfHourStart():
- global status_presense
+ global status_presence
logging.debug("eventWolfHourStart()")
logging.debug("eventWolfHourStart()")
- switchLogo(status_presense)
+ switchLogo(status_presence)
def eventWolfHourStop():
def eventWolfHourStop():
- global status_presense
+ global status_presence
logging.debug("eventWolfHourStop()")
logging.debug("eventWolfHourStop()")
- switchLogo(status_presense)
+ switchLogo(status_presence)
def eventMovement():
global unixts_last_movement
def eventMovement():
global unixts_last_movement
@@
-191,7
+190,7
@@
def eventPeriodical():
pass
# global unixts_last_movement
pass
# global unixts_last_movement
-# if status_presense is True and unixts_last_movement + int(uwscfg.powerswitching_max_secs_since_movement) >= time.time():
+# if status_presence is True and unixts_last_movement + int(uwscfg.powerswitching_max_secs_since_movement) >= time.time():
# presumed_state=not (haveDaylight() or isWolfHour())
# logging.debug("event: periodical event")
# for id in uwscfg.slug_ids_logo.split(" "):
# presumed_state=not (haveDaylight() or isWolfHour())
# logging.debug("event: periodical event")
# for id in uwscfg.slug_ids_logo.split(" "):
@@
-200,9
+199,9
@@
def eventPeriodical():
# switchPower(id,presumed_state)
def eventPresent():
# switchPower(id,presumed_state)
def eventPresent():
- global status_presense,room_is_bright
+ global status_presence,room_is_bright
logging.debug("eventPresent()");
logging.debug("eventPresent()");
- status_presense=True
+ status_presence=True
if haveDaylight():
if room_is_bright is False:
present_ids=uwscfg.slug_ids_present_day_dark_room
if haveDaylight():
if room_is_bright is False:
present_ids=uwscfg.slug_ids_present_day_dark_room
@@
-213,22
+212,23
@@
def eventPresent():
logging.info("event: someone present, switching on: "+present_ids)
for id in present_ids.split(" "):
switchPower(id,True)
logging.info("event: someone present, switching on: "+present_ids)
for id in present_ids.split(" "):
switchPower(id,True)
- switchLogo(status_presense)
+ switchLogo(status_presence)
def eventNobodyHere():
def eventNobodyHere():
- global status_presense
+ global status_presence
logging.debug("eventNobodyHere()");
logging.debug("eventNobodyHere()");
- status_presense=False
+ status_presence=False
present_ids=uwscfg.slug_ids_nonpresent_off
logging.info("event: noone here, switching off: "+present_ids)
present_ids=uwscfg.slug_ids_nonpresent_off
logging.info("event: noone here, switching off: "+present_ids)
- for id in present_ids.split(" "):
+ present_id_list=present_ids.split(" ")
+ for id in present_id_list:
time.sleep(0.2)
switchPower(id,False)
time.sleep(0.2)
switchPower(id,False)
- present_ids.reverse()
+ present_id_list.reverse()
time.sleep(0.2)
time.sleep(0.2)
- switchLogo(status_presense)
+ switchLogo(status_presence)
time.sleep(4)
time.sleep(4)
- for id in present_ids.split(" "):
+ for id in present_id_list:
time.sleep(0.3)
switchPower(id,False)
time.sleep(0.3)
switchPower(id,False)