mirror of
https://github.com/home-assistant/core
synced 2024-08-31 05:57:13 +02:00
Fix config entry reference for Home Assistant Cast user (#49729)
* Fix config entry reference for Home Assistant Cast user * Simplify config_entry lookup
This commit is contained in:
parent
b00ccf98f0
commit
96e7ae94f8
@ -53,7 +53,7 @@ from homeassistant.const import (
|
||||
STATE_PLAYING,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.network import NoURLAvailableError, get_url
|
||||
import homeassistant.util.dt as dt_util
|
||||
@ -463,8 +463,9 @@ class CastDevice(MediaPlayerEntity):
|
||||
# Create a signed path.
|
||||
if media_id[0] == "/":
|
||||
# Sign URL with Home Assistant Cast User
|
||||
config_entries = self.hass.config_entries.async_entries(CAST_DOMAIN)
|
||||
user_id = config_entries[0].data["user_id"]
|
||||
config_entry_id = self.registry_entry.config_entry_id
|
||||
config_entry = self.hass.config_entries.async_get_entry(config_entry_id)
|
||||
user_id = config_entry.data["user_id"]
|
||||
user = await self.hass.auth.async_get_user(user_id)
|
||||
if user.refresh_tokens:
|
||||
refresh_token: RefreshToken = list(user.refresh_tokens.values())[0]
|
||||
|
Loading…
Reference in New Issue
Block a user