diff --git a/homeassistant/components/alexa/smart_home_http.py b/homeassistant/components/alexa/smart_home_http.py index bcb422c4c70..95e13adfbd9 100644 --- a/homeassistant/components/alexa/smart_home_http.py +++ b/homeassistant/components/alexa/smart_home_http.py @@ -3,7 +3,7 @@ import logging from homeassistant import core from homeassistant.components.http.view import HomeAssistantView -from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET, ENTITY_CATEGORIES +from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from homeassistant.helpers.typing import ConfigType @@ -68,7 +68,7 @@ class AlexaConfig(AbstractConfig): entity_registry = er.async_get(self.hass) if registry_entry := entity_registry.async_get(entity_id): - auxiliary_entity = registry_entry.entity_category in ENTITY_CATEGORIES + auxiliary_entity = registry_entry.entity_category is not None else: auxiliary_entity = False return not auxiliary_entity diff --git a/homeassistant/components/cloud/alexa_config.py b/homeassistant/components/cloud/alexa_config.py index 50c2b85aabf..8a845077dc9 100644 --- a/homeassistant/components/cloud/alexa_config.py +++ b/homeassistant/components/cloud/alexa_config.py @@ -17,7 +17,7 @@ from homeassistant.components.alexa import ( errors as alexa_errors, state_report as alexa_state_report, ) -from homeassistant.const import CLOUD_NEVER_EXPOSED_ENTITIES, ENTITY_CATEGORIES +from homeassistant.const import CLOUD_NEVER_EXPOSED_ENTITIES from homeassistant.core import HomeAssistant, callback, split_entity_id from homeassistant.helpers import entity_registry as er, start from homeassistant.helpers.event import async_call_later @@ -133,7 +133,7 @@ class CloudAlexaConfig(alexa_config.AbstractConfig): entity_registry = er.async_get(self.hass) if registry_entry := entity_registry.async_get(entity_id): - auxiliary_entity = registry_entry.entity_category in ENTITY_CATEGORIES + auxiliary_entity = registry_entry.entity_category is not None else: auxiliary_entity = False diff --git a/homeassistant/components/cloud/google_config.py b/homeassistant/components/cloud/google_config.py index 891e0e4a956..4ae3b44f1fe 100644 --- a/homeassistant/components/cloud/google_config.py +++ b/homeassistant/components/cloud/google_config.py @@ -8,7 +8,7 @@ from hass_nabucasa.google_report_state import ErrorResponse from homeassistant.components.google_assistant.const import DOMAIN as GOOGLE_DOMAIN from homeassistant.components.google_assistant.helpers import AbstractConfig -from homeassistant.const import CLOUD_NEVER_EXPOSED_ENTITIES, ENTITY_CATEGORIES +from homeassistant.const import CLOUD_NEVER_EXPOSED_ENTITIES from homeassistant.core import CoreState, split_entity_id from homeassistant.helpers import entity_registry as er, start from homeassistant.setup import async_setup_component @@ -124,7 +124,7 @@ class CloudGoogleConfig(AbstractConfig): entity_registry = er.async_get(self.hass) if registry_entry := entity_registry.async_get(entity_id): - auxiliary_entity = registry_entry.entity_category in ENTITY_CATEGORIES + auxiliary_entity = registry_entry.entity_category is not None else: auxiliary_entity = False diff --git a/homeassistant/components/google_assistant/http.py b/homeassistant/components/google_assistant/http.py index 1fc49055c0b..f068dabe47a 100644 --- a/homeassistant/components/google_assistant/http.py +++ b/homeassistant/components/google_assistant/http.py @@ -13,7 +13,7 @@ from aiohttp.web import Request, Response import jwt from homeassistant.components.http import HomeAssistantView -from homeassistant.const import CLOUD_NEVER_EXPOSED_ENTITIES, ENTITY_CATEGORIES +from homeassistant.const import CLOUD_NEVER_EXPOSED_ENTITIES # Typing imports from homeassistant.core import HomeAssistant @@ -126,7 +126,7 @@ class GoogleConfig(AbstractConfig): entity_registry = er.async_get(self.hass) registry_entry = entity_registry.async_get(state.entity_id) if registry_entry: - auxiliary_entity = registry_entry.entity_category in ENTITY_CATEGORIES + auxiliary_entity = registry_entry.entity_category is not None else: auxiliary_entity = False diff --git a/homeassistant/components/homekit/__init__.py b/homeassistant/components/homekit/__init__.py index bf19c3b9fe7..843cc6ea642 100644 --- a/homeassistant/components/homekit/__init__.py +++ b/homeassistant/components/homekit/__init__.py @@ -35,7 +35,6 @@ from homeassistant.const import ( CONF_IP_ADDRESS, CONF_NAME, CONF_PORT, - ENTITY_CATEGORIES, EVENT_HOMEASSISTANT_STARTED, EVENT_HOMEASSISTANT_STOP, SERVICE_RELOAD, @@ -667,7 +666,7 @@ class HomeKit: if ent_reg_ent := ent_reg.async_get(entity_id): if ( - ent_reg_ent.entity_category in ENTITY_CATEGORIES + ent_reg_ent.entity_category is not None and not self._filter.explicitly_included(entity_id) ): continue diff --git a/homeassistant/components/homekit/config_flow.py b/homeassistant/components/homekit/config_flow.py index 331f9c2ca9e..0863b8f583a 100644 --- a/homeassistant/components/homekit/config_flow.py +++ b/homeassistant/components/homekit/config_flow.py @@ -25,7 +25,6 @@ from homeassistant.const import ( CONF_ENTITY_ID, CONF_NAME, CONF_PORT, - ENTITY_CATEGORIES, ) from homeassistant.core import HomeAssistant, callback, split_entity_id from homeassistant.helpers import device_registry, entity_registry @@ -542,7 +541,7 @@ class OptionsFlowHandler(config_entries.OptionsFlow): entity_cat_entities = set() for entity_id in all_supported_entities: if ent_reg_ent := ent_reg.async_get(entity_id): - if ent_reg_ent.entity_category in ENTITY_CATEGORIES: + if ent_reg_ent.entity_category is not None: entity_cat_entities.add(entity_id) # Remove entity category entities since we will exclude them anyways all_supported_entities = { diff --git a/homeassistant/helpers/service.py b/homeassistant/helpers/service.py index be8e316878f..3cf11453e20 100644 --- a/homeassistant/helpers/service.py +++ b/homeassistant/helpers/service.py @@ -21,7 +21,6 @@ from homeassistant.const import ( CONF_SERVICE_DATA, CONF_SERVICE_TEMPLATE, CONF_TARGET, - ENTITY_CATEGORIES, ENTITY_MATCH_ALL, ENTITY_MATCH_NONE, ) @@ -371,7 +370,8 @@ def async_extract_referenced_entity_ids( for ent_entry in ent_reg.entities.values(): # Do not add config or diagnostic entities referenced by areas or devices - if ent_entry.entity_category in ENTITY_CATEGORIES: + + if ent_entry.entity_category is not None: continue if (