kbr / fritzconnection

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

Dial door opener #208

Open mat-l opened 5 months ago

mat-l commented 5 months ago

Hi, I am looking into your package to open the door opener via an API.

I found that the CLI is capable to perform calls such as follows: $ fritzcall -i 192.168.178.1 -u user -p password -c **1

If I am calling **1 in that case my door, than the Fritz Fon offers on one side a button in the screen to trigger the door opener or I can type manually during the phone call # 9 or the defined code to open the door.

Is it possible somehow with your lib?

kbr commented 5 months ago

If there is a step in between (like interaction with the phone) this will not work. But if you are able to address the device (the door opener) by means of the call_action() or call_http() methods, then chances are that it could work by direct interaction with the device.

hmbarth commented 4 months ago

I have a problem that I don't understand. In July 2023 I loaded the package 'fritzconnect' onto my Raspberry using the command 'pip install fritzconnection'. After installation, I was able to use the command 'fritzcall -i 192.168.178.1 -p -c 9' to start a broadcast on the Fritzbox. Now I have installed a new Raspberry and installed the 'fritzconnect' package in the same way. Now the command 'fritzcall -i 192.168.178.1 -p -c 9' no longer works. The -c parameter is no longer known. You can only retrieve data from the Fritzbox, such as incoming or outgoing calls. Why is the -c parameter no longer available. It is no longer listed under 'fritzcall -h' either.

kbr commented 4 months ago

I'm unable to reproduce this. The -c flag is not gone and still implemented in the most recent version:

% fritzconnection -i 192.168.178.1

fritzconnection v1.13.2
FRITZ!Box 7590 at http://192.168.178.1
FRITZ!OS: 7.57

% fritzcall -h
usage: fritzcall [-h] [-i [ADDRESS]] [--port [PORT]] [-u [USERNAME]] [-p [PASSWORD]] [-e [ENCRYPT]] [-x] [-y]
                 [--cache-format [CACHE_FORMAT]] [--cache-directory [CACHE_DIRECTORY]] [-n [NUM]] [-d [DAYS]]
                 [-t [TYPE]] [-c [CALL]]

options:
  -h, --help            show this help message and exit
  -i [ADDRESS], --ip-address [ADDRESS]
                        Specify ip-address of the FritzBox to connect to. Default: 169.254.1.1
  --port [PORT]         Port of the FritzBox to connect to. Default: 49000
  -u [USERNAME], --username [USERNAME]
                        Fritzbox authentication username
  -p [PASSWORD], --password [PASSWORD]
                        Fritzbox authentication password
  -e [ENCRYPT], --encrypt [ENCRYPT]
                        Flag: use secure connection (TLS)
  -x, --use-cache       Flag: use api cache (e[x]cellerate: speed-up subsequent instantiations)
  -y, --suppress-cache-verification
                        Flag: suppress cache verification, implies -x
  --cache-format [CACHE_FORMAT]
                        cache-file format: json|pickle (default: pickle)
  --cache-directory [CACHE_DIRECTORY]
                        path to cache directory (default: ~.fritzconnection)
  -n [NUM], --num [NUM]
                        max number of calls in the call-list
  -d [DAYS], --days [DAYS]
                        number of days to look back for calls.
  -t [TYPE], --type [TYPE]
                        type of calls: [in|out|missed]
  -c [CALL], --call [CALL]
                        phone number to call

Could it be that you have installed an older version by mistake?

hmbarth commented 4 months ago

many thanks for the quick response. Yes you are right! I followed the installation instructions in the documentation for 1.13.2. The command there is called 'pip install fritzconnection'.

https://fritzconnection.readthedocs.io/en/1.13.2/sources/installation.html fritzconnection 1.13.2 The fritzconnection package is available on PyPi and installable by pip:

$ pip install fritzconnection

But I have now found that version 0.8... was installed with this command:

root@xxxxxx:~# fritzconnection -i 192.168.178.1

FritzConnection: version: 0.8.4 model: FRITZ!Box 6690 Cable

I have now uninstalled the software with 'pip uninstall fritzconnection' and deleted all distribution files manually. Then I used the 'pip3 install fritzconnection' command. Now the correct version has been installed and everything is working. Thank you