mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-11 11:26:29 +00:00
Add reproduce state page
This commit is contained in:
parent
c025ed1b37
commit
9a886d65cd
26
docs/reproduce_state_index.md
Normal file
26
docs/reproduce_state_index.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
title: "Reproduce State / Scene support"
|
||||||
|
---
|
||||||
|
|
||||||
|
Home Assistant has support for scenes. Scenes are a collection of (partial) entity states. When a scene is activated, Home Assistant will try to call the right services to get the specified scenes in their specified state.
|
||||||
|
|
||||||
|
Integrations are responsible for adding support to Home Assistant to be able to call the right services to reproduce the states in a scene.
|
||||||
|
|
||||||
|
## Adding support
|
||||||
|
|
||||||
|
The quickest way to add reproduce state support to a new integration is by using our built-in scaffold template. From a Home Assistant dev environment, run `python3 -m script.scaffold reproduce_state` and follow the instructions.
|
||||||
|
|
||||||
|
If you prefer to go the manual route, create a new file in your integration folder called `reproduce_state.py` and implement the following method:
|
||||||
|
|
||||||
|
```python
|
||||||
|
import asyncio
|
||||||
|
from typing import Iterable, Optional
|
||||||
|
from homeassistant.core import Context, State
|
||||||
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
|
|
||||||
|
async def async_reproduce_states(
|
||||||
|
hass: HomeAssistantType, states: Iterable[State], context: Optional[Context] = None
|
||||||
|
) -> None:
|
||||||
|
"""Reproduce component states."""
|
||||||
|
# TODO reproduce states
|
||||||
|
```
|
@ -412,6 +412,9 @@
|
|||||||
"releasing": {
|
"releasing": {
|
||||||
"title": "Releasing"
|
"title": "Releasing"
|
||||||
},
|
},
|
||||||
|
"reproduce_state_index": {
|
||||||
|
"title": "Reproduce State / Scene support"
|
||||||
|
},
|
||||||
"version-0.72/version-0.72-architecture_components": {
|
"version-0.72/version-0.72-architecture_components": {
|
||||||
"title": "Components Architecture",
|
"title": "Components Architecture",
|
||||||
"sidebar_label": "Components"
|
"sidebar_label": "Components"
|
||||||
|
@ -71,7 +71,8 @@
|
|||||||
"configuration_yaml_index",
|
"configuration_yaml_index",
|
||||||
"dev_101_services",
|
"dev_101_services",
|
||||||
"creating_platform_index",
|
"creating_platform_index",
|
||||||
"creating_component_generic_discovery"
|
"creating_component_generic_discovery",
|
||||||
|
"reproduce_state_index"
|
||||||
],
|
],
|
||||||
"Development Checklist": [
|
"Development Checklist": [
|
||||||
"development_checklist",
|
"development_checklist",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user