From f9c47671bff5c7c67c335580f54ebc389cad80df Mon Sep 17 00:00:00 2001 From: Russell Green Date: Tue, 6 Jun 2023 09:01:20 -0400 Subject: [PATCH] fix: fixes retrieving pin history --- src/server.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/server.py b/src/server.py index 41d2e5c..852add0 100644 --- a/src/server.py +++ b/src/server.py @@ -11,7 +11,7 @@ """ __author__ = "Russell Green" __license__ = "MIT" -__version__ = "1.1.0" +__version__ = "1.0.1" __maintainer__ = "Russell.Green" __email__ = "me@rusty.green" __status__ = "Production" @@ -241,15 +241,15 @@ def set_get_pin_value(pin, value): def get_pin_history(pin): - return gpio_pin_history[pin] or {"lastValue": None} + if pin in gpio_pin_history[pin]: + return gpio_pin_history[pin] + else: + return {"lastValue": None} def set_pin_history(pin): history = {"lastChange": datetime.datetime.now()} - if not gpio_pin_history[pin]: - gpio_pin_history[pin] = history - - record = gpio_pin_history[pin] + record = get_pin_history(pin) record.update(history)