Home Assistant Unofficial Reference 2024.12.1
homeassistant.helpers.intent Namespace Reference

Classes

class  DynamicServiceIntentHandler
 
class  Intent
 
class  IntentCategory
 
class  IntentError
 
class  IntentHandleError
 
class  IntentHandler
 
class  IntentResponse
 
class  IntentResponseErrorCode
 
class  IntentResponseTarget
 
class  IntentResponseTargetType
 
class  IntentResponseType
 
class  IntentUnexpectedError
 
class  InvalidSlotInfo
 
class  MatchFailedError
 
class  MatchFailedReason
 
class  MatchTargetsCandidate
 
class  MatchTargetsConstraints
 
class  MatchTargetsPreferences
 
class  MatchTargetsResult
 
class  NoStatesMatchedError
 
class  ServiceIntentHandler
 
class  UnknownIntent
 

Functions

None _add_areas (area_registry.AreaRegistry areas, device_registry.DeviceRegistry devices, Iterable[MatchTargetsCandidate] candidates)
 
Iterable[MatchTargetsCandidate_filter_by_device_classes (Iterable[str] device_classes, Iterable[MatchTargetsCandidate] candidates)
 
Iterable[MatchTargetsCandidate_filter_by_features (int features, Iterable[MatchTargetsCandidate] candidates)
 
Iterable[MatchTargetsCandidate_filter_by_name (str name, Iterable[MatchTargetsCandidate] candidates)
 
str _normalize_name (str name)
 
Iterable[IntentHandlerasync_get (HomeAssistant hass)
 
IntentResponse async_handle (HomeAssistant hass, str platform, str intent_type, _SlotsType|None slots=None, str|None text_input=None, Context|None context=None, str|None language=None, str|None assistant=None, str|None device_id=None, str|None conversation_agent_id=None)
 
Iterable[Stateasync_match_states (HomeAssistant hass, str|None name=None, str|None area_name=None, str|None floor_name=None, Collection[str]|None domains=None, Collection[str]|None device_classes=None, list[State]|None states=None, str|None assistant=None)
 
MatchTargetsResult async_match_targets (HomeAssistant hass, MatchTargetsConstraints constraints, MatchTargetsPreferences|None preferences=None, list[State]|None states=None)
 
None async_register (HomeAssistant hass, IntentHandler handler)
 
None async_remove (HomeAssistant hass, str intent_type)
 
None async_test_feature (State state, int feature, str feature_name)
 
Iterable[area_registry.AreaEntryfind_areas (str name, area_registry.AreaRegistry areas)
 
Iterable[floor_registry.FloorEntryfind_floors (str name, floor_registry.FloorRegistry floors)
 
str non_empty_string (Any value)
 

Variables

 _IntentSlotsType
 
 _LOGGER = logging.getLogger(__name__)
 
 _SlotsType
 
string INTENT_CANCEL_ALL_TIMERS = "HassCancelAllTimers"
 
string INTENT_CANCEL_TIMER = "HassCancelTimer"
 
string INTENT_DECREASE_TIMER = "HassDecreaseTimer"
 
string INTENT_GET_CURRENT_DATE = "HassGetCurrentDate"
 
string INTENT_GET_CURRENT_TIME = "HassGetCurrentTime"
 
string INTENT_GET_STATE = "HassGetState"
 
string INTENT_INCREASE_TIMER = "HassIncreaseTimer"
 
string INTENT_NEVERMIND = "HassNevermind"
 
string INTENT_PAUSE_TIMER = "HassPauseTimer"
 
string INTENT_RESPOND = "HassRespond"
 
string INTENT_SET_POSITION = "HassSetPosition"
 
string INTENT_START_TIMER = "HassStartTimer"
 
string INTENT_TIMER_STATUS = "HassTimerStatus"
 
string INTENT_TOGGLE = "HassToggle"
 
string INTENT_TURN_OFF = "HassTurnOff"
 
string INTENT_TURN_ON = "HassTurnOn"
 
string INTENT_UNPAUSE_TIMER = "HassUnpauseTimer"
 
 SLOT_SCHEMA = vol.Schema({}, extra=vol.ALLOW_EXTRA)
 
string SPEECH_TYPE_PLAIN = "plain"
 
string SPEECH_TYPE_SSML = "ssml"
 

Detailed Description

Module to coordinate user intentions.

Function Documentation

◆ _add_areas()

None homeassistant.helpers.intent._add_areas ( area_registry.AreaRegistry  areas,
device_registry.DeviceRegistry  devices,
Iterable[MatchTargetsCandidate candidates 
)
private
Add area and device entries to match candidates.

Definition at line 480 of file intent.py.

◆ _filter_by_device_classes()

Iterable[MatchTargetsCandidate] homeassistant.helpers.intent._filter_by_device_classes ( Iterable[str]  device_classes,
Iterable[MatchTargetsCandidate candidates 
)
private
Filter candidates by device classes.

Definition at line 461 of file intent.py.

◆ _filter_by_features()

Iterable[MatchTargetsCandidate] homeassistant.helpers.intent._filter_by_features ( int  features,
Iterable[MatchTargetsCandidate candidates 
)
private
Filter candidates by supported features.

Definition at line 444 of file intent.py.

◆ _filter_by_name()

Iterable[MatchTargetsCandidate] homeassistant.helpers.intent._filter_by_name ( str  name,
Iterable[MatchTargetsCandidate candidates 
)
private
Filter candidates by name.

Definition at line 409 of file intent.py.

◆ _normalize_name()

str homeassistant.helpers.intent._normalize_name ( str  name)
private
Normalize name for comparison.

Definition at line 404 of file intent.py.

◆ async_get()

Iterable[IntentHandler] homeassistant.helpers.intent.async_get ( HomeAssistant  hass)
Return registered intents.

Definition at line 99 of file intent.py.

◆ async_handle()

IntentResponse homeassistant.helpers.intent.async_handle ( HomeAssistant  hass,
str  platform,
str  intent_type,
_SlotsType | None   slots = None,
str | None   text_input = None,
Context | None   context = None,
str | None   language = None,
str | None   assistant = None,
str | None   device_id = None,
str | None   conversation_agent_id = None 
)
Handle an intent.

Definition at line 105 of file intent.py.

◆ async_match_states()

Iterable[State] homeassistant.helpers.intent.async_match_states ( HomeAssistant  hass,
str | None   name = None,
str | None   area_name = None,
str | None   floor_name = None,
Collection[str] | None   domains = None,
Collection[str] | None   device_classes = None,
list[State] | None   states = None,
str | None   assistant = None 
)
Simplified interface to async_match_targets that returns states matching the constraints.

Definition at line 732 of file intent.py.

◆ async_match_targets()

MatchTargetsResult homeassistant.helpers.intent.async_match_targets ( HomeAssistant  hass,
MatchTargetsConstraints  constraints,
MatchTargetsPreferences | None   preferences = None,
list[State] | None   states = None 
)
Match entities based on constraints in order to handle an intent.

Definition at line 503 of file intent.py.

◆ async_register()

None homeassistant.helpers.intent.async_register ( HomeAssistant  hass,
IntentHandler  handler 
)
Register an intent with Home Assistant.

Definition at line 72 of file intent.py.

◆ async_remove()

None homeassistant.helpers.intent.async_remove ( HomeAssistant  hass,
str  intent_type 
)
Remove an intent from Home Assistant.

Definition at line 90 of file intent.py.

◆ async_test_feature()

None homeassistant.helpers.intent.async_test_feature ( State  state,
int  feature,
str  feature_name 
)
Test if state supports a feature.

Definition at line 759 of file intent.py.

◆ find_areas()

Iterable[area_registry.AreaEntry] homeassistant.helpers.intent.find_areas ( str  name,
area_registry.AreaRegistry   areas 
)
Find all areas matching a name (including aliases).

Definition at line 364 of file intent.py.

◆ find_floors()

Iterable[floor_registry.FloorEntry] homeassistant.helpers.intent.find_floors ( str  name,
floor_registry.FloorRegistry   floors 
)
Find all floors matching a name (including aliases).

Definition at line 384 of file intent.py.

◆ non_empty_string()

str homeassistant.helpers.intent.non_empty_string ( Any  value)
Coerce value to string and fail if string is empty or whitespace.

Definition at line 811 of file intent.py.

Variable Documentation

◆ _IntentSlotsType

homeassistant.helpers.intent._IntentSlotsType
private

Definition at line 40 of file intent.py.

◆ _LOGGER

homeassistant.helpers.intent._LOGGER = logging.getLogger(__name__)
private

Definition at line 38 of file intent.py.

◆ _SlotsType

homeassistant.helpers.intent._SlotsType
private

Definition at line 39 of file intent.py.

◆ INTENT_CANCEL_ALL_TIMERS

string homeassistant.helpers.intent.INTENT_CANCEL_ALL_TIMERS = "HassCancelAllTimers"

Definition at line 52 of file intent.py.

◆ INTENT_CANCEL_TIMER

string homeassistant.helpers.intent.INTENT_CANCEL_TIMER = "HassCancelTimer"

Definition at line 51 of file intent.py.

◆ INTENT_DECREASE_TIMER

string homeassistant.helpers.intent.INTENT_DECREASE_TIMER = "HassDecreaseTimer"

Definition at line 54 of file intent.py.

◆ INTENT_GET_CURRENT_DATE

string homeassistant.helpers.intent.INTENT_GET_CURRENT_DATE = "HassGetCurrentDate"

Definition at line 58 of file intent.py.

◆ INTENT_GET_CURRENT_TIME

string homeassistant.helpers.intent.INTENT_GET_CURRENT_TIME = "HassGetCurrentTime"

Definition at line 59 of file intent.py.

◆ INTENT_GET_STATE

string homeassistant.helpers.intent.INTENT_GET_STATE = "HassGetState"

Definition at line 47 of file intent.py.

◆ INTENT_INCREASE_TIMER

string homeassistant.helpers.intent.INTENT_INCREASE_TIMER = "HassIncreaseTimer"

Definition at line 53 of file intent.py.

◆ INTENT_NEVERMIND

string homeassistant.helpers.intent.INTENT_NEVERMIND = "HassNevermind"

Definition at line 48 of file intent.py.

◆ INTENT_PAUSE_TIMER

string homeassistant.helpers.intent.INTENT_PAUSE_TIMER = "HassPauseTimer"

Definition at line 55 of file intent.py.

◆ INTENT_RESPOND

string homeassistant.helpers.intent.INTENT_RESPOND = "HassRespond"

Definition at line 60 of file intent.py.

◆ INTENT_SET_POSITION

string homeassistant.helpers.intent.INTENT_SET_POSITION = "HassSetPosition"

Definition at line 49 of file intent.py.

◆ INTENT_START_TIMER

string homeassistant.helpers.intent.INTENT_START_TIMER = "HassStartTimer"

Definition at line 50 of file intent.py.

◆ INTENT_TIMER_STATUS

string homeassistant.helpers.intent.INTENT_TIMER_STATUS = "HassTimerStatus"

Definition at line 57 of file intent.py.

◆ INTENT_TOGGLE

string homeassistant.helpers.intent.INTENT_TOGGLE = "HassToggle"

Definition at line 46 of file intent.py.

◆ INTENT_TURN_OFF

string homeassistant.helpers.intent.INTENT_TURN_OFF = "HassTurnOff"

Definition at line 44 of file intent.py.

◆ INTENT_TURN_ON

string homeassistant.helpers.intent.INTENT_TURN_ON = "HassTurnOn"

Definition at line 45 of file intent.py.

◆ INTENT_UNPAUSE_TIMER

string homeassistant.helpers.intent.INTENT_UNPAUSE_TIMER = "HassUnpauseTimer"

Definition at line 56 of file intent.py.

◆ SLOT_SCHEMA

homeassistant.helpers.intent.SLOT_SCHEMA = vol.Schema({}, extra=vol.ALLOW_EXTRA)

Definition at line 62 of file intent.py.

◆ SPEECH_TYPE_PLAIN

string homeassistant.helpers.intent.SPEECH_TYPE_PLAIN = "plain"

Definition at line 66 of file intent.py.

◆ SPEECH_TYPE_SSML

string homeassistant.helpers.intent.SPEECH_TYPE_SSML = "ssml"

Definition at line 67 of file intent.py.