@@ -266,6 +266,8 @@ async def mock_states(hass: HomeAssistant) -> Mock:
266266 result .mock_repeat_switch_id = switch .ENTITY_ID_FORMAT .format ("repeat" )
267267 hass .states .async_set (result .mock_repeat_switch_id , STATE_OFF )
268268
269+ result .mock_media_image_url_id = f"{ input_select .DOMAIN } .entity_picture"
270+ hass .states .async_set (result .mock_media_image_url_id , "/local/picture.png" )
269271 return result
270272
271273
@@ -289,6 +291,7 @@ def config_children_and_attr(mock_states):
289291 "repeat" : mock_states .mock_repeat_switch_id ,
290292 "sound_mode_list" : mock_states .mock_sound_mode_list_id ,
291293 "sound_mode" : mock_states .mock_sound_mode_id ,
294+ "entity_picture" : mock_states .mock_media_image_url_id ,
292295 },
293296 }
294297
@@ -598,6 +601,22 @@ async def test_sound_mode_list_children_and_attr(
598601 assert ump .sound_mode_list == "['music', 'movie', 'game']"
599602
600603
604+ async def test_entity_picture_children_and_attr (
605+ hass : HomeAssistant , config_children_and_attr , mock_states
606+ ) -> None :
607+ """Test entity picture property w/ children and attrs."""
608+ config = validate_config (config_children_and_attr )
609+
610+ ump = universal .UniversalMediaPlayer (hass , config )
611+
612+ assert ump .entity_picture == "/local/picture.png"
613+
614+ hass .states .async_set (
615+ mock_states .mock_sound_mode_list_id , "/local/other_picture.png"
616+ )
617+ assert ump .sound_mode_list == "/local/other_picture.png"
618+
619+
601620async def test_source_list_children_and_attr (
602621 hass : HomeAssistant , config_children_and_attr , mock_states
603622) -> None :
@@ -774,6 +793,7 @@ async def test_overrides(hass: HomeAssistant, config_children_and_attr) -> None:
774793 "clear_playlist" : excmd ,
775794 "play_media" : excmd ,
776795 "toggle" : excmd ,
796+ "entity_picture" : excmd ,
777797 }
778798 await async_setup_component (hass , "media_player" , {"media_player" : config })
779799 await hass .async_block_till_done ()
@@ -1364,7 +1384,11 @@ async def test_reload(hass: HomeAssistant) -> None:
13641384 hass .states .async_set (
13651385 "remote.alexander_master_bedroom" ,
13661386 STATE_ON ,
1367- {"activity_list" : ["act1" , "act2" ], "current_activity" : "act2" },
1387+ {
1388+ "activity_list" : ["act1" , "act2" ],
1389+ "current_activity" : "act2" ,
1390+ "entity_picture" : "/local/picture_remote.png" ,
1391+ },
13681392 )
13691393
13701394 yaml_path = get_fixture_path ("configuration.yaml" , "universal" )
@@ -1382,6 +1406,10 @@ async def test_reload(hass: HomeAssistant) -> None:
13821406 assert hass .states .get ("media_player.tv" ) is None
13831407 assert hass .states .get ("media_player.master_bed_tv" ).state == "on"
13841408 assert hass .states .get ("media_player.master_bed_tv" ).attributes ["source" ] == "act2"
1409+ assert (
1410+ hass .states .get ("media_player.master_bed_tv" ).attributes ["entity_picture" ]
1411+ == "/local/picture_remote.png"
1412+ )
13851413 assert (
13861414 "device_class" not in hass .states .get ("media_player.master_bed_tv" ).attributes
13871415 )
0 commit comments