Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use stored philips_js system data on start #75981

Merged
merged 4 commits into from Aug 5, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions homeassistant/components/philips_js/__init__.py
Expand Up @@ -38,7 +38,7 @@
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Philips TV from a config entry."""

system = entry.data.get(CONF_SYSTEM)
system: SystemType = entry.data.get(CONF_SYSTEM)
elupus marked this conversation as resolved.
Show resolved Hide resolved
tvapi = PhilipsTV(
entry.data[CONF_HOST],
entry.data[CONF_API_VERSION],
Expand All @@ -50,8 +50,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

await coordinator.async_refresh()

if tvapi.system and tvapi.system != system:
data = {**entry.data, CONF_SYSTEM: tvapi.system}
if (actual_system := tvapi.system) and actual_system != system:
data = {**entry.data, CONF_SYSTEM: actual_system}
hass.config_entries.async_update_entry(entry, data=data)

hass.data.setdefault(DOMAIN, {})
Expand Down