Skip to content

Don’t warn on expected WiiM getMetaInfo → Failed response #128

Description

@hildebrau

Don’t warn on expected WiiM getMetaInfoFailed response

Summary

Follow-up to #91 / #93.

WiiM devices return the plain text Failed (HTTP 200, not JSON) for getMetaInfo when idle / no track metadata. While playing, the same endpoint returns normal JSON (metaData with title/artist/art, etc.).

#93 correctly handles this in bridge.py by catching LinkPlayInvalidDataException when exc.data == "Failed" and clearing metainfo. That prevents crashes — but session_call_api_json in utils.py still logs a warning before raising:

LOGGER.warning("Unexpected json for %s: %s", url, jsonexc)

In Home Assistant (local polling ~every 5s), an idle WiiM therefore spams:

WARNING [linkplay] Unexpected json for https://…/httpapi.asp?command=getMetaInfo: Expecting value: line 1 column 1 (char 0)

Once playback starts and getMetaInfo returns JSON again, the warnings stop.

Proposed change

Treat bare Failed as an expected non-JSON payload: keep raising LinkPlayInvalidDataException(data=result) so existing bridge handling still works, but log at debug (or skip logging) instead of warning when result == "Failed".

Still warn for other unexpected non-JSON responses.

Repro

  1. WiiM idle / stopped — GET /httpapi.asp?command=getMetaInfoFailed
  2. Start playback on the same device → valid JSON metaData object
  3. Observe HA / linkplay logs: warning every poll while idle; quiet while playing

Tested on

  • Device: WiiM Pro (firmware Linkplay.4.8.814756)
  • Library: python-linkplay 0.2.14 (via Home Assistant 2026.7.4 after JUST upgrading to new HA container)

Note

#93 fixed the crash; this removes the residual log noise for the same expected WiiM idle response.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions