From 208317e3bd794fd31e5edf6758f4bda4172ba2e5 Mon Sep 17 00:00:00 2001 From: Phillip Bitzer Date: Wed, 20 Oct 2021 21:22:27 -0500 Subject: [PATCH] Fix non-returned value If a state variable was not present, or had a bad/NaN value, an exception would be raised. In this case, the `_previous_data` attribute would not be updated, and the error would persist at future steps. This makes sure previous data is update AND make sure the input data is returned for other steps in the brokkr chain. --- plugins/state_monitor.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/state_monitor.py b/plugins/state_monitor.py index 6f98175..a4e3871 100644 --- a/plugins/state_monitor.py +++ b/plugins/state_monitor.py @@ -152,11 +152,12 @@ def now_then(key): "%s data: %r", pretty_name, {key: str(value) for key, value in data.items()}) - # Update state for next pass through the pipeline - self._previous_data = input_data + finally: + # Update state for next pass through the pipeline + self._previous_data = input_data - # Pass through the input for consumption by any further steps - return input_data + # Pass through the input for consumption by any further steps + return input_data def send_message(self, msg): """