From 6a877ec77da9fd9f58b3a920534b97d9f26208cf Mon Sep 17 00:00:00 2001 From: Andrew Sayre <6730289+andrewsayre@users.noreply.github.com> Date: Sun, 26 Jan 2025 09:53:10 -0600 Subject: [PATCH] Don't cast type in HEOS services (#136583) --- homeassistant/components/heos/services.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/heos/services.py b/homeassistant/components/heos/services.py index c447befbb30..f4d5961cc47 100644 --- a/homeassistant/components/heos/services.py +++ b/homeassistant/components/heos/services.py @@ -1,7 +1,6 @@ """Services for the HEOS integration.""" import logging -from typing import cast from pyheos import CommandAuthenticationError, Heos, HeosError import voluptuous as vol @@ -61,10 +60,10 @@ def _get_controller(hass: HomeAssistant) -> Heos: translation_key="sign_in_out_deprecated", ) - entry = cast( - HeosConfigEntry, - hass.config_entries.async_entry_for_domain_unique_id(DOMAIN, DOMAIN), + entry: HeosConfigEntry | None = ( + hass.config_entries.async_entry_for_domain_unique_id(DOMAIN, DOMAIN) ) + if not entry or not entry.state == ConfigEntryState.LOADED: raise HomeAssistantError( translation_domain=DOMAIN, translation_key="integration_not_loaded"