mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00: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,
|
STATE_PLAYING,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
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.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.network import NoURLAvailableError, get_url
|
from homeassistant.helpers.network import NoURLAvailableError, get_url
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
@ -463,8 +463,9 @@ class CastDevice(MediaPlayerEntity):
|
|||||||
# Create a signed path.
|
# Create a signed path.
|
||||||
if media_id[0] == "/":
|
if media_id[0] == "/":
|
||||||
# Sign URL with Home Assistant Cast User
|
# Sign URL with Home Assistant Cast User
|
||||||
config_entries = self.hass.config_entries.async_entries(CAST_DOMAIN)
|
config_entry_id = self.registry_entry.config_entry_id
|
||||||
user_id = config_entries[0].data["user_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)
|
user = await self.hass.auth.async_get_user(user_id)
|
||||||
if user.refresh_tokens:
|
if user.refresh_tokens:
|
||||||
refresh_token: RefreshToken = list(user.refresh_tokens.values())[0]
|
refresh_token: RefreshToken = list(user.refresh_tokens.values())[0]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user