@@ -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 (
0 commit comments