Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.device_automation.toggle_entity Namespace Reference

Functions

list[dict[str, str]] _async_get_automations (HomeAssistant hass, str device_id, list[dict[str, str]] automation_templates, str domain)
 
CALLBACK_TYPE async_attach_trigger (HomeAssistant hass, ConfigType config, TriggerActionType action, TriggerInfo trigger_info)
 
None async_call_action_from_config (HomeAssistant hass, ConfigType config, TemplateVarsType variables, Context|None context, str domain)
 
condition.ConditionCheckerType async_condition_from_config (HomeAssistant hass, ConfigType config)
 
list[dict[str, str]] async_get_actions (HomeAssistant hass, str device_id, str domain)
 
dict[str, vol.Schema] async_get_condition_capabilities (HomeAssistant hass, ConfigType config)
 
list[dict[str, str]] async_get_conditions (HomeAssistant hass, str device_id, str domain)
 
dict[str, vol.Schema] async_get_trigger_capabilities (HomeAssistant hass, ConfigType config)
 
list[dict[str, str]] async_get_triggers (HomeAssistant hass, str device_id, str domain)
 

Variables

 _TOGGLE_TRIGGER_SCHEMA
 
 ACTION_SCHEMA
 
 CONDITION_SCHEMA
 
list DEVICE_ACTION_TYPES = [CONF_TOGGLE, CONF_TURN_OFF, CONF_TURN_ON]
 
list ENTITY_ACTIONS
 
list ENTITY_CONDITIONS
 
list ENTITY_TRIGGERS
 
 TRIGGER_SCHEMA = vol.Any(entity.TRIGGER_SCHEMA, _TOGGLE_TRIGGER_SCHEMA)
 

Detailed Description

Device automation helpers for toggle entity.

Function Documentation

◆ _async_get_automations()

list[dict[str, str]] homeassistant.components.device_automation.toggle_entity._async_get_automations ( HomeAssistant  hass,
str  device_id,
list[dict[str, str]]  automation_templates,
str  domain 
)
private
List device automations.

Definition at line 179 of file toggle_entity.py.

◆ async_attach_trigger()

CALLBACK_TYPE homeassistant.components.device_automation.toggle_entity.async_attach_trigger ( HomeAssistant  hass,
ConfigType  config,
TriggerActionType  action,
TriggerInfo  trigger_info 
)
Listen for state changes based on configuration.

Definition at line 151 of file toggle_entity.py.

◆ async_call_action_from_config()

None homeassistant.components.device_automation.toggle_entity.async_call_action_from_config ( HomeAssistant  hass,
ConfigType  config,
TemplateVarsType  variables,
Context | None  context,
str  domain 
)
Change state based on configuration.

Definition at line 106 of file toggle_entity.py.

◆ async_condition_from_config()

condition.ConditionCheckerType homeassistant.components.device_automation.toggle_entity.async_condition_from_config ( HomeAssistant  hass,
ConfigType   config 
)
Evaluate state based on configuration.

Definition at line 130 of file toggle_entity.py.

◆ async_get_actions()

list[dict[str, str]] homeassistant.components.device_automation.toggle_entity.async_get_actions ( HomeAssistant  hass,
str  device_id,
str   domain 
)
List device actions.

Definition at line 209 of file toggle_entity.py.

◆ async_get_condition_capabilities()

dict[str, vol.Schema] homeassistant.components.device_automation.toggle_entity.async_get_condition_capabilities ( HomeAssistant  hass,
ConfigType   config 
)
List condition capabilities.

Definition at line 234 of file toggle_entity.py.

◆ async_get_conditions()

list[dict[str, str]] homeassistant.components.device_automation.toggle_entity.async_get_conditions ( HomeAssistant  hass,
str  device_id,
str   domain 
)
List device conditions.

Definition at line 216 of file toggle_entity.py.

◆ async_get_trigger_capabilities()

dict[str, vol.Schema] homeassistant.components.device_automation.toggle_entity.async_get_trigger_capabilities ( HomeAssistant  hass,
ConfigType   config 
)
List trigger capabilities.

Definition at line 245 of file toggle_entity.py.

◆ async_get_triggers()

list[dict[str, str]] homeassistant.components.device_automation.toggle_entity.async_get_triggers ( HomeAssistant  hass,
str  device_id,
str   domain 
)
List device triggers.

Definition at line 223 of file toggle_entity.py.

Variable Documentation

◆ _TOGGLE_TRIGGER_SCHEMA

homeassistant.components.device_automation.toggle_entity._TOGGLE_TRIGGER_SCHEMA
private
Initial value:
1 = DEVICE_TRIGGER_BASE_SCHEMA.extend(
2  {
3  vol.Required(CONF_ENTITY_ID): cv.entity_id_or_uuid,
4  vol.Required(CONF_TYPE): vol.In([CONF_TURNED_OFF, CONF_TURNED_ON]),
5  vol.Optional(CONF_FOR): cv.positive_time_period_dict,
6  }
7 )

Definition at line 95 of file toggle_entity.py.

◆ ACTION_SCHEMA

homeassistant.components.device_automation.toggle_entity.ACTION_SCHEMA
Initial value:
1 = cv.DEVICE_ACTION_BASE_SCHEMA.extend(
2  {
3  vol.Required(CONF_ENTITY_ID): cv.entity_id_or_uuid,
4  vol.Required(CONF_TYPE): vol.In(DEVICE_ACTION_TYPES),
5  }
6 )

Definition at line 80 of file toggle_entity.py.

◆ CONDITION_SCHEMA

homeassistant.components.device_automation.toggle_entity.CONDITION_SCHEMA
Initial value:
1 = cv.DEVICE_CONDITION_BASE_SCHEMA.extend(
2  {
3  vol.Required(CONF_ENTITY_ID): cv.entity_id_or_uuid,
4  vol.Required(CONF_TYPE): vol.In([CONF_IS_OFF, CONF_IS_ON]),
5  vol.Optional(CONF_FOR): cv.positive_time_period_dict,
6  }
7 )

Definition at line 87 of file toggle_entity.py.

◆ DEVICE_ACTION_TYPES

list homeassistant.components.device_automation.toggle_entity.DEVICE_ACTION_TYPES = [CONF_TOGGLE, CONF_TURN_OFF, CONF_TURN_ON]

Definition at line 78 of file toggle_entity.py.

◆ ENTITY_ACTIONS

list homeassistant.components.device_automation.toggle_entity.ENTITY_ACTIONS
Initial value:
1 = [
2  {
3  # Turn entity off
4  CONF_TYPE: CONF_TURN_OFF
5  },
6  {
7  # Turn entity on
8  CONF_TYPE: CONF_TURN_ON
9  },
10  {
11  # Toggle entity
12  CONF_TYPE: CONF_TOGGLE
13  },
14 ]

Definition at line 37 of file toggle_entity.py.

◆ ENTITY_CONDITIONS

list homeassistant.components.device_automation.toggle_entity.ENTITY_CONDITIONS
Initial value:
1 = [
2  {
3  # True when entity is turned off
4  CONF_CONDITION: "device",
5  CONF_TYPE: CONF_IS_OFF,
6  },
7  {
8  # True when entity is turned on
9  CONF_CONDITION: "device",
10  CONF_TYPE: CONF_IS_ON,
11  },
12 ]

Definition at line 52 of file toggle_entity.py.

◆ ENTITY_TRIGGERS

list homeassistant.components.device_automation.toggle_entity.ENTITY_TRIGGERS
Initial value:
1 = [
2  {
3  # Trigger when entity is turned off
4  CONF_PLATFORM: "device",
5  CONF_TYPE: CONF_TURNED_OFF,
6  },
7  {
8  # Trigger when entity is turned on
9  CONF_PLATFORM: "device",
10  CONF_TYPE: CONF_TURNED_ON,
11  },
12 ]

Definition at line 65 of file toggle_entity.py.

◆ TRIGGER_SCHEMA

homeassistant.components.device_automation.toggle_entity.TRIGGER_SCHEMA = vol.Any(entity.TRIGGER_SCHEMA, _TOGGLE_TRIGGER_SCHEMA)

Definition at line 103 of file toggle_entity.py.