From 445ad692361dd4c48b01b83414278941a33157a0 Mon Sep 17 00:00:00 2001 From: mgfcf Date: Fri, 3 Dec 2021 17:55:34 +0100 Subject: [PATCH] Fixed datetime not serializable --- src/philips_hue_counter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/philips_hue_counter.py b/src/philips_hue_counter.py index e0c77b1..17e3ff2 100644 --- a/src/philips_hue_counter.py +++ b/src/philips_hue_counter.py @@ -21,7 +21,7 @@ hue_conf = { hue = PhilipsHue(hue_conf) counter = PeopleCounter(VL53L1XSensor()) peopleCount = 0 -early_light_state = False +early_light_state = False # TODO: Is probably redundant and can be implemented over peopleCount logging.getLogger().setLevel(logging.INFO) @@ -98,7 +98,7 @@ def change_cb(countChange: int, directionState: Dict): try: with open(LOG_FILE_PATH, 'a') as f: - f.write(json.dumps(data)) + f.write(json.dumps(data, default=str)) except Exception as ex: logging.exception(f'Unable to write log file. {ex}')