Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.mobile_app.webhook Namespace Reference

Functions

template.Template _cached_template (str template_str, HomeAssistant hass)
 
str _extract_sensor_unique_id (str webhook_id, str unique_id)
 
str _gen_unique_id (str webhook_id, str sensor_unique_id)
 
dict[str, Any] _validate_state_class_sensor (dict[str, Any] value)
 
Response handle_webhook (HomeAssistant hass, str webhook_id, Request request)
 
def validate_schema (schema)
 
Response webhook_call_service (HomeAssistant hass, ConfigEntry config_entry, dict[str, Any] data)
 
Response webhook_conversation_process (HomeAssistant hass, ConfigEntry config_entry, dict[str, Any] data)
 
Response webhook_enable_encryption (HomeAssistant hass, ConfigEntry config_entry, Any data)
 
Response webhook_fire_event (HomeAssistant hass, ConfigEntry config_entry, dict[str, Any] data)
 
Response webhook_get_config (HomeAssistant hass, ConfigEntry config_entry, Any data)
 
Response webhook_get_zones (HomeAssistant hass, ConfigEntry config_entry, Any data)
 
Response webhook_register_sensor (HomeAssistant hass, ConfigEntry config_entry, dict[str, Any] data)
 
Response webhook_render_template (HomeAssistant hass, ConfigEntry config_entry, dict[str, Any] data)
 
Response webhook_scan_tag (HomeAssistant hass, ConfigEntry config_entry, dict[str, str] data)
 
Response webhook_stream_camera (HomeAssistant hass, ConfigEntry config_entry, dict[str, str] data)
 
Response webhook_update_location (HomeAssistant hass, ConfigEntry config_entry, dict[str, Any] data)
 
Response webhook_update_registration (HomeAssistant hass, ConfigEntry config_entry, dict[str, Any] data)
 
Response webhook_update_sensor_states (HomeAssistant hass, ConfigEntry config_entry, list[dict[str, Any]] data)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
int DELAY_SAVE = 10
 
 SENSOR_SCHEMA_FULL
 
tuple SENSOR_TYPES = (ATTR_SENSOR_TYPE_BINARY_SENSOR, ATTR_SENSOR_TYPE_SENSOR)
 
 WEBHOOK_PAYLOAD_SCHEMA
 

Detailed Description

Webhook handlers for mobile_app.

Function Documentation

◆ _cached_template()

template.Template homeassistant.components.mobile_app.webhook._cached_template ( str  template_str,
HomeAssistant  hass 
)
private
Return a cached template.

Definition at line 378 of file webhook.py.

◆ _extract_sensor_unique_id()

str homeassistant.components.mobile_app.webhook._extract_sensor_unique_id ( str  webhook_id,
str  unique_id 
)
private
Return a unique sensor ID.

Definition at line 516 of file webhook.py.

◆ _gen_unique_id()

str homeassistant.components.mobile_app.webhook._gen_unique_id ( str  webhook_id,
str  sensor_unique_id 
)
private
Return a unique sensor ID.

Definition at line 511 of file webhook.py.

◆ _validate_state_class_sensor()

dict[str, Any] homeassistant.components.mobile_app.webhook._validate_state_class_sensor ( dict[str, Any]  value)
private
Validate we only set state class for sensors.

Definition at line 500 of file webhook.py.

◆ handle_webhook()

Response homeassistant.components.mobile_app.webhook.handle_webhook ( HomeAssistant  hass,
str  webhook_id,
Request   request 
)
Handle webhook callback.

Definition at line 182 of file webhook.py.

◆ validate_schema()

def homeassistant.components.mobile_app.webhook.validate_schema (   schema)
Decorate a webhook function with a schema.

Definition at line 157 of file webhook.py.

◆ webhook_call_service()

Response homeassistant.components.mobile_app.webhook.webhook_call_service ( HomeAssistant  hass,
ConfigEntry  config_entry,
dict[str, Any]   data 
)
Handle a call service webhook.

Definition at line 278 of file webhook.py.

◆ webhook_conversation_process()

Response homeassistant.components.mobile_app.webhook.webhook_conversation_process ( HomeAssistant  hass,
ConfigEntry  config_entry,
dict[str, Any]   data 
)
Handle a conversation process webhook.

Definition at line 333 of file webhook.py.

◆ webhook_enable_encryption()

Response homeassistant.components.mobile_app.webhook.webhook_enable_encryption ( HomeAssistant  hass,
ConfigEntry  config_entry,
Any   data 
)
Handle a encryption enable webhook.

Definition at line 474 of file webhook.py.

◆ webhook_fire_event()

Response homeassistant.components.mobile_app.webhook.webhook_fire_event ( HomeAssistant  hass,
ConfigEntry  config_entry,
dict[str, Any]   data 
)
Handle a fire event webhook.

Definition at line 311 of file webhook.py.

◆ webhook_get_config()

Response homeassistant.components.mobile_app.webhook.webhook_get_config ( HomeAssistant  hass,
ConfigEntry  config_entry,
Any   data 
)
Handle a get config webhook.

Definition at line 718 of file webhook.py.

◆ webhook_get_zones()

Response homeassistant.components.mobile_app.webhook.webhook_get_zones ( HomeAssistant  hass,
ConfigEntry  config_entry,
Any   data 
)
Handle a get zones webhook.

Definition at line 706 of file webhook.py.

◆ webhook_register_sensor()

Response homeassistant.components.mobile_app.webhook.webhook_register_sensor ( HomeAssistant  hass,
ConfigEntry  config_entry,
dict[str, Any]   data 
)
Handle a register sensor webhook.

Definition at line 552 of file webhook.py.

◆ webhook_render_template()

Response homeassistant.components.mobile_app.webhook.webhook_render_template ( HomeAssistant  hass,
ConfigEntry  config_entry,
dict[str, Any]   data 
)
Handle a render template webhook.

Definition at line 392 of file webhook.py.

◆ webhook_scan_tag()

Response homeassistant.components.mobile_app.webhook.webhook_scan_tag ( HomeAssistant  hass,
ConfigEntry  config_entry,
dict[str, str]   data 
)
Handle a fire event webhook.

Definition at line 768 of file webhook.py.

◆ webhook_stream_camera()

Response homeassistant.components.mobile_app.webhook.webhook_stream_camera ( HomeAssistant  hass,
ConfigEntry  config_entry,
dict[str, str]   data 
)
Handle a request to HLS-stream a camera.

Definition at line 349 of file webhook.py.

◆ webhook_update_location()

Response homeassistant.components.mobile_app.webhook.webhook_update_location ( HomeAssistant  hass,
ConfigEntry  config_entry,
dict[str, Any]   data 
)
Handle an update location webhook.

Definition at line 425 of file webhook.py.

◆ webhook_update_registration()

Response homeassistant.components.mobile_app.webhook.webhook_update_registration ( HomeAssistant  hass,
ConfigEntry  config_entry,
dict[str, Any]   data 
)
Handle an update registration webhook.

Definition at line 446 of file webhook.py.

◆ webhook_update_sensor_states()

Response homeassistant.components.mobile_app.webhook.webhook_update_sensor_states ( HomeAssistant  hass,
ConfigEntry  config_entry,
list[dict[str, Any]]   data 
)
Handle an update sensor states webhook.

Definition at line 639 of file webhook.py.

Variable Documentation

◆ _LOGGER

homeassistant.components.mobile_app.webhook._LOGGER = logging.getLogger(__name__)
private

Definition at line 120 of file webhook.py.

◆ DELAY_SAVE

int homeassistant.components.mobile_app.webhook.DELAY_SAVE = 10

Definition at line 122 of file webhook.py.

◆ SENSOR_SCHEMA_FULL

homeassistant.components.mobile_app.webhook.SENSOR_SCHEMA_FULL
Initial value:
1 = vol.Schema(
2  {
3  vol.Optional(ATTR_SENSOR_ATTRIBUTES, default={}): dict,
4  vol.Optional(ATTR_SENSOR_ICON, default="mdi:cellphone"): vol.Any(None, cv.icon),
5  vol.Required(ATTR_SENSOR_STATE): vol.Any(None, bool, int, float, str),
6  vol.Required(ATTR_SENSOR_TYPE): vol.In(SENSOR_TYPES),
7  vol.Required(ATTR_SENSOR_UNIQUE_ID): cv.string,
8  }
9 )

Definition at line 146 of file webhook.py.

◆ SENSOR_TYPES

tuple homeassistant.components.mobile_app.webhook.SENSOR_TYPES = (ATTR_SENSOR_TYPE_BINARY_SENSOR, ATTR_SENSOR_TYPE_SENSOR)

Definition at line 128 of file webhook.py.

◆ WEBHOOK_PAYLOAD_SCHEMA

homeassistant.components.mobile_app.webhook.WEBHOOK_PAYLOAD_SCHEMA
Initial value:
1 = vol.Any(
2  vol.Schema(
3  {
4  vol.Required(ATTR_WEBHOOK_TYPE): cv.string,
5  vol.Optional(ATTR_WEBHOOK_DATA): vol.Any(dict, list),
6  }
7  ),
8  vol.Schema(
9  {
10  vol.Required(ATTR_WEBHOOK_TYPE): cv.string,
11  vol.Required(ATTR_WEBHOOK_ENCRYPTED): True,
12  vol.Optional(ATTR_WEBHOOK_ENCRYPTED_DATA): cv.string,
13  }
14  ),
15 )

Definition at line 130 of file webhook.py.