diff --git a/kasa/smartdevice.py b/kasa/smartdevice.py index bf43cf174..25b916318 100755 --- a/kasa/smartdevice.py +++ b/kasa/smartdevice.py @@ -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>" diff --git a/kasa/tests/test_smartdevice.py b/kasa/tests/test_smartdevice.py index 380cdd1fb..2dfd96340 100644 --- a/kasa/tests/test_smartdevice.py +++ b/kasa/tests/test_smartdevice.py @@ -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