X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=waitable_presence.py;h=9d79c6c5d61e1065f1444670c3ce24c1b9b7cd0f;hb=02302bbd9363facb59c4df2c1f4013087702cfa6;hp=46d7cbe04898c18cd72019c32c4dd1e5545c322e;hpb=b22b39493c5b6c747b16e9430f3833bb8869cef6;p=python_utils.git diff --git a/waitable_presence.py b/waitable_presence.py index 46d7cbe..9d79c6c 100644 --- a/waitable_presence.py +++ b/waitable_presence.py @@ -1,9 +1,10 @@ #!/usr/bin/env python3 +# © Copyright 2021-2022, Scott Gasch + """A PresenceDetector that is waitable. This is not part of base_presence.py because I do not want to bring these dependencies into that lower-level module (especially state_tracker). - """ import datetime @@ -24,7 +25,7 @@ class WaitablePresenceDetectorWithMemory(state_tracker.WaitableAutomaticStateTra """ This is a waitable class that keeps a PresenceDetector internally and periodically polls it to detect changes in presence in a - particular location. Example suggested usage pattern: + particular location. Example suggested usage pattern:: detector = waitable_presence.WaitablePresenceDetectorWithMemory(60.0) while True: @@ -74,7 +75,7 @@ class WaitablePresenceDetectorWithMemory(state_tracker.WaitableAutomaticStateTra raise Exception(f'Unknown update type {update_id} in {__file__}') def poll_presence(self, now: datetime.datetime) -> None: - logger.debug(f'Checking presence in {self.location} now...') + logger.debug('Checking presence in %s now...', self.location) self.detector.update() if self.detector.is_anyone_in_location_now(self.location): self.someone_is_home = True