diff --git a/homeassistant/components/conversation/icons.json b/homeassistant/components/conversation/icons.json index 658783f9ae2..55bacf838a8 100644 --- a/homeassistant/components/conversation/icons.json +++ b/homeassistant/components/conversation/icons.json @@ -1,4 +1,9 @@ { + "entity_component": { + "_": { + "default": "mdi:forum-outline" + } + }, "services": { "process": { "service": "mdi:message-processing" diff --git a/homeassistant/components/conversation/manifest.json b/homeassistant/components/conversation/manifest.json index 36db24ce545..8101f8c8b5f 100644 --- a/homeassistant/components/conversation/manifest.json +++ b/homeassistant/components/conversation/manifest.json @@ -4,7 +4,7 @@ "codeowners": ["@home-assistant/core", "@synesthesiam", "@arturpragacz"], "dependencies": ["http", "intent"], "documentation": "https://www.home-assistant.io/integrations/conversation", - "integration_type": "system", + "integration_type": "entity", "quality_scale": "internal", "requirements": ["hassil==3.2.0", "home-assistant-intents==2025.9.3"] } diff --git a/homeassistant/const.py b/homeassistant/const.py index 913ef5e177f..3c9de2af87c 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -6,6 +6,7 @@ from enum import StrEnum from functools import partial from typing import TYPE_CHECKING, Final +from .generated.entity_platforms import EntityPlatforms from .helpers.deprecation import ( DeprecatedConstant, DeprecatedConstantEnum, @@ -36,54 +37,8 @@ REQUIRED_NEXT_PYTHON_HA_RELEASE: Final = "" # Format for platform files PLATFORM_FORMAT: Final = "{platform}.{domain}" - -class Platform(StrEnum): - """Available entity platforms.""" - - AI_TASK = "ai_task" - AIR_QUALITY = "air_quality" - ALARM_CONTROL_PANEL = "alarm_control_panel" - ASSIST_SATELLITE = "assist_satellite" - BINARY_SENSOR = "binary_sensor" - BUTTON = "button" - CALENDAR = "calendar" - CAMERA = "camera" - CLIMATE = "climate" - CONVERSATION = "conversation" - COVER = "cover" - DATE = "date" - DATETIME = "datetime" - DEVICE_TRACKER = "device_tracker" - EVENT = "event" - FAN = "fan" - GEO_LOCATION = "geo_location" - HUMIDIFIER = "humidifier" - IMAGE = "image" - IMAGE_PROCESSING = "image_processing" - LAWN_MOWER = "lawn_mower" - LIGHT = "light" - LOCK = "lock" - MEDIA_PLAYER = "media_player" - NOTIFY = "notify" - NUMBER = "number" - REMOTE = "remote" - SCENE = "scene" - SELECT = "select" - SENSOR = "sensor" - SIREN = "siren" - STT = "stt" - SWITCH = "switch" - TEXT = "text" - TIME = "time" - TODO = "todo" - TTS = "tts" - UPDATE = "update" - VACUUM = "vacuum" - VALVE = "valve" - WAKE_WORD = "wake_word" - WATER_HEATER = "water_heater" - WEATHER = "weather" - +# Type alias to avoid 1000 MyPy errors +Platform = EntityPlatforms BASE_PLATFORMS: Final = {platform.value for platform in Platform} diff --git a/homeassistant/generated/entity_platforms.py b/homeassistant/generated/entity_platforms.py new file mode 100644 index 00000000000..7010ffc9be7 --- /dev/null +++ b/homeassistant/generated/entity_platforms.py @@ -0,0 +1,54 @@ +"""Automatically generated file. + +To update, run python3 -m script.hassfest +""" + +from enum import StrEnum + + +class EntityPlatforms(StrEnum): + """Available entity platforms.""" + + AI_TASK = "ai_task" + AIR_QUALITY = "air_quality" + ALARM_CONTROL_PANEL = "alarm_control_panel" + ASSIST_SATELLITE = "assist_satellite" + BINARY_SENSOR = "binary_sensor" + BUTTON = "button" + CALENDAR = "calendar" + CAMERA = "camera" + CLIMATE = "climate" + CONVERSATION = "conversation" + COVER = "cover" + DATE = "date" + DATETIME = "datetime" + DEVICE_TRACKER = "device_tracker" + EVENT = "event" + FAN = "fan" + GEO_LOCATION = "geo_location" + HUMIDIFIER = "humidifier" + IMAGE = "image" + IMAGE_PROCESSING = "image_processing" + LAWN_MOWER = "lawn_mower" + LIGHT = "light" + LOCK = "lock" + MEDIA_PLAYER = "media_player" + NOTIFY = "notify" + NUMBER = "number" + REMOTE = "remote" + SCENE = "scene" + SELECT = "select" + SENSOR = "sensor" + SIREN = "siren" + STT = "stt" + SWITCH = "switch" + TEXT = "text" + TIME = "time" + TODO = "todo" + TTS = "tts" + UPDATE = "update" + VACUUM = "vacuum" + VALVE = "valve" + WAKE_WORD = "wake_word" + WATER_HEATER = "water_heater" + WEATHER = "weather" diff --git a/script/hassfest/__main__.py b/script/hassfest/__main__.py index dfa99c6bc75..43a6cc7678b 100644 --- a/script/hassfest/__main__.py +++ b/script/hassfest/__main__.py @@ -19,6 +19,7 @@ from . import ( dhcp, docker, icons, + integration_info, json, manifest, metadata, @@ -44,6 +45,7 @@ INTEGRATION_PLUGINS = [ dependencies, dhcp, icons, + integration_info, json, manifest, mqtt, diff --git a/script/hassfest/integration_info.py b/script/hassfest/integration_info.py new file mode 100644 index 00000000000..8747e256be7 --- /dev/null +++ b/script/hassfest/integration_info.py @@ -0,0 +1,42 @@ +"""Write integration constants.""" + +from __future__ import annotations + +from .model import Config, Integration +from .serializer import format_python + + +def validate(integrations: dict[str, Integration], config: Config) -> None: + """Validate integrations file.""" + + if config.specific_integrations: + return + + int_type = "entity" + + domains = [ + integration.domain + for integration in integrations.values() + if integration.manifest.get("integration_type") == int_type + # Tag is type "entity" but has no entity platform + and integration.domain != "tag" + ] + + code = [ + "from enum import StrEnum", + "class EntityPlatforms(StrEnum):", + f' """Available {int_type} platforms."""', + ] + code.extend([f' {domain.upper()} = "{domain}"' for domain in sorted(domains)]) + + config.cache[f"integrations_{int_type}"] = format_python( + "\n".join(code), generator="script.hassfest" + ) + + +def generate(integrations: dict[str, Integration], config: Config) -> None: + """Generate integration file.""" + int_type = "entity" + filename = "entity_platforms" + platform_path = config.root / f"homeassistant/generated/{filename}.py" + platform_path.write_text(config.cache[f"integrations_{int_type}"]) diff --git a/tests/components/knx/test_config_store.py b/tests/components/knx/test_config_store.py index bb6af6408b8..8f11888d1f2 100644 --- a/tests/components/knx/test_config_store.py +++ b/tests/components/knx/test_config_store.py @@ -88,7 +88,7 @@ async def test_create_entity_error( assert res["success"], res assert not res["result"]["success"] assert res["result"]["errors"][0]["path"] == ["platform"] - assert res["result"]["error_base"].startswith("expected Platform or one of") + assert res["result"]["error_base"].startswith("expected EntityPlatforms or one of") # create entity with unsupported platform await client.send_json_auto_id(