mirror of
https://github.com/home-assistant/core
synced 2024-08-02 23:40:32 +02:00
Drop use of deprecated ENTITY_CATEGORIES (#64607)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
6ed60d2b32
commit
3a09090a4b
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 = {
|
||||
|
@ -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 (
|
||||
|
Loading…
Reference in New Issue
Block a user