Repository navigation
Downgrade getMetaInfo warning to debug for expected non-JSON responses - #129
derekcentrico wants to merge 2 commits into
Conversation
WiiM devices return "Failed" or an empty body (HTTP 200) from the getMetaInfo endpoint when nothing is playing. Both trigger a JSONDecodeError, and session_call_api_json logs a WARNING for every occurrence. On a 5-second poll cycle this produces hundreds of warning lines per day in Home Assistant logs. The exception handler in bridge.py already treats "Failed" as a non-error, but it only ran after the warning was already logged. Empty responses were not handled at all and re-raised. Log at DEBUG instead of WARNING when the raw response is empty or "Failed". Broaden the bridge.py catch so empty responses are also treated as a silent non-error. Closes velbus#128
Only suppress LinkPlayInvalidDataException when exc.data is an actual string whose stripped value is empty or "Failed". Exceptions raised without a data field (data=None) now re-raise instead of being silently swallowed.
|
Independent reproduction on a different device model, in case it helps with review. Device: WiiM Mini ( Confirmed the endpoint returns a bare 6-byte non-JSON body when idle ( Scale on a single idle device: 537,992 warnings over ~8 weeks (Jul 4 – Aug 30), which was 74% of all log entries on that instance. It buried several genuine faults — a dead sensor battery and an offline camera each went unnoticed for weeks because the log was unreadable. Worth emphasising that the device is entirely healthy: 15/15 requests answered in ~0.08 s across The One note for anyone landing here from search: this cannot be resolved by updating Home Assistant. Both 2026.7.0 and 2026.8.3 pin logger:
logs:
linkplay: error |
|
@Velleman Any chance you could take a look at this when you get a moment? We now have an independent reproduction from @firstofjuly on a different device model (WiiM Mini), logging over 500k warnings in 8 weeks from this single endpoint. The fix is minimal and scoped to the two known non-JSON responses ( |
|
+1 |
|
Still seeing this on Home Assistant 2026.10.2, which pins python-linkplay 0.2.14. A single player logged this warning 124 times in about 27 hours: The branch is up to date with main and merges cleanly. Happy to rebase or adjust the approach if you'd like it done differently, and glad to help review the other open PRs if that's useful. |
|
Another reproduction, this time on a WiiM Pro (Home Assistant 2026.10.2, python-linkplay 0.2.14). Left idle after its overnight restart, it logged 2,625 I'd opened #139 for the same change before I found this PR. I'm closing it in favour of this one, since this one also handles the empty-body response. |
|
Confirming this on current versions — same HTTP 200, 6-byte plain-text body
~770 warnings/hr while idle. This PR's approach (debug for the |
Problem
WiiM devices return
"Failed"or an empty body (HTTP 200) from thegetMetaInfoendpoint when nothing is playing. Both triggerjson.JSONDecodeErrorinsession_call_api_json, which logs a WARNING before raisingLinkPlayInvalidDataException. On a 5-second poll cycle this produces hundreds of warning lines per day in Home Assistant logs:PR #93 added the
datafield to the exception and a catch inbridge.pyfordata == "Failed", but the warning was already emitted by that point. Empty-string responses were not handled at all and re-raised.Reported in #128 and in Home Assistant core issue #175775.
Fix
Two changes:
utils.py: Before logging, check whether the raw response is empty or
"Failed". Log at DEBUG for those cases, keep WARNING for truly unexpected payloads.bridge.py: Broaden the catch to also treat empty-string responses as a non-error (same as
"Failed"). Uses anisinstancecheck so exceptions raised without an explicitdatastring still re-raise correctly.Tests
Adds
test_meta_info_empty_response_handlingalongside the existingtest_meta_info_failed_handling. All 291 tests pass.Closes #128