You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core/entity/scene.md
+23-1Lines changed: 23 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ Other properties that are common to all entities such as `icon` and `name` etc a
23
23
Activate the scene.
24
24
25
25
```python
26
-
class MySwitch(Scene):
26
+
class MyScene(Scene):
27
27
# Implement one of these methods.
28
28
29
29
def activate(self, **kwargs: Any) -> None:
@@ -36,6 +36,28 @@ class MySwitch(Scene):
36
36
The activate method can be used to activate the scene towards a device or service.
37
37
It is called by Home Assistant when the user presses the scene `activate` button or when the `scene.turn_on` action is called to activate the scene.
38
38
39
+
Some integrations can receive external events that activate scenes outside of Home Assistant. These activations do not originate from the Home Assistant UI or service calls, but from external sources such as physical buttons.
40
+
41
+
To support this scenario, integrations should extend from `BaseScene` instead of `Scene`, override `_async_activate()` to handle the scene activation from the Home Assistant side, and call `_async_record_activation()` when an external scene activation occurs.
42
+
43
+
Also, since these scenes activate outside of Home Assistant, the integration may want to delay updating scene state timestamp until the external scene reports being active, even when it is activated from the Home Assistant UI.
0 commit comments