summaryrefslogtreecommitdiff
path: root/presence.py
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2021-10-28 11:51:22 -0700
committerScott Gasch <[email protected]>2021-10-28 11:51:22 -0700
commit7e6972bc7c8e891dc669645fa5969ed76fe38314 (patch)
treeeec2f61e92f577e048602e5ced8d4a0cc471da6c /presence.py
parented47f1a0c31184280a303563237e34c0e53437d7 (diff)
Moving smart lights into smart_home to prepare for adding
outlets and cameras.
Diffstat (limited to 'presence.py')
-rwxr-xr-xpresence.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/presence.py b/presence.py
index 947ff08..e5bc64f 100755
--- a/presence.py
+++ b/presence.py
@@ -83,7 +83,10 @@ class PresenceDetection(object):
def update(self) -> None:
from exec_utils import cmd
- persisted_macs = config.config['presence_macs_file']
+ try:
+ persisted_macs = config.config['presence_macs_file']
+ except KeyError:
+ persisted_macs = '/home/scott/cron/persisted_mac_addresses.txt'
self.read_persisted_macs_file(persisted_macs, Location.HOUSE)
raw = cmd(
"ssh [email protected] 'cat /home/scott/cron/persisted_mac_addresses.txt'"
@@ -166,7 +169,7 @@ class PresenceDetection(object):
location = dict_utils.key_with_min_value(tiebreaks)
v = votes.get(location, 0)
votes[location] = v + credit
- logger.debug('{name}: {location} gets {credit} votes.')
+ logger.debug(f'{name}: {location} gets {credit} votes.')
credit = int(
credit * 0.667
) # Note: list most important devices first