From 92d52b247aec48472753a270384e3081069a333a Mon Sep 17 00:00:00 2001 From: Simon Hansen <67142049+DurgNomis-drol@users.noreply.github.com> Date: Fri, 17 Nov 2023 20:42:37 +0100 Subject: [PATCH] Make wan_ipv4_uptime return None if it doesn't exists --- README.md | 2 +- tplinkrouterc6u/client.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6e2112a..729e61f 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ asyncio.run(tasks()) | guest_5g_enable | Is guest wifi 5G enabled | bool | | wifi_2g_enable | Is main wifi 2.4G enabled | bool | | wifi_5g_enable | Is main wifi 5G enabled | bool | -| wan_ip4_uptime | Internet Uptime | int | +| wan_ipv4_uptime | Internet Uptime | int | | mem_usage | Memory usage | float | | cpu_usage | CPU usage | float | | devices | List of all wifi clients | list[[Device](#device)] | diff --git a/tplinkrouterc6u/client.py b/tplinkrouterc6u/client.py index a25044f..519a3f0 100644 --- a/tplinkrouterc6u/client.py +++ b/tplinkrouterc6u/client.py @@ -140,7 +140,7 @@ def _calc_cpu_usage(data: dict) -> float: status = Status status.devices = [] status.macaddr = data['lan_macaddr'] - status.wan_ipv4_uptime = data['wan_ipv4_uptime'] + status.wan_ipv4_uptime = data.get('wan_ipv4_uptime') status.mem_usage = data['mem_usage'] status.cpu_usage = _calc_cpu_usage(data) status.wired_total = len(data['access_devices_wired']) if data.__contains__('access_devices_wired') else 0