Adjust `source` return value, to return `wifi` when `media_app_name` is `AirPlay` or `Spotify`

This commit is contained in:
samuelspagl 2024-02-08 17:48:58 +01:00
parent d42e1b2832
commit 735fd53644
3 changed files with 5 additions and 1 deletions

View File

@ -10,6 +10,7 @@
- Change "magic numbers" to `MediaPlayerEntityFeature` object
For more information see https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
- the `source` now returns the value `wifi` when the `media_app_name` is `AirPlay` or `Spotify`
## [0.2.1] Chore: Format repository - 2024-02-08

View File

@ -242,6 +242,8 @@ class SoundbarDevice:
@property
def input_source(self):
if self.media_app_name in ("AirPlay", "Spotify"):
return "wifi"
return self.device.status.input_source
@property

View File

@ -3,7 +3,8 @@ from typing import Any, Mapping
from homeassistant.components.media_player import (DEVICE_CLASS_SPEAKER,
MediaPlayerEntity)
from homeassistant.components.media_player.const import MediaPlayerEntityFeature
from homeassistant.components.media_player.const import \
MediaPlayerEntityFeature
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.entity import DeviceInfo, generate_entity_id