diff --git a/test/model/test_controller.py b/test/model/test_controller.py index 514581ec8..7b970b842 100644 --- a/test/model/test_controller.py +++ b/test/model/test_controller.py @@ -2254,6 +2254,11 @@ async def test_additional_events(controller: Controller) -> None: {"source": "controller", "event": "inclusion started", "strategy": 0}, ) controller.receive_event(event) + event = Event( + "inclusion state changed", + {"source": "controller", "event": "inclusion state changed", "state": 1}, + ) + controller.receive_event(event) event = Event( "inclusion stopped", {"source": "controller", "event": "inclusion stopped"} ) diff --git a/zwave_js_server/model/controller/__init__.py b/zwave_js_server/model/controller/__init__.py index 55ae96f42..e4c01af8c 100644 --- a/zwave_js_server/model/controller/__init__.py +++ b/zwave_js_server/model/controller/__init__.py @@ -901,6 +901,9 @@ def handle_exclusion_failed(self, event: Event) -> None: def handle_inclusion_started(self, event: Event) -> None: """Process an inclusion started event.""" + def handle_inclusion_state_changed(self, event: Event) -> None: + """Process an inclusion state changed event.""" + def handle_exclusion_started(self, event: Event) -> None: """Process an exclusion started event.""" diff --git a/zwave_js_server/model/controller/event_model.py b/zwave_js_server/model/controller/event_model.py index 65e3aea58..e347d5db2 100644 --- a/zwave_js_server/model/controller/event_model.py +++ b/zwave_js_server/model/controller/event_model.py @@ -4,7 +4,7 @@ from typing import Literal, TypedDict -from ...const import InclusionStrategy, RemoveNodeReason +from ...const import InclusionState, InclusionStrategy, RemoveNodeReason from ...event import BaseEventModel from ..node.data_model import FoundNodeDataType, NodeDataType from .firmware import ( @@ -154,6 +154,22 @@ def from_dict(cls, data: dict) -> InclusionStartedEventModel: ) +class InclusionStateChangedEventModel(BaseControllerEventModel): + """Model for `inclusion state changed` event data.""" + + event: Literal["inclusion state changed"] + state: InclusionState + + @classmethod + def from_dict(cls, data: dict) -> InclusionStateChangedEventModel: + """Initialize from dict.""" + return cls( + source=data["source"], + event=data["event"], + state=data["state"], + ) + + class InclusionStoppedEventModel(BaseControllerEventModel): """Model for `inclusion stopped` event data.""" @@ -336,6 +352,7 @@ def from_dict(cls, data: dict) -> StatusChangedEventModel: "inclusion aborted": InclusionAbortedEventModel, "inclusion failed": InclusionFailedEventModel, "inclusion started": InclusionStartedEventModel, + "inclusion state changed": InclusionStateChangedEventModel, "inclusion stopped": InclusionStoppedEventModel, "node added": NodeAddedEventModel, "node found": NodeFoundEventModel,