diff options
| author | Scott Gasch <[email protected]> | 2021-07-08 19:44:27 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2021-07-08 19:44:27 -0700 |
| commit | 3bc4daf1edc121cd633429187392227f2fa61885 (patch) | |
| tree | 0663cf35f562c7023c914454c85050d502ad9f3c /presence.py | |
| parent | 5fd30ef12c100cbb936aa0fdb515b67cff4064db (diff) | |
Lots of changes.
Diffstat (limited to 'presence.py')
| -rw-r--r-- | presence.py | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/presence.py b/presence.py index 02f85d6..b6e9fc3 100644 --- a/presence.py +++ b/presence.py @@ -5,11 +5,9 @@ from collections import defaultdict import enum import logging import re -import sys from typing import Dict, List import argparse_utils -import bootstrap import config import dict_utils import exec_utils @@ -82,6 +80,9 @@ class PresenceDetection(object): Location, Dict[str, datetime.datetime] ] = defaultdict(dict) self.names_by_mac: Dict[str, str] = {} + self.update() + + def update(self) -> None: persisted_macs = config.config['presence_macs_file'] self.read_persisted_macs_file(persisted_macs, Location.HOUSE) raw = exec_utils.cmd( @@ -168,20 +169,3 @@ class PresenceDetection(object): item = dict_utils.item_with_max_value(votes) return item[0] return Location.UNKNOWN - - -def main() -> None: - config.parse() - p = PresenceDetection() - - for loc in Location: - print(f'{loc}: {p.is_anyone_in_location_now(loc)}') - - for u in Person: - print(f'{u}: {p.where_is_person_now(u)}') - sys.exit(0) - - -if __name__ == '__main__': - main() |
