Fritz!Box DECT radiator control device („Booster button“)

Post Reply
User avatar
elythomaslumber
Posts: 305
Joined: Friday 12 July 2013 13:29
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: Solingen; Germany
Contact:

Fritz!Box DECT radiator control device („Booster button“)

Post by elythomaslumber » Sunday 07 January 2018 12:49

Been a long time away from this forum but my Domoticz is still running for years on 1.1803 on a RP.

Now I exchanged my router to a AVM Fritz!Box 7590 and added some radiator control devices (COMET = DECT300 / DECT301) as replacement for my old ones. What I´m missing was the „Booster button“. By pressing this button the control device opens the valve for 5min giving some heat for situations out of time schedule controlled phases.

I found a nice PHP script in the web which makes the most work since it is needed to login and logout to the Fritz!Box automatically. Here´s the source link:
http://www.wetterstationen.info/forum/e ... n-per-php/

It´s written in German but the script is more or less self explaning. You have to modify the password and $ain (= device identifier = MAC adress of your heating control device or switch).
What I also added/modified are the control request command lines for the radiator control devices (on or off). I placed the scripts here:

home/pi/domoticz/scripts

Don´t forget to make it runable: chmod +x filename.php

Have a look at my code especially on this line:

// Bath Temperatur-Booster fuer 5min
$import = file_get_contents('http://fritz.box/webservices/homeautosw ... ='.$ainBad. '&switchcmd=sethkrtsoll&param=34&sid='.$SID.'');


The parameter „56“ stand for 28°C (28 x 2 = 56) which opens the valve and „34“ stand for 17°C (17 x 2 = 34) closing the valve.

Then I added manually a device in Domoticz („Push on button“) and placed the script link „script://home/pi/domoticz/hzng-booster-bad_on.php“ in the „on Action“ field. Same with the „script://home/pi/domoticz/hzng-booster-bad_off“.php in the „off Action“ field and set the timer to 300sec.

Of cause the PHP script can be used to read or set other devices like DECT switches DECT200 or compatible devices. More information here: https://avm.de/service/schnittstellen/ (hope there are a English web-page or documents available).
I someone needs help I will support.

ON script:

Code: Select all

#!/usr/bin/php
<?php 
// Benutzerspezifische Angaben
$fritzbox_Password    = 'xxxxxxxxx';
$ainBad = '119600xxxxxx'; //Bath

// Challenge bei der Fritz.box holen
$ch = curl_init('http://fritz.box/login_sid.lua');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$login = curl_exec($ch);
$session_status_simplexml = simplexml_load_string($login);
if ($session_status_simplexml->SID != '0000000000000000')
{
   $SID = $session_status_simplexml->SID;
}
else
// Session ID errechnen aus Challenge, Passwort und MD5-Verschlüsselung
{
   $challenge = $session_status_simplexml->Challenge;
   $response = $challenge . '-' . md5(mb_convert_encoding($challenge . '-' . $fritzbox_Password, "UCS-2LE", "UTF-8"));
   curl_setopt($ch, CURLOPT_POSTFIELDS, "response={$response}&page=/login_sid.lua");
   $sendlogin = curl_exec($ch);
   $session_status_simplexml = simplexml_load_string($sendlogin);
   if ($session_status_simplexml->SID != '0000000000000000')
       {
       $SID = $session_status_simplexml->SID;
       }
   else
       {
       echo "Fehler: Login fehlgeschlagen";
       return;
       }
}
curl_close($ch);

//  Bath Temperatur-Booster fuer 5min
$import = file_get_contents('http://fritz.box/webservices/homeautoswitch.lua?ain='.$ainBad. '&switchcmd=sethkrtsoll&param=56&sid='.$SID.'');

// von der Fritz.box abmelden
$logout = file_get_contents('http://fritz.box/home/home.lua?sid='.$SID.'&logout=1');
?>
Off script:

Code: Select all

#!/usr/bin/php
<?php 
// Benutzerspezifische Angaben
$fritzbox_Password    = 'xxxxxxxx';
$ainBad = '119600xxxxxx'; //Bath

// Challenge bei der Fritz.box holen
$ch = curl_init('http://fritz.box/login_sid.lua');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$login = curl_exec($ch);
$session_status_simplexml = simplexml_load_string($login);
if ($session_status_simplexml->SID != '0000000000000000')
{
   $SID = $session_status_simplexml->SID;
}
else
// Session ID errechnen aus Challenge, Passwort und MD5-Verschlüsselung
{
   $challenge = $session_status_simplexml->Challenge;
   $response = $challenge . '-' . md5(mb_convert_encoding($challenge . '-' . $fritzbox_Password, "UCS-2LE", "UTF-8"));
   curl_setopt($ch, CURLOPT_POSTFIELDS, "response={$response}&page=/login_sid.lua");
   $sendlogin = curl_exec($ch);
   $session_status_simplexml = simplexml_load_string($sendlogin);
   if ($session_status_simplexml->SID != '0000000000000000')
       {
       $SID = $session_status_simplexml->SID;
       }
   else
       {
       echo "Fehler: Login fehlgeschlagen";
       return;
       }
}
curl_close($ch);

//  Bath Temperatur-Booster fuer 5min
$import = file_get_contents('http://fritz.box/webservices/homeautoswitch.lua?ain='.$ainBad. '&switchcmd=sethkrtsoll&param=34&sid='.$SID.'');

// von der Fritz.box abmelden
$logout = file_get_contents('http://fritz.box/home/home.lua?sid='.$SID.'&logout=1');
?>
Raspberry Pi & Domoticz 3.8153
RFXCOM FW1022
Wall panel APPLE iPAD 3.generation
Fritz!Box 7590 & Eurotronic COMET DECT Thermostat
https://www.qrz.com/db/DK5LH

Post Reply

Who is online

Users browsing this forum: Furiousz23 and 2 guests