Skip to content

Commit 1ecefe0

Browse files
committed
Use inheritance for StickInitResponse
1 parent 4f8f50b commit 1ecefe0

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

plugwise_usb/messages/responses.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ def __repr__(self) -> str:
446446
return f"{super().__repr__()[:-1]}, network_controller={self.mac_network_controller}, network_online={self.network_online})"
447447

448448

449-
class StickInitResponse(PlugwiseResponse):
449+
class StickInitResponse(StickInitShortResponse):
450450
"""Returns the configuration and status of the USB-Stick - network online.
451451
452452
Optional:
@@ -460,15 +460,11 @@ class StickInitResponse(PlugwiseResponse):
460460

461461
def __init__(self) -> None:
462462
"""Initialize StickInitResponse message object."""
463-
super().__init__(b"0011")
464-
self._unknown1 = Int(0, length=2)
465-
self._network_online = Int(0, length=2)
463+
super().__init__()
466464
self._mac_nc = String(None, length=16)
467465
self._network_id = Int(0, 4, False)
468466
self._unknown2 = Int(0, length=2)
469467
self._params += [
470-
self._unknown1,
471-
self._network_online,
472468
self._mac_nc,
473469
self._network_id,
474470
self._unknown2,
@@ -485,15 +481,6 @@ def network_id(self) -> int:
485481
"""Return network ID."""
486482
return self._network_id.value
487483

488-
@property
489-
def network_online(self) -> bool:
490-
"""Return state of network."""
491-
return self._network_online.value == 1
492-
493-
def __repr__(self) -> str:
494-
"""Convert request into writable str."""
495-
return f"{super().__repr__()[:-1]}, network_controller={self.mac_network_controller}, network_online={self.network_online})"
496-
497484

498485
class CirclePowerUsageResponse(PlugwiseResponse):
499486
"""Returns power usage as impulse counters for several different time frames.

0 commit comments

Comments
 (0)