projects
/
python_utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Small bugfixes; also, add a new machine to the remote executor pool.
[python_utils.git]
/
presence.py
diff --git
a/presence.py
b/presence.py
index c69712480826253b95979013a527bad6741c5901..b310183b4da6c1fdf002bee0c559abd9a9fd0ca1 100755
(executable)
--- a/
presence.py
+++ b/
presence.py
@@
-7,6
+7,7
@@
import logging
import re
from typing import Dict, List
import re
from typing import Dict, List
+# Note: this module is fairly early loaded. Be aware of dependencies.
import argparse_utils
import bootstrap
import config
import argparse_utils
import bootstrap
import config
@@
-48,10
+49,10
@@
class PresenceDetection(object):
# Note: list most important devices first.
self.devices_by_person: Dict[Person, List[str]] = {
Person.SCOTT: [
# Note: list most important devices first.
self.devices_by_person: Dict[Person, List[str]] = {
Person.SCOTT: [
- "3C:28:6D:10:6D:41",
- "
D4:61:2E:88:18:09",
- "6C:40:08:AE:DC:2E",
- "14:7D:DA:6A:20:D7",
+ "3C:28:6D:10:6D:41",
# pixel3
+ "
6C:40:08:AE:DC:2E", # laptop
+# "D4:61:2E:88:18:09", # watch
+# "14:7D:DA:6A:20:D7", # work laptop
],
Person.LYNN: [
"08:CC:27:63:26:14",
],
Person.LYNN: [
"08:CC:27:63:26:14",
@@
-83,7
+84,10
@@
class PresenceDetection(object):
def update(self) -> None:
from exec_utils import cmd
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'"
self.read_persisted_macs_file(persisted_macs, Location.HOUSE)
raw = cmd(
"ssh
[email protected]
'cat /home/scott/cron/persisted_mac_addresses.txt'"
@@
-166,7
+170,7
@@
class PresenceDetection(object):
location = dict_utils.key_with_min_value(tiebreaks)
v = votes.get(location, 0)
votes[location] = v + credit
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
credit = int(
credit * 0.667
) # Note: list most important devices first