From 3bc4daf1edc121cd633429187392227f2fa61885 Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Thu, 8 Jul 2021 19:44:27 -0700 Subject: Lots of changes. --- presence.py | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'presence.py') 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 - - -@bootstrap.initialize -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() -- cgit v1.3