Skip to content

Commit

Permalink
Fix attr update (#11)
Browse files Browse the repository at this point in the history
* Fix issue with new attribute version

* Fix style
  • Loading branch information
pvizeli authored Oct 4, 2019
1 parent bcd4d61 commit 12d4ddc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions connect_box/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ async def async_get_devices(self) -> List[Device]:
if self.token is None:
await self.async_initialize_token()

raw = await self._async_ws_function(CMD_DEVICES)
self.devices.clear()
raw = await self._async_ws_function(CMD_DEVICES)

try:
xml_root = element_tree.fromstring(raw)
mac_adresses: List[str] = [mac.text for mac in xml_root.iter("MACAddr")]
Expand All @@ -71,15 +72,14 @@ async def async_get_devices(self) -> List[Device]:

async def async_get_downstream(self):
"""Get the current downstream cable modem state."""

if self.token is None:
await self.async_initialize_token()

self.ds_channels.clear()
raw = await self._async_ws_function(CMD_DOWNSTREAM)

try:
xml_root = element_tree.fromstring(raw)
self.ds_channels.clear()
for downstream in xml_root.iter("downstream"):
self.ds_channels.append(
DownstreamChannel(
Expand All @@ -102,15 +102,14 @@ async def async_get_downstream(self):

async def async_get_upstream(self):
"""Get the current upstream cable modem state."""

if self.token is None:
await self.async_initialize_token()

self.us_channels.clear()
raw = await self._async_ws_function(CMD_UPSTREAM)

try:
xml_root = element_tree.fromstring(raw)
self.us_channels.clear()
for upstream in xml_root.iter("upstream"):
self.us_channels.append(
UpstreamChannel(
Expand Down
2 changes: 1 addition & 1 deletion connect_box/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Device:

mac: str = attr.ib()
hostname: str = attr.ib(cmp=False)
ip: Union[IPv4Address, IPv6Address] = attr.ib(cmp=False, convert=convert_ip)
ip: Union[IPv4Address, IPv6Address] = attr.ib(cmp=False, converter=convert_ip)


@attr.s
Expand Down

0 comments on commit 12d4ddc

Please sign in to comment.