Skip to content

Commit

Permalink
fix(core): expose device raw_state
Browse files Browse the repository at this point in the history
  • Loading branch information
petretiandrea committed Mar 29, 2024
1 parent a5298cd commit a571b7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugp100/new/tapodevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
class LastUpdate:
components: Components
device_info: DeviceInfo
raw_state: dict[str, Any]


class TapoDevice:
Expand Down Expand Up @@ -62,7 +63,7 @@ async def update(self):
else:
state = (await self.client.get_device_info()).get_or_raise()
self._last_update = LastUpdate(
device_info=DeviceInfo(**state), components=components
device_info=DeviceInfo(**state), components=components, raw_state=state
)
await self._update_from_state(state)
_LOGGER.info("Fetching component updates...")
Expand Down Expand Up @@ -126,6 +127,10 @@ def overheated(self) -> bool:
def firmware_version(self) -> str:
return self.device_info.get_semantic_firmware_version().__str__()

@property
def hardware_version(self) -> str:
return self.device_info.hardware_version

@property
def wifi_info(self) -> "WifiInfo":
return WifiInfo(self.device_info.signal_level, self.device_info.rssi)
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_plug_strip.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ async def test_must_expose_device_info(device: TapoPlug):
async def test_must_expose_socks_info(device: TapoPlug):
for sock in device.sockets:
assert sock.device_type == DeviceType.Plug
assert sock.device_id != device.device_id
assert sock.device_id is not None
assert sock.mac is not None
assert sock.model is not None
Expand Down

0 comments on commit a571b7a

Please sign in to comment.