Skip to content

Commit

Permalink
Make wan_ipv4_uptime return None if it doesn't exists
Browse files Browse the repository at this point in the history
  • Loading branch information
DurgNomis-drol authored Nov 17, 2023
1 parent 6b349e2 commit 92d52b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)] |
Expand Down
2 changes: 1 addition & 1 deletion tplinkrouterc6u/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 92d52b2

Please sign in to comment.