Hallo. Ich habe die HUUM Sauna in gemeinsamer Arbeit mit meinem Nachbarn in der IP Symcon zum laufen gebracht. Hier die Skripte, die ihr dafür braucht:
Status-Abfrage
<?php
include("23592.ips.php"); // Zugangsdaten
error_reporting(E_ALL);
$url = 'https://api.huum.eu/action/home/status';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, "$HUUM_User:$HUUM_Password");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, 1);
$result = curl_exec($ch);
$info = curl_getinfo($ch);
$nhl=json_decode($result);//,true);
curl_close($ch);
$STATUS = $nhl->{"statusCode"};
$DOOR = $nhl->{"door"};
$TEMP = (int)$nhl->{"temperature"};
SetValueInteger(13977,$STATUS);
SetValueBoolean(29505,$DOOR);
SetValueInteger(22920,$TEMP);
if ($STATUS==231){
SetValueBoolean(22556,true);
$TargetTemp = (int)$nhl->{"targetTemperature"};
SetValueInteger(58504,$TargetTemp);
}else{
SetValueBoolean(22556,false);
}
?>
Sauna Anschalten
<?php
include("23592.ips.php"); // Zugangsdaten
error_reporting(E_ALL);
$url = 'https://api.huum.eu/action/home/start';
$TagetTemp = GetValueInteger(58504);
$hTime = GetValueInteger(14037);
echo $hTime ."\n";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, array("targetTemperature"=>$TagetTemp)); // {"statusCode": 232, "door": true, "temperature": "23", "targetTemperature": "50", "startDate": 1507184846, "endDate": 1507184846, "duration": 0, "config": 2, "steamerError": 0, "paymentEndDate" : SOMEDATE}
curl_setopt($ch, CURLOPT_USERPWD, "$HUUM_User:$HUUM_Password");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, 1);
$result = curl_exec($ch);
$info = curl_getinfo($ch);
$nhl=json_decode($result,true);
curl_close($ch);
//var_dump($nhl);
?>
Sauna Ausschalten
<?php
include("23592.ips.php"); // Zugangsdaten
error_reporting(E_ALL);
$url = 'https://api.huum.eu/action/home/stop';
$TagetTemp = GetValueInteger(58504);
$hTime = GetValueInteger(14037);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, "$HUUM_User:$HUUM_Password");
curl_setopt($ch, CURLOPT_POSTFIELDS, array("targetTemperature"=>$TagetTemp));
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, 1);
$result = curl_exec($ch);
$info = curl_getinfo($ch);
$nhl=json_decode($result,true);
curl_close($ch);
//var_dump($nhl);
?>
Ich habe dann 3 Variablen in der Sauna-Kategorie angelegt, die sich dann alle paar Sekunden aktualisieren, oder wenn eines der Skripte ausgeführt wird. Damit habe ich dann die Info über den Status der Sauna in der WebFront. Ich hoffe, es hilft irgendjemandem weiter…