/python-can-loxone-heating-integration

Integration the Elfatherm/Kromschröder heating controllers into Loxone using a Raspberry Pi and Python

GNU General Public License v3.0GPL-3.0

python-can-loxone-heating-integration

Integration od the Elster/Elfatherm/Kromschröder heating controller into Loxone using a Raspberry Pi and Python

Hardware

Tasks and status

  • 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

Preparation tasks

Set up the Raspberry Pi

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

Connect the heating controller

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.

Finding out CAN addresses

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.

Create virtual inputs in Loxone

It's recommended to perform the following steps in Loxone Config:

  1. Create a room for the heating. It will be used to restrict permissions on this single room.
  2. 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.

  1. Select Virtual Inputs in the periphery pane.
  2. Create a new Virtual Input by clicking on the icon in the menu bar.
  3. Set the name of the input in the properties pane.
  4. Select the previously created room for this input.
  5. Unset Use Digital Input.
  6. Set the unit accordingly, e. g. <v.1>°C
  7. Set Show status only.

Repeat these steps for all virtual inputs.

Send values to 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/

Implementation

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