Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.homeassistant.scene Namespace Reference

Classes

class  HomeAssistantScene
 
class  SceneConfig
 

Functions

dict[str, State_convert_states (dict[str, Any] states)
 
dict[str, Any] _ensure_no_intersection (dict[str, Any] value)
 
None _process_scenes_config (HomeAssistant hass, AddEntitiesCallback async_add_entities, dict[str, Any] config)
 
None async_setup_platform (HomeAssistant hass, ConfigType config, AddEntitiesCallback async_add_entities, DiscoveryInfoType|None discovery_info=None)
 
list[str] entities_in_scene (HomeAssistant hass, str entity_id)
 
list[str] scenes_with_entity (HomeAssistant hass, str entity_id)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
string CONF_SCENE_ID = "scene_id"
 
string CONF_SNAPSHOT = "snapshot_entities"
 
 CREATE_SCENE_SCHEMA
 
string DATA_PLATFORM = "homeassistant_scene"
 
string EVENT_SCENE_RELOADED = "scene_reloaded"
 
 PLATFORM_SCHEMA
 
string SERVICE_APPLY = "apply"
 
string SERVICE_CREATE = "create"
 
string SERVICE_DELETE = "delete"
 
 STATES_SCHEMA = vol.All(dict, _convert_states)
 

Detailed Description

Allow users to set and activate scenes.

Function Documentation

◆ _convert_states()

dict[str, State] homeassistant.components.homeassistant.scene._convert_states ( dict[str, Any]  states)
private
Convert state definitions to State objects.

Definition at line 41 of file scene.py.

◆ _ensure_no_intersection()

dict[str, Any] homeassistant.components.homeassistant.scene._ensure_no_intersection ( dict[str, Any]  value)
private
Validate that entities and snapshot_entities do not overlap.

Definition at line 68 of file scene.py.

◆ _process_scenes_config()

None homeassistant.components.homeassistant.scene._process_scenes_config ( HomeAssistant  hass,
AddEntitiesCallback  async_add_entities,
dict[str, Any]   config 
)
private
Process multiple scenes and add them.

Definition at line 307 of file scene.py.

◆ async_setup_platform()

None homeassistant.components.homeassistant.scene.async_setup_platform ( HomeAssistant  hass,
ConfigType  config,
AddEntitiesCallback  async_add_entities,
DiscoveryInfoType | None   discovery_info = None 
)
Set up Home Assistant scene entries.

Definition at line 168 of file scene.py.

◆ entities_in_scene()

list[str] homeassistant.components.homeassistant.scene.entities_in_scene ( HomeAssistant  hass,
str  entity_id 
)
Return all entities in a scene.

Definition at line 155 of file scene.py.

◆ scenes_with_entity()

list[str] homeassistant.components.homeassistant.scene.scenes_with_entity ( HomeAssistant  hass,
str  entity_id 
)
Return all scenes that reference the entity.

Definition at line 139 of file scene.py.

Variable Documentation

◆ _LOGGER

homeassistant.components.homeassistant.scene._LOGGER = logging.getLogger(__name__)
private

Definition at line 126 of file scene.py.

◆ CONF_SCENE_ID

string homeassistant.components.homeassistant.scene.CONF_SCENE_ID = "scene_id"

Definition at line 82 of file scene.py.

◆ CONF_SNAPSHOT

string homeassistant.components.homeassistant.scene.CONF_SNAPSHOT = "snapshot_entities"

Definition at line 83 of file scene.py.

◆ CREATE_SCENE_SCHEMA

homeassistant.components.homeassistant.scene.CREATE_SCENE_SCHEMA
Initial value:
1 = vol.All(
2  cv.has_at_least_one_key(CONF_ENTITIES, CONF_SNAPSHOT),
3  _ensure_no_intersection,
4  vol.Schema(
5  {
6  vol.Required(CONF_SCENE_ID): cv.slug,
7  vol.Optional(CONF_ENTITIES, default={}): STATES_SCHEMA,
8  vol.Optional(CONF_SNAPSHOT, default=[]): cv.entity_ids,
9  }
10  ),
11 )

Definition at line 110 of file scene.py.

◆ DATA_PLATFORM

string homeassistant.components.homeassistant.scene.DATA_PLATFORM = "homeassistant_scene"

Definition at line 84 of file scene.py.

◆ EVENT_SCENE_RELOADED

string homeassistant.components.homeassistant.scene.EVENT_SCENE_RELOADED = "scene_reloaded"

Definition at line 85 of file scene.py.

◆ PLATFORM_SCHEMA

homeassistant.components.homeassistant.scene.PLATFORM_SCHEMA
Initial value:
1 = vol.Schema(
2  {
3  vol.Required(CONF_PLATFORM): DOMAIN,
4  vol.Required(STATES): vol.All(
5  cv.ensure_list,
6  [
7  vol.Schema(
8  {
9  vol.Optional(CONF_ID): cv.string,
10  vol.Required(CONF_NAME): cv.string,
11  vol.Optional(CONF_ICON): cv.icon,
12  vol.Required(CONF_ENTITIES): STATES_SCHEMA,
13  vol.Optional("metadata"): dict,
14  }
15  )
16  ],
17  ),
18  },
19  extra=vol.ALLOW_EXTRA,
20 )

Definition at line 89 of file scene.py.

◆ SERVICE_APPLY

string homeassistant.components.homeassistant.scene.SERVICE_APPLY = "apply"

Definition at line 122 of file scene.py.

◆ SERVICE_CREATE

string homeassistant.components.homeassistant.scene.SERVICE_CREATE = "create"

Definition at line 123 of file scene.py.

◆ SERVICE_DELETE

string homeassistant.components.homeassistant.scene.SERVICE_DELETE = "delete"

Definition at line 124 of file scene.py.

◆ STATES_SCHEMA

homeassistant.components.homeassistant.scene.STATES_SCHEMA = vol.All(dict, _convert_states)

Definition at line 86 of file scene.py.