Compare commits

...

2 Commits

Author SHA1 Message Date
MoonDevLT bacb8a8fea Update discovery description wording (#170325) 2026-05-11 15:57:40 +02:00
Maciej Bieniek c9926915ff Fix Shelly media player availability (#170319) 2026-05-11 15:57:37 +02:00
3 changed files with 34 additions and 1 deletions
@@ -14,7 +14,7 @@
},
"step": {
"discovery_confirm": {
"description": "Do you want to setup the Lunatone device with {url}?"
"description": "Do you want to set up the Lunatone device at {url}?"
},
"reconfigure": {
"data": {
@@ -191,6 +191,14 @@ class ShellyRpcMediaPlayer(ShellyRpcAttributeEntity, MediaPlayerEntity):
return self._last_media_position_updated_at
@property
def entity_picture(self) -> str | None:
"""Return image of the media playing."""
if not self.available:
return None
return super().entity_picture
@property
def media_image_url(self) -> str | None:
"""Return the image URL of current playing media."""
@@ -36,6 +36,7 @@ from homeassistant.const import (
STATE_BUFFERING,
STATE_IDLE,
STATE_PLAYING,
STATE_UNAVAILABLE,
Platform,
)
from homeassistant.core import HomeAssistant
@@ -631,3 +632,27 @@ async def test_rpc_media_player_no_media_meta(
assert state.attributes.get(ATTR_MEDIA_ALBUM_NAME) is None
assert state.attributes.get(ATTR_MEDIA_DURATION) is None
assert state.attributes.get(ATTR_MEDIA_POSITION) is None
async def test_rpc_media_player_unavailable(
hass: HomeAssistant,
mock_rpc_device: Mock,
monkeypatch: pytest.MonkeyPatch,
) -> None:
"""Test media player entity handles device going offline without raising."""
status = deepcopy(mock_rpc_device.status)
status["media"] = STATUS_AUDIO_FILE
monkeypatch.setattr(mock_rpc_device, "status", status)
await init_integration(hass, 2, model=MODEL_WALL_DISPLAY)
assert (state := hass.states.get(ENTITY_ID))
assert state.state == STATE_PLAYING
monkeypatch.setattr(mock_rpc_device, "connected", False)
monkeypatch.setattr(mock_rpc_device, "initialized", False)
mock_rpc_device.mock_disconnected()
await hass.async_block_till_done()
assert (state := hass.states.get(ENTITY_ID))
assert state.state == STATE_UNAVAILABLE