Moving smart lights into smart_home to prepare for adding
[python_utils.git] / presence.py
index 947ff08706851c9d5bfa6b743bd53633afcfe9d6..e5bc64f0ba7b9666947200cdfa0f578d289d8b33 100755 (executable)
@@ -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