Skip to content

Commit

Permalink
Print flushing only when not already None
Browse files Browse the repository at this point in the history
  • Loading branch information
thdfw committed Jan 8, 2025
1 parent 5fcc2d8 commit 5fac0cf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 0 additions & 1 deletion gw_spaceheat/actors/scada.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ def _derived_process_message(self, message: Message):
except Exception as e:
self.logger.error(f"Problem with {message.Header}: {e}")
case ChannelFlatlined():
self.logger.error(f"Channel {message.Payload.Channel.Name} flatlined - flusing from latest!")
self.data.flush_channel_from_latest(message.Payload.Channel.Name)
case ChannelReadings():
if message.Header.Dst == self.name:
Expand Down
2 changes: 2 additions & 0 deletions gw_spaceheat/actors/scada_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def flush_channel_from_latest(self, channel_name: str) -> None:
"""
A data channel has flatlined; set its dict value to None
"""
if channel_name in self.latest_channel_values and self.latest_channel_values[channel_name] is not None:
print(f"Channel {channel_name} flatlined - flusing from latest!")
self.latest_channel_values[channel_name] = None
self.latest_channel_unix_ms[channel_name] = None

Expand Down

0 comments on commit 5fac0cf

Please sign in to comment.