Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.homeassistant.triggers.state Namespace Reference

Functions

CALLBACK_TYPE async_attach_trigger (HomeAssistant hass, ConfigType config, TriggerActionType action, TriggerInfo trigger_info, *str platform_type="state")
 
ConfigType async_validate_trigger_config (HomeAssistant hass, ConfigType config)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
 BASE_SCHEMA
 
string CONF_ENTITY_ID = "entity_id"
 
string CONF_FROM = "from"
 
string CONF_NOT_FROM = "not_from"
 
string CONF_NOT_TO = "not_to"
 
string CONF_TO = "to"
 
 TRIGGER_ATTRIBUTE_SCHEMA
 
 TRIGGER_STATE_SCHEMA
 

Detailed Description

Offer state listening automation rules.

Function Documentation

◆ async_attach_trigger()

CALLBACK_TYPE homeassistant.components.homeassistant.triggers.state.async_attach_trigger ( HomeAssistant  hass,
ConfigType  config,
TriggerActionType  action,
TriggerInfo  trigger_info,
*str   platform_type = "state" 
)
Listen for state changes based on configuration.

Definition at line 94 of file state.py.

◆ async_validate_trigger_config()

ConfigType homeassistant.components.homeassistant.triggers.state.async_validate_trigger_config ( HomeAssistant  hass,
ConfigType   config 
)
Validate trigger config.

Definition at line 72 of file state.py.

Variable Documentation

◆ _LOGGER

homeassistant.components.homeassistant.triggers.state._LOGGER = logging.getLogger(__name__)
private

Definition at line 35 of file state.py.

◆ BASE_SCHEMA

homeassistant.components.homeassistant.triggers.state.BASE_SCHEMA
Initial value:
1 = cv.TRIGGER_BASE_SCHEMA.extend(
2  {
3  vol.Required(CONF_PLATFORM): "state",
4  vol.Required(CONF_ENTITY_ID): cv.entity_ids_or_uuids,
5  vol.Optional(CONF_FOR): cv.positive_time_period_template,
6  vol.Optional(CONF_ATTRIBUTE): cv.match_all,
7  }
8 )

Definition at line 43 of file state.py.

◆ CONF_ENTITY_ID

string homeassistant.components.homeassistant.triggers.state.CONF_ENTITY_ID = "entity_id"

Definition at line 37 of file state.py.

◆ CONF_FROM

string homeassistant.components.homeassistant.triggers.state.CONF_FROM = "from"

Definition at line 38 of file state.py.

◆ CONF_NOT_FROM

string homeassistant.components.homeassistant.triggers.state.CONF_NOT_FROM = "not_from"

Definition at line 40 of file state.py.

◆ CONF_NOT_TO

string homeassistant.components.homeassistant.triggers.state.CONF_NOT_TO = "not_to"

Definition at line 41 of file state.py.

◆ CONF_TO

string homeassistant.components.homeassistant.triggers.state.CONF_TO = "to"

Definition at line 39 of file state.py.

◆ TRIGGER_ATTRIBUTE_SCHEMA

homeassistant.components.homeassistant.triggers.state.TRIGGER_ATTRIBUTE_SCHEMA
Initial value:
1 = BASE_SCHEMA.extend(
2  {
3  vol.Exclusive(CONF_FROM, CONF_FROM): cv.match_all,
4  vol.Exclusive(CONF_NOT_FROM, CONF_FROM): cv.match_all,
5  vol.Exclusive(CONF_TO, CONF_TO): cv.match_all,
6  vol.Exclusive(CONF_NOT_TO, CONF_TO): cv.match_all,
7  }
8 )

Definition at line 62 of file state.py.

◆ TRIGGER_STATE_SCHEMA

homeassistant.components.homeassistant.triggers.state.TRIGGER_STATE_SCHEMA
Initial value:
1 = BASE_SCHEMA.extend(
2  {
3  # These are str on purpose. Want to catch YAML conversions
4  vol.Exclusive(CONF_FROM, CONF_FROM): vol.Any(str, [str], None),
5  vol.Exclusive(CONF_NOT_FROM, CONF_FROM): vol.Any(str, [str], None),
6  vol.Exclusive(CONF_TO, CONF_TO): vol.Any(str, [str], None),
7  vol.Exclusive(CONF_NOT_TO, CONF_TO): vol.Any(str, [str], None),
8  }
9 )

Definition at line 52 of file state.py.