import logging
import re
from typing import Dict, List, Set
+import warnings
# Note: this module is fairly early loaded. Be aware of dependencies.
import argparse_utils
# Note: list most important devices first.
self.devices_by_person: Dict[Person, List[str]] = {
Person.SCOTT: [
- "3C:28:6D:10:6D:41", # pixel3
+ "DC:E5:5B:0F:03:3D", # pixel6
"6C:40:08:AE:DC:2E", # laptop
],
Person.LYNN: [
self.parse_raw_macs_file(raw, Location.CABIN)
except Exception as e:
logger.exception(e)
- logger.warning("Can't see the cabin right now; presence detection impared.")
+ msg = "Can't see the cabin right now; presence detection impared."
+ warnings.warn(msg)
+ logger.warning(msg, stacklevel=2)
self.dark_locations.add(Location.CABIN)
def update_from_cabin(self) -> None:
self.parse_raw_macs_file(raw, Location.HOUSE)
except Exception as e:
logger.exception(e)
- logger.warning("Can't see the house right now; presence detection impared.")
+ msg = "Can't see the house right now; presence detection impared."
+ logger.warning(msg)
+ warnings.warn(msg, stacklevel=2)
self.dark_locations.add(Location.HOUSE)
def read_persisted_macs_file(
def where_is_person_now(self, name: Person) -> Location:
self.maybe_update()
if len(self.dark_locations) > 0:
- logger.warning(
- f"Can't see {self.dark_locations} right now; answer confidence impacted"
- )
+ msg = f"Can't see {self.dark_locations} right now; answer confidence impacted"
+ logger.warning(msg)
+ warnings.warn(msg, stacklevel=2)
logger.debug(f'Looking for {name}...')
if name is Person.UNKNOWN:
for person in Person:
print(f'{person} => {p.where_is_person_now(person)}')
print()
- for location in Location:
- print(f'{location} => {p.is_anyone_in_location_now(location)}')
+# for location in Location:
+# print(f'{location} => {p.is_anyone_in_location_now(location)}')
if __name__ == '__main__':