diff --git a/70_Klafs.pm b/70_Klafs.pm index 7115f30..5ef3cbb 100644 --- a/70_Klafs.pm +++ b/70_Klafs.pm @@ -612,10 +612,9 @@ sub _Klafs_help { |on | ohne Parameter -> Starten mit zuletzt verwendeten Werten | | | set "name" on Sauna 90 - 3 Parameter: Sauna mit Temperatur [10-100]; Optional Uhrzeit [19:30] | | | set "name" on Saunarium 65 5 - 4 Parameter: Sanarium mit Temperatur [40-75]; Optional HumidtyLevel [0-10] und Uhrzeit [19:30] | -| | set "name" on Infrared 30 5 - 4 Parameter: Infrarot mit Temperatur [20-40] und IR Level [0-10]; Optional Uhrzeit [19:30] | | | Infrarot ist nicht supported, da keine Testumgebung verfuegbar. | ------------------------------------------------------------------------------------------------------------------------------------------------------------ -|off | Schaltet die Sauna|Sanarium|Infrarot aus - ohne Parameter. | +|off | Schaltet die Sauna|Sanarium aus - ohne Parameter. | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |ResetLoginFailures | Bei fehlerhaftem Login wird das Reading LoginFailures auf 1 gesetzt. Damit ist der automatische Login vom diesem Modul gesperrt. | | | Klafs sperrt den Account nach 3 Fehlversuchen. Damit nicht automatisch 3 falsche Logins hintereinander gemacht werden. | @@ -703,7 +702,7 @@ sub _Klafs_saunaid { ################################### sub Set { my ( $hash, $name, $cmd, @args ) = @_; - return if $hash->{Klafs}->{LoginFailures} > 0 and !$cmd; + return if $hash->{Klafs}->{LoginFailures} > 0 && !$cmd; if (Klafs_CONNECTED($hash) eq 'disabled' && $cmd !~ /clear/) { @@ -729,6 +728,8 @@ sub Set { my @Uhrzeit = split(/:/,$Zeit[3]); my $std = $Uhrzeit[0]; my $min = $Uhrzeit[1]; + my $timesel = 0; + my $timeselect = ''; # print "Decoded Zeit:\n".Dumper(@Zeit); #Decoded Zeit: #$VAR1 = 'Mon'; @@ -737,16 +738,16 @@ sub Set { #$VAR4 = '15:15:00'; #$VAR5 = '2022'; -## if($std < 10){ -## if(substr($std,0,1) eq "0"){ -## $std = substr($std,1,1); -## } -## } -## if($min < 10){ -## if(substr($min,0,1) eq "0"){ -## $min = substr($min,1,1); -## } -## } + if($std < 10){ + if(substr($std,0,1) eq "0"){ + $std = substr($std,1,1); + } + } + if($min < 10){ + if(substr($min,0,1) eq "0"){ + $min = substr($min,1,1); + } + } # on () @@ -754,7 +755,7 @@ sub Set { Log3 ($name, 2, "Klafs set $name " . $cmd); klafs_getStatus($hash); - my $mode = ""; + my $mode = "0"; $mode = shift @args; my $aspxauth = $hash->{Klafs}->{cookie}; @@ -768,29 +769,6 @@ sub Set { "Accept-Encoding: gzip, deflate, br\r\n". "Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7\r\n". "Cookie: $aspxauth"; -# my $selectedSaunaTemperature = ReadingsVal( $name, "selectedSaunaTemperature", "90" ); -# my $selectedSanariumTemperature = ReadingsVal( $name, "selectedSanariumTemperature", "65" ); -# my $selectedIrTemperature = ReadingsVal( $name, "selectedIrTemperature", "0" ); -# my $selectedHumLevel = ReadingsVal( $name, "selectedHumLevel", "5" ); -# my $selectedIrLevel = ReadingsVal( $name, "selectedIrLevel", "0" ); -# my $isConnected = ReadingsVal( $name, "isConnected", "true" ); -# my $isPoweredOn = ReadingsVal( $name, "isPoweredOn", "false" ); -# my $isReadyForUse = ReadingsVal( $name, "isReadyForUse", "false" ); -# my $currentTemperature = ReadingsVal( $name, "currentTemperature", "141" ); -# if($currentTemperature eq "0"){ -# $currentTemperature = "141"; -# } -# my $currentHumidity = ReadingsVal( $name, "currentHumidity", "0" ); -# my $statusCode = ReadingsVal( $name, "statusCode", "0" ); -# my $statusMessage = ReadingsVal( $name, "statusMessage", "" ); -# if($statusMessage eq ""){ -# $statusMessage = 'null'; -# } -# my $showBathingHour = ReadingsVal( $name, "showBathingHour", "false" ); -# my $bathingHours = ReadingsVal( $name, "bathingHours", "0" ); -# my $bathingMinutes = ReadingsVal( $name, "bathingMinutes", "0" ); -# my $currentHumidityStatus = ReadingsVal( $name, "currentHumidityStatus", "0" ); -# my $currentTemperatureStatus = ReadingsVal( $name, "currentTemperatureStatus", "0" ); if ( $pin eq "") { my $msg = "Missing attribute: attr $name pin "; @@ -874,6 +852,7 @@ sub Set { $min = substr($min,1,1); } } + $timesel = 1; } if ($std <0 || $std >23 || $min <0 || $min >59){ return "Checken Sie das Zeitformat $std:$min\n"; @@ -976,6 +955,7 @@ sub Set { $min = substr($min,1,1); } } + $timesel = 1; } } if ($std <0 || $std >23 || $min <0 || $min >59){ @@ -1030,135 +1010,19 @@ sub Set { }); } -## elsif ( $mode eq "Infrared" ) { -## -## # Sanarium Modus wechseln -## my $header = "Content-Type: application/json; charset=utf-8\r\n". -## "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36\r\n". -## "Accept: application/json, text/javascript, */*; q=0.01\r\n". -## "Accept-Encoding: gzip, deflate, br\r\n". -## "Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7\r\n". -## "Cookie: $aspxauth"; -## -## my $datauser_mode = '{"id":"'.$saunaid.'","selected_mode":3}'; -## Log3 ($name, 4, "$name - JSON_MODE: $datauser_mode"); -## -## HttpUtils_BlockingGet({ -## url => "https://sauna-app-19.klafs.com/SaunaApp/SetMode", -## timeout => 5, -## hash => $hash, -## method => "POST", -## header => $header, -## data => $datauser_mode, -## }); -## -## -## my $temperature = shift @args; -## if(!looks_like_number($temperature)){ -## return "Geben Sie einen nummerischen Wert fuer ein"; -## } -## if ($temperature >= 20 && $temperature <=40 && $temperature ne ""){ -## $temperature = $temperature; -## }else{ -## # Letzer Wert oder Standardtemperatur -## $temperature = ReadingsVal( $name, "selectedIrTemperature", "" ); -## if ($temperature eq "" || $temperature eq 0){ -## $temperature = 35; -## } -## } -## -## -## -## my $Time; -## my $level; -## $level = shift @args; -## $Time = shift @args; -## -## if(!defined($Time)){ -## $Time ="$Uhrzeit[0]:$Uhrzeit[1]"; -## } -## -## # Parameter level ist optional. Wird in der ersten Variable eine anstelle des Levels eine Uhrzeit gefunden, dann level auf "" setzen und $std,$min setzen -## if($level =~ /:/ || $Time =~ /:/){ -## if($level =~ /:/){ -## my @Timer = split(/:/,$level); -## $std = $Timer[0]; -## $min = $Timer[1]; -## if($std < 10){ -## if(substr($std,0,1) eq "0"){ -## $std = substr($std,1,1); -## } -## } -## if($min < 10){ -## if(substr($min,0,1) eq "0"){ -## $min = substr($min,1,1); -## } -## } -## $level = ""; -## }else{ -## my @Timer = split(/:/,$Time); -## $std = $Timer[0]; -## $min = $Timer[1]; -## if($std < 10){ -## if(substr($std,0,1) eq "0"){ -## $std = substr($std,1,1); -## } -## } -## if($min < 10){ -## if(substr($min,0,1) eq "0"){ -## $min = substr($min,1,1); -## } -## } -## } -## } -## if ($std <0 || $std >23 || $min <0 || $min >59){ -## return "Checken Sie das Zeitformat $std:$min\n"; -## } -## -## if ($level >= 0 && $level <=10 && $level ne "" ){ -## $level = $level; -## }else{ -## # Letzer Wert oder Standardlevel -## $level = ReadingsVal( $name, "selectedIrLevel", "" ); -## if ($level eq ""){ -## $level = 5; -## } -## } -## $datauser_cv = '{"changedData":{"saunaId":"'.$saunaid.'","saunaSelected":false,"sanariumSelected":false,"irSelected":true,"selectedSaunaTemperature":'.$selectedSaunaTemperature.',"selectedSanariumTemperature":'.$selectedSanariumTemperature.',"selectedIrTemperature":'.$temperature.',"selectedHumLevel":'.$selectedHumLevel.',"selectedIrLevel":'.$level.',"selectedHour":'.$std.',"selectedMinute":'.$min.',"isConnected":'.$isConnected.',"isPoweredOn":'.$isPoweredOn.',"isReadyForUse":'.$isReadyForUse.',"currentTemperature":'.$currentTemperature.',"currentHumidity":'.$currentHumidity.',"statusCode":'.$statusCode.',"statusMessage":'.$statusMessage.',"showBathingHour":'.$showBathingHour.',"bathingHours":'.$bathingHours.',"bathingMinutes":'.$bathingMinutes.',"currentHumidityStatus":'.$currentHumidityStatus.',"currentTemperatureStatus":'.$currentTemperatureStatus.'}}'; -## -## }else{ -## $datauser_cv = '{"changedData":{"saunaId":"'.$saunaid.'","saunaSelected":true,"sanariumSelected":false,"irSelected":false,"selectedSaunaTemperature":90,"selectedSanariumTemperature":'.$selectedSanariumTemperature.',"selectedIrTemperature":'.$selectedIrTemperature.',"selectedHumLevel":'.$selectedHumLevel.',"selectedIrLevel":'.$selectedIrLevel.',"selectedHour":'.$std.',"selectedMinute":'.$min.',"isConnected":'.$isConnected.',"isPoweredOn":'.$isPoweredOn.',"isReadyForUse":'.$isReadyForUse.',"currentTemperature":'.$currentTemperature.',"currentHumidity":'.$currentHumidity.',"statusCode":'.$statusCode.',"statusMessage":'.$statusMessage.',"showBathingHour":'.$showBathingHour.',"bathingHours":'.$bathingHours.',"bathingMinutes":'.$bathingMinutes.',"currentHumidityStatus":'.$currentHumidityStatus.',"currentTemperatureStatus":'.$currentTemperatureStatus.'}}'; -## } -## -## Log3 ($name, 4, "$name - JSON ON: $datauser_cv"); -## # 1) Werte aendern -## #print "Mode: ". $mode . " Temperature: ". $temperature . " Level: " .$level ."\n$datauser_cv\n\n"; -## -## my $header_cv = "Content-Type: application/json; charset=utf-8\r\n". -## "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36\r\n". -## "Accept: application/json, text/javascript, */*; q=0.01\r\n". -## "Accept-Encoding: gzip, deflate, br\r\n". -## "Accept-Language: de,en;q=0.7,en-US;q=0.3\r\n". -## "Cookie: $aspxauth"; -## HttpUtils_BlockingGet({ -## url => "https://sauna-app-19.klafs.com/SaunaApp/StartCabin", -## timeout => 5, -## hash => $hash, -## method => "POST", -## header => $header_cv, -## data => $datauser_cv, -## }); - - my $state_onoff = ReadingsVal( $name, "power", "off" ); # Einschalten, wenn Sauna aus ist. -Log3 ($name, 4, "$name - Hier1 : $state_onoff"); - + Log3 ($name, 5, "$name - SaunaState : $state_onoff"); if($state_onoff eq "off"){ # Einschalten - my $datauser_start = '{"id":"'.$saunaid.'","pin":"'.$pin.'","time_selected":false,"sel_hour":'.$std.',"sel_min":'.$min.'}'; -Log3 ($name, 4, "$name - Hier2 : $datauser_start"); + if($timesel eq 1){ + $timeselect = 'true'; + }else{ + $timeselect = 'false'; + } + my $datauser_start = '{"id":"'.$saunaid.'","pin":"'.$pin.'","time_selected":'.$timeselect.',"sel_hour":'.$std.',"sel_min":'.$min.'}'; + Log3 ($name, 5, "$name - Start JSON : $datauser_start"); HttpUtils_NonblockingGet({ url => "https://sauna-app-19.klafs.com/SaunaApp/StartCabin", timeout => 5, @@ -1195,81 +1059,6 @@ Log3 ($name, 4, "$name - Hier2 : $datauser_start"); } } }); - - - -## my $header_af = "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36\r\n". -## "Cookie: $aspxauth"; -## my $datauser_af = "s=$saunaid"; -## # 2 Steps: 2) Antiforgery erzeugen; 3) Einschalten -## HttpUtils_NonblockingGet({ -## url => "https://sauna-app-19.klafs.com/Control/EnterPin", -## timeout => 5, -## hash => $hash, -## method => "POST", -## header => $header_af, -## data => $datauser_af, -## callback=>sub($$$){ -## my ($param, $err, $data) = @_; -## my $hash = $param->{hash}; -## my $name = $hash->{NAME}; -## my $header = $param->{httpheader}; -## Log3 ($name, 5, "header: $header"); -## Log3 ($name, 5, "Data: $data"); -## Log3 ($name, 5, "Error: $err"); -## readingsBeginUpdate ($hash); -## for my $cookie ($header =~ m/set-cookie: ?(.*)/gi) { -## $cookie =~ /([^,; ]+)=([^,;\s\v]+)[;,\s\v]*([^\v]*)/; -## my $antiforgery = $1 . "=" .$2 .";"; -## my $antiforgery_date = strftime("%Y-%m-%d %H:%M:%S", localtime(time())); -## readingsBulkUpdate( $hash, "antiforgery_date", "$antiforgery_date", 1 ); -## Log3 ($name, 5, "$name: Antiforgery found: $antiforgery"); -## $hash->{Klafs}->{antiforgery} = $antiforgery; -## } -## readingsEndUpdate($hash, 1); -## -## # 2) Einschalten -## my $headeron = "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36\r\n". -## "Cookie: $aspxauth"; -## my $antiforgery = $hash->{Klafs}->{antiforgery}; -## my $datauseron = "$antiforgery&Pin=$pin&saunaId=$saunaid"; -## HttpUtils_NonblockingGet({ -## url => "https://sauna-app-19.klafs.com/Control/EnterPin", -## timeout => 5, -## hash => $hash, -## method => "POST", -## header => $headeron, -## data => $datauseron, -## callback => sub($$$){ -## my ($param, $err, $data) = @_; -## my $hash = $param->{hash}; -## my $name = $hash->{NAME}; -## Log3 ($name, 5, "header: $header"); -## Log3 ($name, 5, "Data: $data"); -## Log3 ($name, 5, "Error: $err"); -## if($data=~/
  • /) { -## readingsBeginUpdate ($hash); -## for my $err ($data =~ m /
    • ?(.*)<\/li>/) { -## my %umlaute = ("ä" => "ae", "ü" => "ue", "Ä" => "Ae", "Ö" => "Oe", "ö" => "oe", "Ü" => "Ue", "ß" => "ss"); -## my $umlautkeys = join ("|", keys(%umlaute)); -## $err=~ s/($umlautkeys)/$umlaute{$1}/g; -## Log3 ($name, 1, "Klafs $name: $err"); -## readingsBulkUpdate( $hash, "last_errormsg", "$err", 1 ); -## } -## readingsEndUpdate($hash, 1); -## }else{ -## $power = "on"; -## Log3 ($name, 3, "Sauna on"); -## readingsBeginUpdate ($hash); -## readingsBulkUpdate( $hash, "power", $power, 1 ); -## readingsBulkUpdate( $hash, "last_errormsg", "0", 1 ); -## readingsEndUpdate($hash, 1); -## klafs_getStatus($hash); -## } -## } -## }); -## } -## }); } ## Ende Wenn Sauna aus ist } ## Ende PIN / SAUNAID vorhanden @@ -1463,7 +1252,7 @@ __END__ off - Turns off the sauna|sanarium|infrared - without parameters. + Turns off the sauna|sanarium - without parameters. on @@ -1471,8 +1260,7 @@ __END__ set <name> on without parameters - start with last used values
      set <name> on Sauna 90 - 3 parameters possible: "Sauna" with temperature [10-100]; Optional time [19:30].
      set <name> on Saunarium 65 5 - 4 parameters possible: "Sanarium" with temperature [40-75]; Optional HumidtyLevel [0-10] and time [19:30].
      - set <name> on Infrared 30 5 - 4 parameters possible: "Infrared" with temperature [20-40] and IR Level [0-10]; Optional time [19:30].
      - Infrared works, but is not supported because no test environment is available. + Infrared is not supported because no test environment is available. @@ -1513,7 +1301,7 @@ __END__ Mode - Sauna, Sanarium or Infrared + Sauna, Sanarium LoginFailures @@ -1729,7 +1517,7 @@ __END__ off - Schaltet die Sauna|Sanarium|Infrared aus - ohne Parameter. + Schaltet die Sauna|Sanarium aus - ohne Parameter. on @@ -1737,8 +1525,7 @@ __END__ set <name> on ohne Parameter - Starten mit zuletzt verwendeten Werten
      set <name> on Sauna 90 - 3 Parameter möglich: "Sauna" mit Temperatur [10-100]; Optional Uhrzeit [19:30]
      set <name> on Saunarium 65 5 - 4 Parameter möglich: "Sanarium" mit Temperatur [40-75]; Optional HumidtyLevel [0-10] und Uhrzeit [19:30]
      - set <name> on Infrared 30 5 - 4 Parameter möglich: "Infrarot" mit Temperatur [20-40] und IR Level [0-10]; Optional Uhrzeit [19:30]
      - Infrarot funktioniert, ist aber nicht supported, da keine Testumgebung verfügbar. + Infrarot ist aber nicht supported, da keine Testumgebung verfügbar. @@ -1779,7 +1566,7 @@ __END__ Mode - Sauna, Sanarium oder Infrared + Sauna oder Sauna LoginFailures diff --git a/diff_api.txt b/diff_api.txt new file mode 100644 index 0000000..75a7ba6 --- /dev/null +++ b/diff_api.txt @@ -0,0 +1,818 @@ +Index: FHEM/70_Klafs.pm +=================================================================== +--- FHEM/70_Klafs.pm (Revision 28300) ++++ FHEM/70_Klafs.pm (Arbeitskopie) +@@ -69,6 +69,7 @@ + ReadingsVal + HttpUtils_NonblockingGet + HttpUtils_BlockingGet ++ readingsDelete + )) + }; + +@@ -253,13 +254,16 @@ + my $reconnect = time() + 300; + $hash->{Klafs}->{reconnect} = $reconnect; + my $header = "Content-Type: application/x-www-form-urlencoded\r\n". +- "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.71 Safari/537.36"; +- my $datauser = "UserName=$username&Password=$password"; ++ "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36\r\n". ++ "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7r\n". ++ "Accept-Encoding: gzip, deflate, br\r\n". ++ "Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7"; ++ my $datauser = "UserName=$username&Password=$password&RememberMe=false"; + + if ($hash->{Klafs}->{LoginFailures} eq "0"){ + + HttpUtils_NonblockingGet({ +- url => "https://sauna-app.klafs.com/Account/Login", ++ url => "https://sauna-app-19.klafs.com/Account/Login", + ignoreredirects => 1, + timeout => 5, + hash => $hash, +@@ -300,7 +304,7 @@ + }else{ + readingsBulkUpdate( $hash, 'LoginFailures', 0, 0); + $hash->{Klafs}->{LoginFailures} =0; +- for my $cookie ($header =~ m/set-cookie: ?(.*)/gi) { ++ for my $cookie ($header =~ m/Set-Cookie: ?(.*)/gi) { + $cookie =~ /([^,; ]+)=([^,;\s\v]+)[;,\s\v]*([^\v]*)/; + my $aspxauth = $1 . "=" .$2 .";"; + $hash->{Klafs}->{cookie} = $aspxauth; +@@ -347,28 +351,36 @@ + my $aspxauth = $hash->{Klafs}->{cookie}; + my $saunaid = $hash->{Klafs}->{saunaid}; + +- my $header_gs = "Content-Type: application/json\r\n". +- "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.71 Safari/537.36\r\n". ++ my $header_gs = "Content-Type: application/json; charset=utf-8\r\n". ++ "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36\r\n". ++ "Accept: text/plain, */*; q=0.01r\n". ++ "Accept-Encoding: gzip, deflate, br\r\n". ++ "Accept-Language: de,en;q=0.7,en-US;q=0.3\r\n". + "Cookie: $aspxauth"; + my $datauser_gs = '{"saunaId":"'.$saunaid.'"}'; + + HttpUtils_NonblockingGet({ +- url => "https://sauna-app.klafs.com/Control/GetSaunaStatus", ++ url => "https://sauna-app-19.klafs.com/SaunaApp/GetData?id=$saunaid", + timeout => 5, + hash => $hash, +- method => "POST", ++ method => "GET", + header => $header_gs, +- data => $datauser_gs, ++ data => $datauser_gs, + callback => \&klafs_getStatusResponse, + }); + + #Name Vorname Mail Benutzername + #GET Anfrage mit ASPXAUTH +- my $header_user = "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.71 Safari/537.36\r\n". ++ my $header_user = "Content-Type: application/json; charset=utf-8\r\n". ++ "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36\r\n". ++ "Accept: text/plain, */*; q=0.01r\n". ++ "Accept-Encoding: gzip, deflate, br\r\n". ++ "Accept-Language: de,en;q=0.7,en-US;q=0.3\r\n". + "Cookie: $aspxauth"; + ++ + HttpUtils_NonblockingGet({ +- url => "https://sauna-app.klafs.com/Account/ChangeProfile", ++ url => "https://sauna-app-19.klafs.com/Account/ChangeProfile", + timeout => 5, + hash => $hash, + method => "GET", +@@ -376,11 +388,15 @@ + callback => \&Klafs_GETProfile, + }); + +- my $header_set = "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.71 Safari/537.36\r\n". +- "Cookie: $aspxauth"; ++ my $header_set = "Content-Type: application/json; charset=utf-8\r\n". ++ "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36\r\n". ++ "Accept: text/plain, */*; q=0.01r\n". ++ "Accept-Encoding: gzip, deflate, br\r\n". ++ "Accept-Language: de,en;q=0.7,en-US;q=0.3\r\n". ++ "Cookie: $aspxauth"; + + HttpUtils_NonblockingGet({ +- url => "https://sauna-app.klafs.com/Control/ChangeSettings", ++ url => "https://sauna-app-19.klafs.com/SaunaApp/ChangeSettings", + timeout => 5, + hash => $hash, + method => "GET", +@@ -444,6 +460,8 @@ + readingsBulkUpdate($hash, $key, $new); + } + } ++ ## unset ErrorMessageHeader. Dort steht "Fehler" drin. Wert wird mitgeliefert auch wenn ErrorMessage leer ist. Bei Fehler wird Reading last_errormsg gesetzt ++ readingsDelete($hash, "ErrorMessageHeader"); + + Klafs_CONNECTED($hash,'connected'); + readingsEndUpdate($hash, 1); +@@ -469,8 +487,8 @@ + # Wenn in $data eine Anmeldung verlangt wird und kein json kommt, darf es nicht weitergehen. + # Connect darf es hier nicht geben. Das darf nur an einer Stelle kommen. Sonst macht perl mehrere connects gleichzeitig- bei 3 Fehlversuchen wäre der Account gesperrt + readingsBeginUpdate ($hash); +- if($data=~/ Default Sauna 90 Grad | ++|on | ohne Parameter -> Starten mit zuletzt verwendeten Werten | + | | set "name" on Sauna 90 - 3 Parameter: Sauna mit Temperatur [10-100]; Optional Uhrzeit [19:30] | + | | set "name" on Saunarium 65 5 - 4 Parameter: Sanarium mit Temperatur [40-75]; Optional HumidtyLevel [0-10] und Uhrzeit [19:30] | +-| | set "name" on Infrared 30 5 - 4 Parameter: Infrarot mit Temperatur [20-40] und IR Level [0-10]; Optional Uhrzeit [19:30] | + | | Infrarot ist nicht supported, da keine Testumgebung verfuegbar. | + ------------------------------------------------------------------------------------------------------------------------------------------------------------ +-|off | Schaltet die Sauna|Sanarium|Infrarot aus - ohne Parameter. | ++|off | Schaltet die Sauna|Sanarium aus - ohne Parameter. | + ------------------------------------------------------------------------------------------------------------------------------------------------------------ + |ResetLoginFailures | Bei fehlerhaftem Login wird das Reading LoginFailures auf 1 gesetzt. Damit ist der automatische Login vom diesem Modul gesperrt. | + | | Klafs sperrt den Account nach 3 Fehlversuchen. Damit nicht automatisch 3 falsche Logins hintereinander gemacht werden. | +@@ -620,12 +637,15 @@ + my ($name,$self) = ($hash->{NAME},Klafs_Whoami()); + my $aspxauth = $hash->{Klafs}->{cookie}; + return if $hash->{Klafs}->{LoginFailures} > 0; +- Log3 ($name, 5, "$name ($self) - executed."); ++ Log3 ($name, 5, "$name ($self) - GetSauna ID start."); + +- my $header = "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.71 Safari/537.36\r\n". +- "Cookie: $aspxauth"; ++ my $header = "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36\r\n". ++ "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7\r\n". ++ "Accept-Encoding: gzip, deflate, br\r\n". ++ "Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7\r\n". ++ "Cookie: $aspxauth"; + HttpUtils_NonblockingGet({ +- url => "http://sauna-app.klafs.com/Control", ++ url => "https://sauna-app-19.klafs.com/SaunaApp/ChangeSettings", + timeout => 5, + hash => $hash, + method => "GET", +@@ -638,9 +658,10 @@ + sub Klafs_GetSaunaIDs_Receive { + my ($param, $err, $data) = @_; + my ($name,$self,$hash) = ($param->{hash}->{NAME},Klafs_Whoami(),$param->{hash}); +- my $returnwerte; ++ my $returnwert1; ++ my $returnwert2; + +- Log3 ($name, 5, "$name ($self) - executed."); ++ Log3 ($name, 5, "$name ($self) - GetSauna ID Ende."); + + if ($err ne "") { + Log3 ($name, 4, "$name ($self) - error."); +@@ -650,15 +671,16 @@ + if($data !~/Account\/Login/) { + # Wenn in $data eine Anmeldung verlangt wird und keine Daten, darf es nicht weitergehen. + # Connect darf es hier nicht geben. Das darf nur an einer Stelle kommen. Sonst macht perl mehrere connects gleichzeitig - bei 3 Fehlversuchen wäre der Account gesperrt +- $returnwerte = ""; +- if($data=~//) { +- for my $output ($data =~ m /(.*?)<\/tr>/gis) { +- $output=~ m/(.*?)<\/span>/g; +- $returnwerte .= $1.": "; +- $output=~ m/
      /) { ++ for my $output ($data =~ m /(.*?)<\/tr>/gis) { ++ $output=~ m/