irgndwie stehe ich auf dem Schlauch. Ich nutze fritzconnection unter Python3, um mit der FritzBox zu kommunizieren. Das klappt auch schon ganz gut, insbesonder kann ich alles mögliche auslesen. Allerdings kriege ich nichts verändert.
Code: Alles auswählen
from fritzconnection import FritzConnection
fc=FritzConnection(address='192.168.2.1', password='12345678', use_tls=True)
ssid = fc.call_action('WLANConfiguration:3', 'GetSSID')
print(ssid)
securityKeys = fc.call_action('WLANConfiguration:3', 'GetSecurityKeys')
print(securityKeys['NewKeyPassphrase'])
print(securityKeys)
Code: Alles auswählen
{'NewSSID': 'MeineSSID'}
MeinPasswortIstGut
{'NewWEPKey0': '', 'NewWEPKey1': '', 'NewWEPKey2': '', 'NewWEPKey3': '', 'NewPreSharedKey': '###', 'NewKeyPassphrase': 'MeinPasswortIstGut'}
Code: Alles auswählen
fc.call_action('WLANConfiguration:3', 'SetSecurityKeys')
Ich probiere z.B.
Code: Alles auswählen
result = fc.call_action('WLANConfiguration:3', 'SetSecurityKeys', NewWEPKey0=' ', NewWEPKey1=' ', NewWEPKey2=' ', NewWEPKey3=' ', NewPreSharedKey=' ', NewKeyPassphrase="12345678")
print (result)
Code: Alles auswählen
Traceback (most recent call last):
File "./wlan.py", line 19, in <module>
result = fc.call_action('WLANConfiguration:3', 'SetSecurityKeys', NewWEPKey0=' ', NewWEPKey1=' ', NewWEPKey2=' ', NewWEPKey3=' ', NewPreSharedKey=' ', NewKeyPassphrase="12345678")
File "/usr/local/lib/python3.7/dist-packages/fritzconnection/core/fritzconnection.py", line 220, in call_action
return self.soaper.execute(service, action_name, arguments)
File "/usr/local/lib/python3.7/dist-packages/fritzconnection/core/soaper.py", line 233, in execute
return handle_response(response)
File "/usr/local/lib/python3.7/dist-packages/fritzconnection/core/soaper.py", line 218, in handle_response
raise_fritzconnection_error(response)
File "/usr/local/lib/python3.7/dist-packages/fritzconnection/core/soaper.py", line 147, in raise_fritzconnection_error
raise exception(message)
fritzconnection.core.exceptions.FritzArgumentError: UPnPError:
errorCode: 402
errorDescription: Invalid Args
Vielen Dank im Voraus
-- Solderdot