kbr / fritzconnection

Python-Tool to communicate with the AVM Fritz!Box by the TR-064 protocol and the AHA-HTTP-Interface
MIT License
322 stars 60 forks source link

Homeautomation -> invalid action #125

Open SjurWarEagle opened 3 years ago

SjurWarEagle commented 3 years ago

Hi,

I'm trying to get your code running, sadly with not much success, maybe you can give me a hint of what I'm doing wrong.

root@machine:/project/fritzconnection# fritzhomeauto -i <ip> -p "<secret>" -e

-e or no encryption makes no difference.

fritzconnection v1.7.1
FRITZ!Box 7590 at https://<ip>
FRITZ!OS: 7.29

FritzHomeautomation:
Status of registered home-automation devices:

Device Name             AIN                 Power[W]   t[°C]   switch
Traceback (most recent call last):
  File "/usr/local/bin/fritzhomeauto", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/dist-packages/fritzconnection/cli/fritzhomeauto.py", line 80, in main
    report_status(fh, arguments)
  File "/usr/local/lib/python3.9/dist-packages/fritzconnection/cli/fritzhomeauto.py", line 51, in report_status
    report_compact(fh)
  File "/usr/local/lib/python3.9/dist-packages/fritzconnection/cli/fritzhomeauto.py", line 34, in report_compact
    for di in fh.device_informations():
  File "/usr/local/lib/python3.9/dist-packages/fritzconnection/lib/fritzhomeauto.py", line 65, in device_informations
    info = self.get_device_information_by_index(n)
  File "/usr/local/lib/python3.9/dist-packages/fritzconnection/lib/fritzhomeauto.py", line 48, in get_device_information_by_index
    return self._action('GetGenericDeviceInfos', NewIndex=index)
  File "/usr/local/lib/python3.9/dist-packages/fritzconnection/lib/fritzhomeauto.py", line 30, in _action
    return self.fc.call_action(SERVICE, actionname, arguments=arguments)
  File "/usr/local/lib/python3.9/dist-packages/fritzconnection/core/fritzconnection.py", line 284, in call_action
    return self.soaper.execute(service, action_name, arguments)
  File "/usr/local/lib/python3.9/dist-packages/fritzconnection/core/soaper.py", line 259, in execute
    return handle_response(response)
  File "/usr/local/lib/python3.9/dist-packages/fritzconnection/core/soaper.py", line 241, in handle_response
    raise_fritzconnection_error(response)
  File "/usr/local/lib/python3.9/dist-packages/fritzconnection/core/soaper.py", line 164, in raise_fritzconnection_error
    raise exception(message)
fritzconnection.core.exceptions.FritzActionError: UPnPError:
errorCode: 401
errorDescription: invalid action

Of course when make the call using my own python script and not the provided script I get the same message.

In the webfrontend the home automation device list is filled (sorry for German screenshot in English error report) image

It somehow feels strange, that the connection is working, it can read the os version, but getting other data is not possible. Is there some permission on Fritzbox Side I have to provide?

DeKubus commented 3 years ago

401 is an authentication error. You need to authenticate the operation by using the --username and --password arguments.

It somehow feels strange, that the connection is working, it can read the os version, but getting other data is not possible.

The operation you want to perform requires a login, whereas listing the device info does not.

sanderjo commented 11 months ago

@SjurWarEagle do other commands work, for example


$ fritzhosts -i 192.168.178.1 -p blabla123 

fritzconnection v1.13.2
FRITZ!Box 5530 Fiber at http://192.168.178.1
FRITZ!OS: 7.58

FritzHosts:
List of registered hosts:

  n: ip               name                         mac                 status

  1: 192.168.178.22   DiskStation                  00:11:32:15:7F:EE   -
  2: 192.168.178.33   Galaxy-S20-FE-5G             22:4C:CC:C0:8F:AA   active
  3: 192.168.178.31   Google-Home-Mini             44:07:0B:5F:8B:BB   active
...
``