Skip to content

Sound Output select stuck 'unknown': initial state read uses getSpeakerSettings, but outputTerminal is a getSoundSettings (v1.1) target #6

@oniangel

Description

@oniangel

Bug

The Sound Output select entity (BraviaSoundOutputSelect) is permanently unknown because its initial-state fetch reads the wrong API endpoint.

In custom_components/bravia_rest_api/select.py, async_added_to_hass does:

settings = await self.coordinator.client.get_speaker_settings(
    "outputTerminal"
)

But outputTerminal is a sound setting, not a speaker setting. Sony's audio service returns it via getSoundSettings (version 1.1), while getSpeakerSettings only handles targets like tvPosition / subwooferLevel. Asking getSpeakerSettings for outputTerminal fails (Illegal Argument on my set), the except BraviaError: pass swallows it, and self._current stays None forever — so the select shows unknown even though the TV happily reports the value.

Notably, bravia_client.py has set_sound_settings() (→ setSoundSettings v1.1), which is why setting the output works fine — but there is no get_sound_settings() read counterpart at all.

Environment

  • Integration: v1.5.5 (HACS)
  • TV: Sony KD-85X91J, PSK auth
  • The set path (select_option / set_audio_output service) works correctly; only the readback is broken.

Reproduction

  1. Add a KD-85X91J (or presumably any Bravia) via PSK.
  2. Observe select.*_sound_output is unknown and never populates.
  3. Raw API confirms the TV reports the value via the sound-settings endpoint:
curl -s -H "X-Auth-PSK: $PSK" -d '{"method":"getSoundSettings","id":1,"params":[{"target":"outputTerminal"}],"version":"1.1"}' http://TV_IP/sony/audio
# → {"result":[[{"target":"outputTerminal","currentValue":"audioSystem", ...}]],"id":1}
  1. The endpoint the integration actually calls returns an error for this target:
curl -s -H "X-Auth-PSK: $PSK" -d '{"method":"getSpeakerSettings","id":1,"params":[{"target":"outputTerminal"}],"version":"1.0"}' http://TV_IP/sony/audio
# → {"error":[3,"Illegal Argument"],"id":1}

Suggested fix

Add the missing read method to bravia_client.py, mirroring set_sound_settings:

async def get_sound_settings(
    self, target: str = ""
) -> list[dict[str, Any]]:
    """Get sound settings (e.g., output terminal)."""
    result = await self._request(
        SERVICE_AUDIO, "getSoundSettings", [{"target": target}], version="1.1"
    )
    return result[0] if result and isinstance(result[0], list) else result

and switch async_added_to_hass in select.py to get_sound_settings("outputTerminal").

Ideally the entity would also refresh this value on coordinator updates (or at least via _handle_coordinator_update) instead of fetching once at startup — external changes (TV remote, eARC handshakes) currently never propagate even after the fix above.

Happy to open a PR for this — it's a small, self-contained change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions