diff --git a/homeassistant/components/climate/intent.py b/homeassistant/components/climate/intent.py index a7bf3357f99..48b5c134bbd 100644 --- a/homeassistant/components/climate/intent.py +++ b/homeassistant/components/climate/intent.py @@ -24,6 +24,7 @@ class GetTemperatureIntent(intent.IntentHandler): intent_type = INTENT_GET_TEMPERATURE description = "Gets the current temperature of a climate device or entity" slot_schema = {vol.Optional("area"): str, vol.Optional("name"): str} + platforms = {DOMAIN} async def async_handle(self, intent_obj: intent.Intent) -> intent.IntentResponse: """Handle the intent.""" diff --git a/homeassistant/components/cover/intent.py b/homeassistant/components/cover/intent.py index a77bfbcbd16..dc512795c78 100644 --- a/homeassistant/components/cover/intent.py +++ b/homeassistant/components/cover/intent.py @@ -15,12 +15,20 @@ async def async_setup_intents(hass: HomeAssistant) -> None: intent.async_register( hass, intent.ServiceIntentHandler( - INTENT_OPEN_COVER, DOMAIN, SERVICE_OPEN_COVER, "Opened {}" + INTENT_OPEN_COVER, + DOMAIN, + SERVICE_OPEN_COVER, + "Opened {}", + platforms={DOMAIN}, ), ) intent.async_register( hass, intent.ServiceIntentHandler( - INTENT_CLOSE_COVER, DOMAIN, SERVICE_CLOSE_COVER, "Closed {}" + INTENT_CLOSE_COVER, + DOMAIN, + SERVICE_CLOSE_COVER, + "Closed {}", + platforms={DOMAIN}, ), ) diff --git a/homeassistant/components/humidifier/intent.py b/homeassistant/components/humidifier/intent.py index ffe41b48c04..c713f08b857 100644 --- a/homeassistant/components/humidifier/intent.py +++ b/homeassistant/components/humidifier/intent.py @@ -38,6 +38,7 @@ class HumidityHandler(intent.IntentHandler): vol.Required("name"): cv.string, vol.Required("humidity"): vol.All(vol.Coerce(int), vol.Range(0, 100)), } + platforms = {DOMAIN} async def async_handle(self, intent_obj: intent.Intent) -> intent.IntentResponse: """Handle the hass intent.""" @@ -91,6 +92,7 @@ class SetModeHandler(intent.IntentHandler): vol.Required("name"): cv.string, vol.Required("mode"): cv.string, } + platforms = {DOMAIN} async def async_handle(self, intent_obj: intent.Intent) -> intent.IntentResponse: """Handle the hass intent.""" diff --git a/homeassistant/components/intent/__init__.py b/homeassistant/components/intent/__init__.py index 23ba2112542..7fba729e96b 100644 --- a/homeassistant/components/intent/__init__.py +++ b/homeassistant/components/intent/__init__.py @@ -352,6 +352,7 @@ class SetPositionIntentHandler(intent.DynamicServiceIntentHandler): ATTR_POSITION: vol.All(vol.Coerce(int), vol.Range(min=0, max=100)) }, description="Sets the position of a device or entity", + platforms={COVER_DOMAIN, VALVE_DOMAIN}, ) def get_domain_and_service( diff --git a/homeassistant/components/light/intent.py b/homeassistant/components/light/intent.py index 1839d176f91..458dbbde770 100644 --- a/homeassistant/components/light/intent.py +++ b/homeassistant/components/light/intent.py @@ -34,5 +34,6 @@ async def async_setup_intents(hass: HomeAssistant) -> None: ), }, description="Sets the brightness or color of a light", + platforms={DOMAIN}, ), ) diff --git a/homeassistant/components/media_player/intent.py b/homeassistant/components/media_player/intent.py index 1c2de8371f1..f8b00935358 100644 --- a/homeassistant/components/media_player/intent.py +++ b/homeassistant/components/media_player/intent.py @@ -66,6 +66,7 @@ async def async_setup_intents(hass: HomeAssistant) -> None: required_features=MediaPlayerEntityFeature.NEXT_TRACK, required_states={MediaPlayerState.PLAYING}, description="Skips a media player to the next item", + platforms={DOMAIN}, ), ) intent.async_register( @@ -83,6 +84,7 @@ async def async_setup_intents(hass: HomeAssistant) -> None: ) }, description="Sets the volume of a media player", + platforms={DOMAIN}, ), ) @@ -90,6 +92,8 @@ async def async_setup_intents(hass: HomeAssistant) -> None: class MediaPauseHandler(intent.ServiceIntentHandler): """Handler for pause intent. Records last paused media players.""" + platforms = {DOMAIN} + def __init__(self, last_paused: LastPaused) -> None: """Initialize handler.""" super().__init__( @@ -125,6 +129,8 @@ class MediaPauseHandler(intent.ServiceIntentHandler): class MediaUnpauseHandler(intent.ServiceIntentHandler): """Handler for unpause/resume intent. Uses last paused media players.""" + platforms = {DOMAIN} + def __init__(self, last_paused: LastPaused) -> None: """Initialize handler.""" super().__init__( diff --git a/homeassistant/components/shopping_list/intent.py b/homeassistant/components/shopping_list/intent.py index 35bc2ff4787..d45085be5fa 100644 --- a/homeassistant/components/shopping_list/intent.py +++ b/homeassistant/components/shopping_list/intent.py @@ -24,6 +24,7 @@ class AddItemIntent(intent.IntentHandler): intent_type = INTENT_ADD_ITEM description = "Adds an item to the shopping list" slot_schema = {"item": cv.string} + platforms = {DOMAIN} async def async_handle(self, intent_obj: intent.Intent) -> intent.IntentResponse: """Handle the intent.""" @@ -42,6 +43,7 @@ class ListTopItemsIntent(intent.IntentHandler): intent_type = INTENT_LAST_ITEMS description = "List the top five items on the shopping list" slot_schema = {"item": cv.string} + platforms = {DOMAIN} async def async_handle(self, intent_obj: intent.Intent) -> intent.IntentResponse: """Handle the intent.""" diff --git a/homeassistant/components/todo/intent.py b/homeassistant/components/todo/intent.py index 779c51b3bf7..c3c18ea304f 100644 --- a/homeassistant/components/todo/intent.py +++ b/homeassistant/components/todo/intent.py @@ -23,6 +23,7 @@ class ListAddItemIntent(intent.IntentHandler): intent_type = INTENT_LIST_ADD_ITEM description = "Add item to a todo list" slot_schema = {"item": cv.string, "name": cv.string} + platforms = {DOMAIN} async def async_handle(self, intent_obj: intent.Intent) -> intent.IntentResponse: """Handle the intent.""" diff --git a/homeassistant/components/vacuum/intent.py b/homeassistant/components/vacuum/intent.py index 7ab5ab18374..8952c13875d 100644 --- a/homeassistant/components/vacuum/intent.py +++ b/homeassistant/components/vacuum/intent.py @@ -14,7 +14,11 @@ async def async_setup_intents(hass: HomeAssistant) -> None: intent.async_register( hass, intent.ServiceIntentHandler( - INTENT_VACUUM_START, DOMAIN, SERVICE_START, description="Starts a vacuum" + INTENT_VACUUM_START, + DOMAIN, + SERVICE_START, + description="Starts a vacuum", + platforms={DOMAIN}, ), ) intent.async_register( @@ -24,5 +28,6 @@ async def async_setup_intents(hass: HomeAssistant) -> None: DOMAIN, SERVICE_RETURN_TO_BASE, description="Returns a vacuum to base", + platforms={DOMAIN}, ), ) diff --git a/homeassistant/components/weather/intent.py b/homeassistant/components/weather/intent.py index 92ffc851cc9..cbb46b943e8 100644 --- a/homeassistant/components/weather/intent.py +++ b/homeassistant/components/weather/intent.py @@ -25,6 +25,7 @@ class GetWeatherIntent(intent.IntentHandler): intent_type = INTENT_GET_WEATHER description = "Gets the current weather" slot_schema = {vol.Optional("name"): cv.string} + platforms = {DOMAIN} async def async_handle(self, intent_obj: intent.Intent) -> intent.IntentResponse: """Handle the intent.""" diff --git a/homeassistant/helpers/intent.py b/homeassistant/helpers/intent.py index 6f9c221b1ca..986bcd33484 100644 --- a/homeassistant/helpers/intent.py +++ b/homeassistant/helpers/intent.py @@ -737,7 +737,7 @@ class IntentHandler: """Intent handler registration.""" intent_type: str - platforms: Iterable[str] | None = [] + platforms: set[str] | None = None description: str | None = None @property @@ -808,6 +808,7 @@ class DynamicServiceIntentHandler(IntentHandler): required_features: int | None = None, required_states: set[str] | None = None, description: str | None = None, + platforms: set[str] | None = None, ) -> None: """Create Service Intent Handler.""" self.intent_type = intent_type @@ -816,6 +817,7 @@ class DynamicServiceIntentHandler(IntentHandler): self.required_features = required_features self.required_states = required_states self.description = description + self.platforms = platforms self.required_slots: dict[tuple[str, str], vol.Schema] = {} if required_slots: @@ -1106,6 +1108,7 @@ class ServiceIntentHandler(DynamicServiceIntentHandler): required_features: int | None = None, required_states: set[str] | None = None, description: str | None = None, + platforms: set[str] | None = None, ) -> None: """Create service handler.""" super().__init__( @@ -1117,6 +1120,7 @@ class ServiceIntentHandler(DynamicServiceIntentHandler): required_features=required_features, required_states=required_states, description=description, + platforms=platforms, ) self.domain = domain self.service = service