Skip to content

Commit d363bd6

Browse files
authored
Always expose Twitch channel_picture attr regardless of channel status (home-assistant#150300)
1 parent 5916af1 commit d363bd6

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

homeassistant/components/twitch/sensor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
ATTR_FOLLOWING = "followers"
2323
ATTR_VIEWERS = "viewers"
2424
ATTR_STARTED_AT = "started_at"
25+
ATTR_CHANNEL_PICTURE = "channel_picture"
2526

2627
STATE_OFFLINE = "offline"
2728
STATE_STREAMING = "streaming"
@@ -82,6 +83,7 @@ def extra_state_attributes(self) -> dict[str, Any]:
8283
ATTR_STARTED_AT: channel.started_at,
8384
ATTR_VIEWERS: channel.viewers,
8485
ATTR_SUBSCRIPTION: False,
86+
ATTR_CHANNEL_PICTURE: channel.picture,
8587
}
8688
if channel.subscribed is not None:
8789
resp[ATTR_SUBSCRIPTION] = channel.subscribed

tests/components/twitch/test_sensor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ async def test_offline(
2929
sensor_state = hass.states.get(ENTITY_ID)
3030
assert sensor_state.state == "offline"
3131
assert sensor_state.attributes["entity_picture"] == "logo.png"
32+
assert sensor_state.attributes["channel_picture"] == "logo.png"
3233

3334

3435
async def test_streaming(
@@ -40,6 +41,7 @@ async def test_streaming(
4041
sensor_state = hass.states.get(ENTITY_ID)
4142
assert sensor_state.state == "streaming"
4243
assert sensor_state.attributes["entity_picture"] == "stream-medium.png"
44+
assert sensor_state.attributes["channel_picture"] == "logo.png"
4345
assert sensor_state.attributes["game"] == "Good game"
4446
assert sensor_state.attributes["title"] == "Title"
4547
assert sensor_state.attributes["started_at"] == datetime(

0 commit comments

Comments
 (0)