Home Assistant Unofficial Reference 2024.12.1
intent.py
Go to the documentation of this file.
1 """Intents for the cover integration."""
2 
3 from homeassistant.const import SERVICE_CLOSE_COVER, SERVICE_OPEN_COVER
4 from homeassistant.core import HomeAssistant
5 from homeassistant.helpers import intent
6 
7 from . import DOMAIN, INTENT_CLOSE_COVER, INTENT_OPEN_COVER, CoverDeviceClass
8 
9 
10 async def async_setup_intents(hass: HomeAssistant) -> None:
11  """Set up the cover intents."""
12  intent.async_register(
13  hass,
14  intent.ServiceIntentHandler(
15  INTENT_OPEN_COVER,
16  DOMAIN,
17  SERVICE_OPEN_COVER,
18  "Opening {}",
19  description="Opens a cover",
20  platforms={DOMAIN},
21  device_classes={CoverDeviceClass},
22  ),
23  )
24  intent.async_register(
25  hass,
26  intent.ServiceIntentHandler(
27  INTENT_CLOSE_COVER,
28  DOMAIN,
29  SERVICE_CLOSE_COVER,
30  "Closing {}",
31  description="Closes a cover",
32  platforms={DOMAIN},
33  device_classes={CoverDeviceClass},
34  ),
35  )
None async_setup_intents(HomeAssistant hass)
Definition: intent.py:10