1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-15 07:36:16 +00:00

Add Twitch entity for self (#150525)

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
w531t4
2025-09-13 10:39:11 -04:00
committed by GitHub
parent 08485f4e09
commit 97077898bb

View File

@@ -79,6 +79,7 @@ class TwitchCoordinator(DataUpdateCoordinator[dict[str, TwitchUpdate]]):
if not (user := await first(self.twitch.get_users())):
raise UpdateFailed("Logged in user not found")
self.current_user = user
self.users.append(self.current_user) # Add current_user to users list.
async def _async_update_data(self) -> dict[str, TwitchUpdate]:
await self.session.async_ensure_token_valid()
@@ -95,6 +96,8 @@ class TwitchCoordinator(DataUpdateCoordinator[dict[str, TwitchUpdate]]):
user_id=self.current_user.id, first=100
)
}
async for s in self.twitch.get_streams(user_id=[self.current_user.id]):
streams.update({s.user_id: s})
follows: dict[str, FollowedChannel] = {
f.broadcaster_id: f
async for f in await self.twitch.get_followed_channels(