Fix temperature duplication in MQTT payload

Temperature now only appears at root level, not in details.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-26 18:13:49 +01:00
parent 10fad0d9f3
commit 9f3c052e2a
2 changed files with 11 additions and 12 deletions

View File

@@ -54,17 +54,15 @@ class SnmpChecker(BaseChecker):
response_time=None
)
else:
details = {str(oid): str(val) for oid, val in var_binds}
# Only include main OID in details, not temperature
details = {str(var_binds[0][0]): str(var_binds[0][1])}
# Extract temperature if configured
if temperature_oid:
for oid_key, val in var_binds:
if str(oid_key) == temperature_oid:
try:
details["temperature"] = int(val)
except (ValueError, TypeError):
pass # Ignore if not a valid integer
break
# Extract temperature if configured (second OID in response)
if temperature_oid and len(var_binds) >= 2:
try:
details["temperature"] = int(var_binds[1][1])
except (ValueError, TypeError):
pass # Ignore if not a valid integer
return CheckResult(
success=True,