Skip to content

Commit 7d41e5f

Browse files
committed
Update relay storage considerations
1 parent 1cd06e1 commit 7d41e5f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: opensensor/collection_apis.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,9 @@ def sample_and_paginate_collection(
591591
except Exception as e:
592592
logger.error(f"Error creating RelayStatus: {e}")
593593
pass # Ignore invalid relay data
594-
relay_board = RelayBoard(relays=relays, timestamp=item["timestamp"])
595-
data.append(relay_board)
594+
if relays:
595+
relay_board = RelayBoard(relays=relays, timestamp=item["timestamp"])
596+
data.append(relay_board)
596597
else:
597598
data = [create_model_instance(response_model, item, unit) for item in raw_data]
598599

0 commit comments

Comments
 (0)