mirror of
https://github.com/Retropex/custom-ocean.xyz-dashboard.git
synced 2025-05-12 19:20:45 +02:00
Update state_manager.py
This commit is contained in:
parent
7b7f386a2d
commit
b9993a12f1
@ -93,7 +93,7 @@ class StateManager:
|
|||||||
arrow_history[key] = [
|
arrow_history[key] = [
|
||||||
{"time": entry.get("t", ""),
|
{"time": entry.get("t", ""),
|
||||||
"value": entry.get("v", 0),
|
"value": entry.get("v", 0),
|
||||||
"arrow": ""} # Default empty arrow
|
"arrow": entry.get("a", "")} # Use saved arrow value
|
||||||
for entry in values
|
for entry in values
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -146,9 +146,9 @@ class StateManager:
|
|||||||
if isinstance(values, list) and values:
|
if isinstance(values, list) and values:
|
||||||
# Only store recent history (last 2 hours)
|
# Only store recent history (last 2 hours)
|
||||||
recent_values = values[-120:] if len(values) > 120 else values
|
recent_values = values[-120:] if len(values) > 120 else values
|
||||||
# Use shorter field names and remove unnecessary fields
|
# Use shorter field names and preserve arrow directions
|
||||||
compact_arrow_history[key] = [
|
compact_arrow_history[key] = [
|
||||||
{"t": entry["time"], "v": entry["value"]}
|
{"t": entry["time"], "v": entry["value"], "a": entry["arrow"]}
|
||||||
for entry in recent_values
|
for entry in recent_values
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user