mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-24 15:19:21 +00:00
76_SMAPortal: contrib 2.7.2
git-svn-id: https://svn.fhem.de/fhem/trunk@22053 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
6b8982deba
commit
b721c60601
@ -134,6 +134,7 @@ BEGIN {
|
|||||||
|
|
||||||
# Versions History intern
|
# Versions History intern
|
||||||
my %vNotesIntern = (
|
my %vNotesIntern = (
|
||||||
|
"2.7.2" => "28.05.2020 delete cookie file if max read retries reached ",
|
||||||
"2.7.1" => "28.05.2020 change cookie default location to ./log/<name>_cookie.txt ",
|
"2.7.1" => "28.05.2020 change cookie default location to ./log/<name>_cookie.txt ",
|
||||||
"2.7.0" => "27.05.2020 improve stability of data retrieval, new command delCookieFile, new readings dailyCallCounter and dailyIssueCookieCounter ".
|
"2.7.0" => "27.05.2020 improve stability of data retrieval, new command delCookieFile, new readings dailyCallCounter and dailyIssueCookieCounter ".
|
||||||
"current PV generation and consumption available in SMA graphics, some more improvements ",
|
"current PV generation and consumption available in SMA graphics, some more improvements ",
|
||||||
@ -748,9 +749,16 @@ sub GetSetData { ## no cri
|
|||||||
$id = $hash->{HELPER}{CONSUMER}{$key}{SUSyID};
|
$id = $hash->{HELPER}{CONSUMER}{$key}{SUSyID};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
my $plantOid = $hash->{HELPER}{PLANTOID};
|
my $plantOid = $hash->{HELPER}{PLANTOID};
|
||||||
my $res = $ua->post('https://www.sunnyportal.com/Homan/ConsumerBalance/SetOperatingMode', {'mode' => $op, 'serialNumber' => $serial, 'SUSyID' => $id, 'plantOid' => $plantOid} );
|
my $res = $ua->post('https://www.sunnyportal.com/Homan/ConsumerBalance/SetOperatingMode', {
|
||||||
$res = $res->decoded_content();
|
'mode' => $op,
|
||||||
|
'serialNumber' => $serial,
|
||||||
|
'SUSyID' => $id,
|
||||||
|
'plantOid' => $plantOid
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$res = $res->decoded_content();
|
||||||
Log3 ($name, 3, "$name - Set \"$d $op\" result: ".$res);
|
Log3 ($name, 3, "$name - Set \"$d $op\" result: ".$res);
|
||||||
if($res eq "true") {
|
if($res eq "true") {
|
||||||
$state = "ok - switched consumer $d to $op";
|
$state = "ok - switched consumer $d to $op";
|
||||||
@ -950,22 +958,27 @@ sub ParseData { ## no critic
|
|||||||
$ccyeardata_content = decode_json($cy) if($cy);
|
$ccyeardata_content = decode_json($cy) if($cy);
|
||||||
|
|
||||||
my $timeout = AttrVal($name, "timeout", 30);
|
my $timeout = AttrVal($name, "timeout", 30);
|
||||||
if($reread) {
|
if($reread) { # login war erfolgreich, aber set/get muss jetzt noch ausgeführt werden
|
||||||
# login war erfolgreich, aber set/get muss jetzt noch ausgeführt werden
|
|
||||||
delete($hash->{HELPER}{RUNNING_PID});
|
delete($hash->{HELPER}{RUNNING_PID});
|
||||||
readingsSingleUpdate($hash, "L1_Login-Status", "successful", 1);
|
readingsSingleUpdate($hash, "L1_Login-Status", "successful", 1);
|
||||||
$hash->{HELPER}{RUNNING_PID} = BlockingCall("FHEM::SMAPortal::GetSetData", "$name|$getp|$setp", "FHEM::SMAPortal::ParseData", $timeout, "FHEM::SMAPortal::ParseAborted", $hash);
|
$hash->{HELPER}{RUNNING_PID} = BlockingCall("FHEM::SMAPortal::GetSetData", "$name|$getp|$setp", "FHEM::SMAPortal::ParseData", $timeout, "FHEM::SMAPortal::ParseAborted", $hash);
|
||||||
$hash->{HELPER}{RUNNING_PID}{loglevel} = 5 if($hash->{HELPER}{RUNNING_PID}); # Forum #77057
|
$hash->{HELPER}{RUNNING_PID}{loglevel} = 5 if($hash->{HELPER}{RUNNING_PID}); # Forum #77057
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if($retry && $hash->{HELPER}{RETRIES}) {
|
|
||||||
# Livedaten konnte nicht gelesen werden, neuer Versuch zeitverzögert
|
if($retry && $hash->{HELPER}{RETRIES}) { # Livedaten konnten nicht gelesen werden, neuer Versuch zeitverzögert
|
||||||
delete($hash->{HELPER}{RUNNING_PID});
|
delete($hash->{HELPER}{RUNNING_PID});
|
||||||
$hash->{HELPER}{RETRIES} -= 1;
|
$hash->{HELPER}{RETRIES} -= 1;
|
||||||
InternalTimer(gettimeofday()+3, "FHEM::SMAPortal::retrygetdata", $hash, 0);
|
InternalTimer(gettimeofday()+3, "FHEM::SMAPortal::retrygetdata", $hash, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($retry && !$hash->{HELPER}{RETRIES}) { # Livedaten konnten nicht gelesen werden, max. Versuche erreicht -> Cookie File löschen
|
||||||
|
delete($hash->{HELPER}{RUNNING_PID});
|
||||||
|
delcookiefile ($hash, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
my $dl = AttrVal($name, "detailLevel", 1);
|
my $dl = AttrVal($name, "detailLevel", 1);
|
||||||
delread($hash, $dl+1);
|
delread($hash, $dl+1);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user