Skip to content

Commit 5ebfc02

Browse files
committed
fix previous state and use model dump instead of __dict__
1 parent 367d08b commit 5ebfc02

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

zha/application/platforms/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def __init__(self, unique_id: str) -> None:
7373

7474
self._unique_id: str = unique_id
7575

76-
self.__previous_state: Any = None
76+
self._previous_state: Any = None
7777
self._tracked_tasks: list[asyncio.Task] = []
7878
self._tracked_handles: list[asyncio.Handle] = []
7979

@@ -215,12 +215,12 @@ async def on_remove(self) -> None:
215215
def maybe_emit_state_changed_event(self) -> None:
216216
"""Send the state of this platform entity."""
217217
state = self.state
218-
if self.__previous_state != state:
218+
if self._previous_state != state:
219219
self.emit(
220220
STATE_CHANGED,
221221
EntityStateChangedEvent(state=self.state, **self.identifiers.__dict__),
222222
)
223-
self.__previous_state = state
223+
self._previous_state = state
224224

225225
def log(self, level: int, msg: str, *args: Any, **kwargs: Any) -> None:
226226
"""Log a message."""
@@ -513,7 +513,7 @@ def info_object(self, entity_info: BaseEntityInfoType) -> None:
513513
@property
514514
def state(self) -> dict[str, Any]:
515515
"""Return the arguments to use in the command."""
516-
return self._entity_info.state.__dict__
516+
return self._entity_info.state.model_dump()
517517

518518
@state.setter
519519
def state(self, value: dict[str, Any]) -> None:

0 commit comments

Comments
 (0)