Skip to content

Commit

Permalink
Support old firmware 6.86 when fetching wifi devices
Browse files Browse the repository at this point in the history
Resolves: Tafkas#57
  • Loading branch information
cweiske committed Jan 6, 2022
1 parent d7929f1 commit 155cbd5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion fritzbox_wifi_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
env.fritzbox_ip [ip address of the fritzbox]
env.fritzbox_username [fritzbox username]
env.fritzbox_password [fritzbox password]
This plugin supports the following munin configuration parameters:
#%# family=auto contrib
#%# capabilities=autoconf
Expand Down Expand Up @@ -39,6 +39,14 @@ def get_connected_wifi_devices():

session_id = fh.get_session_id(server, username, password)
xhr_data = fh.get_xhr_content(server, session_id, PAGE)
if xhr_data[0:8] == b"<script>":
#firmware 6.86
m = re.search(pattern, xhr_data.decode("utf-8"))
if m:
connected_devices = int(m.group(1))
print("wifi.value %d" % connected_devices)
return

data = json.loads(xhr_data)
m = re.search(pattern, data["data"]["drain"][2]["statuses"][-1])
if m:
Expand Down

0 comments on commit 155cbd5

Please sign in to comment.