2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-09 14:47:00 +00:00

76_SMAPortal: get plantOid from cookie if not in JSON

git-svn-id: https://svn.fhem.de/fhem/trunk@22255 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2020-06-24 17:12:14 +00:00
parent 1bf26a94a0
commit e8db5ece40
2 changed files with 13 additions and 3 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- changed: 76_SMAPortal: get plantOid from cookie if not in JSON
- bugfix: 70_ZoneMinder: fix afterInitialized (thx GeberNehmer)
- bugfix: 73_AutoShuttersControl: change shading reading message
- feature: 76_SMAPortal: upgrade to V3. This version is not compatible to

View File

@ -136,6 +136,7 @@ BEGIN {
# Versions History intern
my %vNotesIntern = (
"3.1.1" => "24.06.2020 change german Error regex, get plantOid from cookie if not in JSON ",
"3.1.0" => "20.06.2020 language of SMA Portal messages depend on global language attribute, avoid order problems by ".
"executing retrieve master data firstly every time",
"3.0.0" => "18.06.2020 refactored readings and subroutines, detailLevel deleted, new attr providerLevel, integrate logbook data ",
@ -1501,7 +1502,7 @@ sub __dispatchGet {
my @func = @$fnref;
no strict "refs"; ## no critic 'NoStrict'
for my $fn (@func) {
&{$fn} ($hash,$daref,$data_cont,$fnaddon);
&{$fn} ($hash,$daref,$data_cont,$fnaddon,$data);
}
use strict "refs";
}
@ -1658,7 +1659,7 @@ sub ___analyzeData { ## no critic 'complexity'
my $wm2e = qq{The current consumption could not be determined. The current purchased electricity is unknown};
my $wm2d = qq{Der aktuelle Verbrauch konnte nicht ermittelt werden. Der aktuelle Netzbezug ist unbekannt};
my $em1e = qq{Communication with the Sunny Home Manager is currently not possible};
my $em1d = qq{Kommunikation mit dem Sunny Home Manager derzeit nicht m};
my $em1d = qq{Die Kommunikation mit dem Sunny Home Manager ist zurzeit nicht m};
my $em2e = qq{The current data cannot be retrieved from the PV system. Check the cabling and configuration};
my $em2d = qq{Die aktuellen Daten .*? nicht von der Anlage abgerufen werden.*? Sie die Verkabelung und Konfiguration};
@ -2184,6 +2185,8 @@ sub extractPlantMasterData {
my $hash = shift;
my $daref = shift;
my $forecast = shift;
my $addon = shift;
my $data = shift; # gelieferte Rohdaten
my $name = $hash->{NAME};
my ($amount,$unit);
@ -2193,7 +2196,13 @@ sub extractPlantMasterData {
return;
};
my $lv = $stpl{plantMasterData}{level};
my $plantOid = $forecast->{'ForecastTimeframes'}->{'PlantOid'};
my $plantOid = $forecast->{'ForecastTimeframes'}->{'PlantOid'}; # Plant ID aus JSON filtern
if(!$plantOid) { # Plant ID aus Cookie Header extrhieren wenn nicht mi JSON geliefert (kommt vor)
Log3 ($name, 4, "$name - Plant ID not set in data, get it from cookie ...");
my $sc = $data->header('Set-Cookie') // "";
($plantOid) = $sc =~ /plantOid=([0-9a-z-]*);/x;
}
if ($plantOid) { # wichtig für erweiterte Selektionen
Log3 ($name, 4, "$name - Plant ID: ".$plantOid);