Skip to content

Commit f9c4767

Browse files
author
Russell Green
committed
fix: fixes retrieving pin history
1 parent bc70842 commit f9c4767

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/server.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"""
1212
__author__ = "Russell Green"
1313
__license__ = "MIT"
14-
__version__ = "1.1.0"
14+
__version__ = "1.0.1"
1515
__maintainer__ = "Russell.Green"
1616
__email__ = "[email protected]"
1717
__status__ = "Production"
@@ -241,15 +241,15 @@ def set_get_pin_value(pin, value):
241241

242242

243243
def get_pin_history(pin):
244-
return gpio_pin_history[pin] or {"lastValue": None}
244+
if pin in gpio_pin_history[pin]:
245+
return gpio_pin_history[pin]
246+
else:
247+
return {"lastValue": None}
245248

246249

247250
def set_pin_history(pin):
248251
history = {"lastChange": datetime.datetime.now()}
249-
if not gpio_pin_history[pin]:
250-
gpio_pin_history[pin] = history
251-
252-
record = gpio_pin_history[pin]
252+
record = get_pin_history(pin)
253253
record.update(history)
254254

255255

0 commit comments

Comments
 (0)