Fritzbox SmartHome C++ Interface
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Steffen Pohle e5ae9fa81f
If a XmlGet struct returned NULL, atoi and atof will segfault due to no NULL pointer checking.
4 years ago
.gitignore adding binary fbsh-cli to ignore list 4 years ago
Makefile using old TCP implementation with WebDownloading from now. 4 years ago
README.md adding light and switch control 4 years ago
cfg.cc adding gethzr, fixing issued with readin default config file. 4 years ago
cfg.h FritzBox Login is working now 4 years ago
fb-login-test.sh adding gethzr, fixing issued with readin default config file. 4 years ago
fbsh-cli.cc adding light and switch control 4 years ago
fbsh.cc If a XmlGet struct returned NULL, atoi and atof will segfault due to no NULL pointer checking. 4 years ago
fbsh.h adding light and switch control 4 years ago

README.md

FBSmartHome

A small collection of one usefull FritzBox SmartHome tool and one example script. Still in development and highly experimental.

If you have any issues or questions regarding this tool and script just get in contact with me.

fb-login-test.sh

A simple script to test the user name and passwort set in file ~/.fbsh.config. If the login was successfull an XML file with connected SmartHome devices will be printed out.

The config file for both script and client use the same syntax.

#
# PARAMETERNAME=VALUE  no space allowed except for the value.
#                      but not between parametername, = and value.
#
#
FBSH_USER=testuser
FBSH_PASS=anypassword
FBSH_SIDFILE=/home/username/.fbsh.sid
FBSH_HOSTNAME=http://192.168.0.1

fbsh-cli FritzBox SmartHome Console Client

I wrote the fbsh-cli tool to get a small easy low ressourced interface for the Fritzbox Smart Home devices. It should be able to get it running on most of the SoC devices which are out there.

Preparation

You need the libxml2 and openssl devel pakages for compilation. In addition you will need to download, compile and install the libUDPTCPNetwork library which includes some helper functions i use. If you have a debian based distribution you can install them with:

apt install libxml2-dev libssl-dev
git clone https://steffen.gulpe.de/gitea/steffen/libUDPTCPNetwork.git
cd libUDPTCPNetwork
make
sudo make install

Compilation

No comment here. Just download, compile and run the tool.

git clone https://steffen.gulpe.de/gitea/steffen/FBSmartHome.git
cd FBSmartHome
make
./fbsh-cli

Configuration File

To set some default settings and create the configuration file, just run the command.

./fbsh-cli -host http://192.168.0.1 -user SOMEUSER -pass SOMEPASSWORD saveconfig

The default configuration will be saved under $HOME/.fbsh.config. In addition the client will save a SID file .fbsh.sid which contains the last known SID (session ID). This file will also be located inside the home directory.

Both script and the client will use the same config file.

Test the Login

Test the connection with ./fbsh-cli connect. The successfull conntion will look like:

user@desktop ~/FBSmartHome $ ./fbsh-cli connect
SID:989346018a2dca53
user@desktop ~/FBSmartHome $  

Supported Commands

  • saveconfig
  • connect
  • list
  • gethkr
  • listhkr
  • switch
  • color
  • level
  • help

Currently Not Working

  • HTTPS is yet not supported
  • sending commands to switches and lights

Sample Output

steffen@pc1 ~/Dokumente/Programmierung/FBSmartHome $ ./fbsh-cli listhkr
01234 0001234 name:Heizung 1 temp:19.5 cur:19.5 set:21.0
01234 0001235 name:Heizung 2 temp:19.0 cur:19.0 set:19.0
01234 0001236 name:Heizung 3 temp:21.5 cur:21.5 set:22.0
steffen@pc1 ~/Dokumente/Programmierung/FBSmartHome $

Screenshot1