fix: slow sensor polling to 60 seconds

This commit is contained in:
Yellowcooln
2026-06-15 18:32:12 -04:00
parent 5d3733a960
commit f2b7d254a7
3 changed files with 15 additions and 6 deletions
+3 -2
View File
@@ -225,8 +225,9 @@ sensors:
# Master switch for sensor subsystem
enabled: true
# Poll interval for all configured sensors
poll_interval_seconds: 10.0
# Poll interval for all configured sensors. Keep modem-backed sensors at 60s
# or slower so their HTTP stats reads don't contend with modem traffic.
poll_interval_seconds: 60.0
# If true, missing Python packages for a sensor may be installed at runtime
# using "python -m pip install ...".
+4 -4
View File
@@ -131,10 +131,10 @@ class SensorManager:
def _poll_loop(self) -> None:
"""Background thread: poll sensors at configured interval and cache readings."""
section = self.config.get("sensors", {})
poll_interval = 30.0
poll_interval = 60.0
if isinstance(section, dict):
try:
poll_interval = float(section.get("poll_interval_seconds", 30.0))
poll_interval = float(section.get("poll_interval_seconds", 60.0))
except (TypeError, ValueError):
pass
@@ -155,10 +155,10 @@ class SensorManager:
def get_summary(self) -> Dict[str, Any]:
section = self.config.get("sensors", {})
poll_interval = 30.0
poll_interval = 60.0
if isinstance(section, dict):
try:
poll_interval = float(section.get("poll_interval_seconds", 30.0))
poll_interval = float(section.get("poll_interval_seconds", 60.0))
except (TypeError, ValueError):
pass
+8
View File
@@ -108,6 +108,14 @@ def test_sensor_manager_summary_reflects_sensor_config():
assert summary["loaded"] == 1
def test_sensor_manager_default_poll_interval_is_sixty_seconds():
config = {"sensors": {"enabled": True, "definitions": []}}
manager = SensorManager(config, registry=_TestRegistry)
assert manager.get_summary()["poll_interval_seconds"] == 60.0
def test_sensor_manager_loads_and_reads_sensors_without_stopping_on_failure():
config = {
"sensors": {