Skip to content

Commit 12d4ddc

Browse files
authored
Fix attr update (#11)
* Fix issue with new attribute version * Fix style
1 parent bcd4d61 commit 12d4ddc

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

connect_box/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ async def async_get_devices(self) -> List[Device]:
5050
if self.token is None:
5151
await self.async_initialize_token()
5252

53-
raw = await self._async_ws_function(CMD_DEVICES)
5453
self.devices.clear()
54+
raw = await self._async_ws_function(CMD_DEVICES)
55+
5556
try:
5657
xml_root = element_tree.fromstring(raw)
5758
mac_adresses: List[str] = [mac.text for mac in xml_root.iter("MACAddr")]
@@ -71,15 +72,14 @@ async def async_get_devices(self) -> List[Device]:
7172

7273
async def async_get_downstream(self):
7374
"""Get the current downstream cable modem state."""
74-
7575
if self.token is None:
7676
await self.async_initialize_token()
7777

78+
self.ds_channels.clear()
7879
raw = await self._async_ws_function(CMD_DOWNSTREAM)
7980

8081
try:
8182
xml_root = element_tree.fromstring(raw)
82-
self.ds_channels.clear()
8383
for downstream in xml_root.iter("downstream"):
8484
self.ds_channels.append(
8585
DownstreamChannel(
@@ -102,15 +102,14 @@ async def async_get_downstream(self):
102102

103103
async def async_get_upstream(self):
104104
"""Get the current upstream cable modem state."""
105-
106105
if self.token is None:
107106
await self.async_initialize_token()
108107

108+
self.us_channels.clear()
109109
raw = await self._async_ws_function(CMD_UPSTREAM)
110110

111111
try:
112112
xml_root = element_tree.fromstring(raw)
113-
self.us_channels.clear()
114113
for upstream in xml_root.iter("upstream"):
115114
self.us_channels.append(
116115
UpstreamChannel(

connect_box/data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Device:
1111

1212
mac: str = attr.ib()
1313
hostname: str = attr.ib(cmp=False)
14-
ip: Union[IPv4Address, IPv6Address] = attr.ib(cmp=False, convert=convert_ip)
14+
ip: Union[IPv4Address, IPv6Address] = attr.ib(cmp=False, converter=convert_ip)
1515

1616

1717
@attr.s

0 commit comments

Comments
 (0)