This daemon is fetching data from the S 3200 and store it in a MariaDb database.
Written by: Jörg Wendel (linux at jwendel dot de)
Homepage: https://github.com/horchi/linux-p4d
This code is distributed under the terms and conditions of the GNU GENERAL PUBLIC LICENSE. See the file LICENSE for details.
USE AT YOUR OWN RISK. No warranty. This software is a private contribution and not related Fröling. It may not work with future updates of the S3200 firmware and can also cause unintended behavior. Use at your own risk! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Die Software wurde für den Eigengebrauch erstellt. Sie wird kostenlos unter der GPLv2 veröffentlicht.
Es ist kein fertiges Produkt, die Software entstand als Studie was hinsichtlich der Kommunikation mit der s3200 Steuerung möglich ist und kann Bastlern als Basis und Anregung für eigene Projekte dienen.
Es besteht kein Anspruch auf Funktion, jeder der sie einsetzen möchte muss das Risiko selbst abschätzen können und wissen was er tut, insbesondere auch in Hinblick auf die Einstellungen der Heizungsparameter und den damit verbundenen Risiken hinsichtlich Fehlfunktion, Störung, Brand, etc. Falsche Einstellung können unter anderem durch Bedienfehler und Fehler in dieser Software ausgelöst werden! Die Vorgaben, Vorschriften und AGB des Herstellers der Heizung bleiben maßgebend! Ich kann nicht ausschließen das es zu Fehlfunktionen oder unerwartetem Verhalten, auch hinsichtlich der zur Heizung übertragenen Daten und damit verbundenen, mehr oder weniger kritischen Fehlfunktionen derselben kommen kann!
If this project help you, you can give me a cup of coffee :)
wget www.jwendel.de/p4d/install-deb.sh -O /tmp/install-deb.sh
sudo bash /tmp/install-deb.sh
dpkg --remove p4d
dpkg --purge p4d
Update your package data:
sudo apt update
and, if you like, update your installation:
sudo apt dist-upgrade
dpkg-reconfigure locales
)at least version 4.1 or above you can clone it from git at https://libwebsockets.org/repo/libwebsockets
It's not required to host the database on the Raspberry. A remote database is supported as well! Perform all the following steps as root user! Either by getting root or by prefix each command with sodo.
apt install mariadb-server
(set database password for root user during installation)
If the database server is located localy on same host as the p4d:
> mysql -u root -Dmysql -p
CREATE DATABASE p4 charset utf8;
CREATE USER 'p4'@'localhost' IDENTIFIED BY 'p4';
GRANT ALL PRIVILEGES ON p4.* TO 'p4'@'localhost' IDENTIFIED BY 'p4';
flush privileges;
if the database is running remote (on a other host or you like to habe remote access):
> mysql -u root -Dmysql -p
CREATE DATABASE p4 charset utf8;
CREATE USER 'p4'@'%' IDENTIFIED BY 'p4';
GRANT ALL PRIVILEGES ON p4.* TO 'p4'@'%' IDENTIFIED BY 'p4';
flush privileges;
apt install mosquitto
systemctl start mosquitto
systemctl enable mosquitto
install mosquitto-clients
apt install build-essential pkg-config libssl-dev libjansson-dev libcurl4-openssl-dev libmariadb-dev uuid-dev libcap-dev liblua5.3-dev
cd /usr/src/
git clone https://github.com/horchi/linux-p4d/
cd linux-p4d
make clean all
make install
make install INIT_SYSTEM=sysV
/usr/local/bin
and its config in /etc/p4d//etc/p4d/daemon.conf
file for setting db connection papameters,systemctl start p4d
systemctl status p4d
it should now 'enabled' and in state 'running'!
grep "p4d:" /var/log/syslog
The samples will recorded in the configured interval (at the setup page), the default is 60 Seconds. After a while the database will grow and the selects become slower. Therefore you can setup a automatic aggregation by adjusting 'Historie' and 'Danach aggregieren über'
A 'Historie' of 365 means that all samples older than 365 days will be aggregated to one sample per ''Danach aggregieren über' minutes (for example 15 minutes) If you like to completely delete 'old' samples you have to do the cleanup job by hand, actually I don't see the need to delete anything, I like to hold my data (forever :) ?).
The default port of the WEB interface is 1111, The default username and password for the login is User: p4 Pass: p4
After this you can set up the schema configuration. The schema configuration is done by drag&drop and isn't working on mobile devices! Also deleting of chart bookmarks isn't supported on mobile devices.
The next steps are an example to setup the sending of mails. If another tool is preferred it can be used as well.
Install required components
apt-get install bsd-mailx msmtp msmtp-mta
The mailscript p4d-mail.sh
is copied during the make install
to the folder /usr/local/bin
. This script is used in our case to send mails
Setup your mail account in /etc/msmtprc
Start the WEBIF and Login, go to the Setup page
Configure the "Mail Benachrichtigungen" options (status and Fehler Mail Empfänger)
If no Status options are set you will get a mail for each status change
Set the script option /usr/local/bin/p4d-mail.sh
If the heating values are added as attachment to the mail please check the next steps.
heirloom-mailx
is installed (ls -lah /etc/alternatives/mail
)/etc/alternatives/mail -> /usr/bin/mail.mailutils
heirloom-mailx
(apt remove heirloom-mailx
)With the next steps you can enable a time synchronization of the p4d and the heating:
If you enable this feature you can set the max time difference between the p4d systemtime and the time of the heating. The p4d will set the time of the heating (once a day) to his the systemtime. Therefore it is recommended to hold your system time in sync, e.g. by running the ntp
daemon or systemd-timesyncd.
Configure the parameters at the WEBIF
The p4d checks automatically if there are 'One Wire Sensors' connected, each detected sensor will be configurable via the web interface after reading the sensor facts by clicking [init].
To make the sensors availaspble to the raspi you have to load the w1-gpio
module, this can be done by calling modprobe w1-gpio
or automatically at boot by registering it in /etc/modules
:
echo "w1-gpio" >> /etc/modules
echo "w1_therm" >> /etc/modules
echo "dtoverlay=w1-gpio,gpioin=4,pullup=on" >> /boot/config.txt
You can chose the Web Interface Style at 'Setup' -> 'Allg. Konfiguration' with the options 'Farbschema' and 'Icon Style Set'. The 'Farbschema' option include all CSS styles which are found in your web folder and fit the naming scheme 'stylesheet-.css' where the wildcard '' is used as the name of the style. The 'Icon Style Set' option includes the name of all suborders of img/state/* in your web folder. You can place additional custom styles and icon sets which automatically appear in the settings. The default web folder is /var/lib/p4/.
Backup the data of the p4 database including all recorded values:
p4d-backup.sh
This will create a dump file for each table like:
<tablename>-dump.sql.gz
To import the backup:
gunzip NAME-dump.sql.gz
mysql -u p4 -pp4 -Dp4 < *-dump.sql
https://hub.docker.com/r/n3m3515/docker-p4d
The import deletes at first all the data and then imports the dumped data. To append the dumped data you have to modify the SQL statements inside the dump files manually.
If you cannot figure out why you get Access denied, remove all entries from the user table that have Host values with wildcars contained (entries that match %
or _
characters). A very common error is to insert a new entry with Host='%'
and User='some_user'
, thinking that this allows you to specify localhost to connect from the same machine. The reason that this does not work is that the default privileges include an entry with Host='localhost'
and User=''
. Because that entry has a Host value localhost
that is more specific than %
, it is used in preference to the new entry when connecting from localhost! The correct procedure is to insert a second entry with Host='localhost'
and User='some_user'
, or to delete the entry with Host='localhost'
and User=''
. After deleting the entry, remember to issue a FLUSH PRIVILEGES
statement to reload the grant tables.
To analyze this you can show all users:
use mysql
SELECT host, user FROM user;