Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.alexa.state_report.AlexaResponse Class Reference

Public Member Functions

None __init__ (self, str name, str namespace, dict[str, Any]|None payload=None)
 
None add_context_property (self, dict[str, Any] prop)
 
None merge_context_properties (self, AlexaEntity endpoint)
 
str name (self)
 
str namespace (self)
 
dict[str, Any] serialize (self)
 
None set_correlation_token (self, str token)
 
None set_endpoint (self, dict[str, Any] endpoint)
 
None set_endpoint_full (self, str|None bearer_token, str|None endpoint_id)
 

Private Member Functions

list[dict[str, Any]] _properties (self)
 

Detailed Description

Class to hold a response.

Definition at line 148 of file state_report.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.components.alexa.state_report.AlexaResponse.__init__ (   self,
str  name,
str  namespace,
dict[str, Any] | None   payload = None 
)
Initialize the response.

Definition at line 151 of file state_report.py.

Member Function Documentation

◆ _properties()

list[dict[str, Any]] homeassistant.components.alexa.state_report.AlexaResponse._properties (   self)
private

Definition at line 210 of file state_report.py.

◆ add_context_property()

None homeassistant.components.alexa.state_report.AlexaResponse.add_context_property (   self,
dict[str, Any]  prop 
)
Add a property to the response context.

The Alexa response includes a list of properties which provides
feedback on how states have changed. For example if a user asks,
"Alexa, set thermostat to 20 degrees", the API expects a response with
the new value of the property, and Alexa will respond to the user
"Thermostat set to 20 degrees".

async_handle_message() will call .merge_context_properties() for every
request automatically, however often handlers will call services to
change state but the effects of those changes are applied
asynchronously. Thus, handlers should call this method to confirm
changes before returning.

Definition at line 215 of file state_report.py.

◆ merge_context_properties()

None homeassistant.components.alexa.state_report.AlexaResponse.merge_context_properties (   self,
AlexaEntity  endpoint 
)
Add all properties from given endpoint if not already set.

Handlers should be using .add_context_property().

Definition at line 232 of file state_report.py.

◆ name()

str homeassistant.components.alexa.state_report.AlexaResponse.name (   self)
Return the name of this response.

Definition at line 169 of file state_report.py.

◆ namespace()

str homeassistant.components.alexa.state_report.AlexaResponse.namespace (   self)
Return the namespace of this response.

Definition at line 175 of file state_report.py.

◆ serialize()

dict[str, Any] homeassistant.components.alexa.state_report.AlexaResponse.serialize (   self)
Return response as a JSON-able data structure.

Definition at line 244 of file state_report.py.

◆ set_correlation_token()

None homeassistant.components.alexa.state_report.AlexaResponse.set_correlation_token (   self,
str  token 
)
Set the correlationToken.

This should normally mirror the value from a request, and is set by
AlexaDirective.response() usually.

Definition at line 180 of file state_report.py.

◆ set_endpoint()

None homeassistant.components.alexa.state_report.AlexaResponse.set_endpoint (   self,
dict[str, Any]  endpoint 
)
Set the endpoint.

This should normally mirror the value from a request, and is set by
AlexaDirective.response() usually.

Definition at line 202 of file state_report.py.

◆ set_endpoint_full()

None homeassistant.components.alexa.state_report.AlexaResponse.set_endpoint_full (   self,
str | None  bearer_token,
str | None   endpoint_id 
)
Set the endpoint dictionary.

This is used to send proactive messages to Alexa.

Definition at line 188 of file state_report.py.


The documentation for this class was generated from the following file: