Integration od the Elster/Elfatherm/Kromschröder heating controller into Loxone using a Raspberry Pi and Python
- Loxone Miniserver Gen 1
- Raspberry Pi 3 Model B
- Innomaker USB2CAN
- Elster/Kromschröder/Elfatherm E8.0634 and E8.1124
- Set up Raspberry Pi
- Create connection to CAN bus
- Create virtual inputs in Loxone
- Send test values to virtual inputs
- Create mapping of values needed for the visualization
- Write Python program to read values from CAN bus
- Extend Python program to send values to Loxone via HTTP
Used image: Raspberry Pi OS Lite (64-bit), available on https://www.raspberrypi.com/software/operating-systems/
During the initial boot the keyboard, a user and password is configured. After the first login, the WLAN is set up using raspi-config
.
The system is updated by
sudo apt update
sudo apt upgrade
The USB2CAN interface is connected to the respective bus pins in the heating controller named H, L and -.
The USB2CAN interface is connected to the Raspberry Pi using USB.
The CAN interface needs to be configured by
sudo ip link set can0 up type can bitrate 20000 listen-only off
The programs built by Jürg Müller are used to scan the CAN bus for valid CAN ids.
The archive is installed by
wget http://juerg5524.ch/data/can_progs.zip
unzip can_progs.zip
cd can_progs
chmod a+x *.arm
The linking errors are fixed by changing the files to compile the programs
perl -w -i -n -e 's/-lpthread/-lpthread -pthread/g; print' *.arm
The scan utility is built by
./can_scan.arm
The scan is performed by
stdbuf -oL ./can_scan can0 79f total | tee can_scan.out
tee
is used in combination with stdbuf
to see the progress and save the output to can_scan.out.
It's recommended to perform the following steps in Loxone Config:
- Create a room for the heating. It will be used to restrict permissions on this single room.
- Create a user for the API calls. The user heating will be used in the following example calls.
- Create and remember a password for this user.
- Manage the permissions to to give the user access to the newly created room as part of the standard user group.
Afterwards, a virtual input is created for every value to be shown in the user interface. The names of the virtual inputs is later used to send values to these inputs.
- Select Virtual Inputs in the periphery pane.
- Create a new Virtual Input by clicking on the icon in the menu bar.
- Set the name of the input in the properties pane.
- Select the previously created room for this input.
- Unset Use Digital Input.
- Set the unit accordingly, e. g. <v.1>°C
- Set Show status only.
Repeat these steps for all virtual inputs.
The function of the virtual inputs can be tested by
curl -u heating:password http://ip_of_loxone/dev/sps/io/name_of_input/value
e. g.
curl -u heating:password http://10.0.0.14/dev/sps/io/outside_temperature/12.0
API documentation in German: https://www.loxone.com/dede/kb/webservices/
An already existing project on GitHub showed much of the needed functionality: https://github.com/danielbayerlein/sepicker
I extended the project by implementing the missing feature of sending the HTTP request.
My project can be found on https://github.com/fknipp/canpicker