Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions kasa/smartdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,15 @@ def is_color(self) -> bool:
"""Return True if the device supports color changes."""
return False

@property
def internal_state(self) -> Any:
"""Return the internal state of the instance.

The returned object contains the raw results from the last update call.
This should only be used for debugging purposes.
"""
return self._last_update

def __repr__(self):
if self._last_update is None:
return f"<{self._device_type} at {self.host} - update() needed>"
Expand Down
5 changes: 5 additions & 0 deletions kasa/tests/test_smartdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,8 @@ async def test_childrens(dev):
assert len(dev.children) > 0
else:
assert len(dev.children) == 0


async def test_internal_state(dev):
"""Make sure the internal state returns the last update results."""
assert dev.internal_state == dev._last_update