From dca869cba72abc5a1944676170a39f5cf538f7c0 Mon Sep 17 00:00:00 2001 From: Yevhenii Vaskivskyi Date: Tue, 31 Oct 2023 18:05:22 +0100 Subject: [PATCH] Add network speed values on first empty run (#321) --- asusrouter/asusrouter.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/asusrouter/asusrouter.py b/asusrouter/asusrouter.py index 5ba636c..f328cb6 100644 --- a/asusrouter/asusrouter.py +++ b/asusrouter/asusrouter.py @@ -379,8 +379,14 @@ def _transform_data(self, datatype: AsusData, data: Any) -> Any: if not "dualwan" in _services: return data - # Add usb network if not available network = data.copy() + # Add speed if not available - fix first empty value round + for interface in network: + for speed in ("rx_speed", "tx_speed"): + if not speed in network[interface]: + network[interface][speed] = 0.0 + + # Add usb network if not available if not "usb" in network: # Check history history = self._state.get(AsusData.NETWORK)