2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

76_SMAPortal: new attribute noHomeManager

git-svn-id: https://svn.fhem.de/fhem/trunk@22332 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2020-07-02 20:47:30 +00:00
parent 030d4936f2
commit 0d8e0edfe4
2 changed files with 67 additions and 33 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # 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. # Do not insert empty lines here, update check depends on it.
- feature: 76_SMAPortal: new attribute noHomeManager
- bugfix: 70_BRAVIA: check available service APIs if available only - bugfix: 70_BRAVIA: check available service APIs if available only
- change: 49_SSCam / 49_SSCamSTRM: switch to packages, changes according PBP - change: 49_SSCam / 49_SSCamSTRM: switch to packages, changes according PBP
- bugfix: 73_AutoShuttersControl: fix commandref and bug in shading function - bugfix: 73_AutoShuttersControl: fix commandref and bug in shading function

View File

@ -136,6 +136,7 @@ BEGIN {
# Versions History intern # Versions History intern
my %vNotesIntern = ( my %vNotesIntern = (
"3.3.0" => "02.07.2020 fix typo, new attribute noHomeManager ",
"3.2.0" => "30.06.2020 add data provider balanceCurrentData (experimental), balanceMonthData, balanceYearData ", "3.2.0" => "30.06.2020 add data provider balanceCurrentData (experimental), balanceMonthData, balanceYearData ",
"3.1.2" => "25.06.2020 don't delete cookie after every data retrieval, change login management ", "3.1.2" => "25.06.2020 don't delete cookie after every data retrieval, change login management ",
"3.1.1" => "24.06.2020 change german Error regex, get plantOid from cookie if not in JSON ", "3.1.1" => "24.06.2020 change german Error regex, get plantOid from cookie if not in JSON ",
@ -223,23 +224,24 @@ my %statkeys = ( # Statistikdaten auszulesende Schlüs
AutarkyRate => 1, AutarkyRate => 1,
); );
my %subs; # Arbeitskopie von %stpl my %mandatory; # Arbeitskopie von %stpl -> abzurufenden Datenprovider Stammdaten nach Login
my %stpl = ( # Ausgangstemplate Subfunktionen der Datenprovider my %subs; # Arbeitskopie von %stpl -> Festlegung abzurufenden Datenprovider
consumerMasterdata => { doit => 1, level => 'L00', func => '_getConsumerMasterdata' }, # mandatory my %stpl = ( # Ausgangstemplate Subfunktionen der Datenprovider
plantMasterData => { doit => 1, level => 'L00', func => '_getPlantMasterData' }, # mandatory consumerMasterdata => { doit => 1, nohm => 1, level => 'L00', func => '_getConsumerMasterdata' }, # mandatory (außer wenn kein SMA Home Manager vorhanden)
liveData => { doit => 0, level => 'L01', func => '_getLiveData' }, plantMasterData => { doit => 1, nohm => 1, level => 'L00', func => '_getPlantMasterData' }, # mandatory (außer wenn kein SMA Home Manager vorhanden)
weatherData => { doit => 0, level => 'L02', func => '_getWeatherData' }, liveData => { doit => 0, nohm => 0, level => 'L01', func => '_getLiveData' },
forecastData => { doit => 0, level => 'L04', func => '_getForecastData' }, weatherData => { doit => 0, nohm => 0, level => 'L02', func => '_getWeatherData' },
consumerCurrentdata => { doit => 0, level => 'L05', func => '_getConsumerCurrData' }, forecastData => { doit => 0, nohm => 1, level => 'L04', func => '_getForecastData' },
consumerDayData => { doit => 0, level => 'L06', func => '_getConsumerDayData' }, consumerCurrentdata => { doit => 0, nohm => 1, level => 'L05', func => '_getConsumerCurrData' },
consumerMonthData => { doit => 0, level => 'L07', func => '_getConsumerMonthData' }, consumerDayData => { doit => 0, nohm => 1, level => 'L06', func => '_getConsumerDayData' },
consumerYearData => { doit => 0, level => 'L08', func => '_getConsumerYearData' }, consumerMonthData => { doit => 0, nohm => 1, level => 'L07', func => '_getConsumerMonthData' },
plantLogbook => { doit => 0, level => 'L09', func => '_getPlantLogbook' }, consumerYearData => { doit => 0, nohm => 1, level => 'L08', func => '_getConsumerYearData' },
balanceCurrentData => { doit => 0, level => 'L10', func => '_getBalanceCurrentData' }, plantLogbook => { doit => 0, nohm => 0, level => 'L09', func => '_getPlantLogbook' },
balanceDayData => { doit => 0, level => 'L11', func => '_getBalanceDayData' }, balanceCurrentData => { doit => 0, nohm => 0, level => 'L10', func => '_getBalanceCurrentData' },
balanceMonthData => { doit => 0, level => 'L12', func => '_getBalanceMonthData' }, balanceDayData => { doit => 0, nohm => 0, level => 'L11', func => '_getBalanceDayData' },
balanceYearData => { doit => 0, level => 'L13', func => '_getBalanceYearData' }, balanceMonthData => { doit => 0, nohm => 0, level => 'L12', func => '_getBalanceMonthData' },
balanceTotalData => { doit => 0, level => 'L14', func => '_getBalanceTotalData' }, balanceYearData => { doit => 0, nohm => 0, level => 'L13', func => '_getBalanceYearData' },
balanceTotalData => { doit => 0, nohm => 0, level => 'L14', func => '_getBalanceTotalData' },
); );
# Tags der verfügbaren Datenquellen # Tags der verfügbaren Datenquellen
my @pd = qw( plantMasterData my @pd = qw( plantMasterData
@ -283,6 +285,7 @@ sub Initialize {
$hash->{AttrList} = "cookieLocation ". $hash->{AttrList} = "cookieLocation ".
"disable:0,1 ". "disable:0,1 ".
"interval ". "interval ".
"noHomeManager:1,0 ".
"plantLogbookTypes:multiple-strict,Info,Warning,Disturbance,Error ". "plantLogbookTypes:multiple-strict,Info,Warning,Disturbance,Error ".
"plantLogbookApprovalState:Any,NotApproved ". "plantLogbookApprovalState:Any,NotApproved ".
"providerLevel:multiple-strict,".$prov." ". "providerLevel:multiple-strict,".$prov." ".
@ -732,11 +735,17 @@ sub CallInfo {
return if(IsDisabled($name)); return if(IsDisabled($name));
for my $key (keys %stpl) { # festlegen welche Daten geliefert werden sollen for my $key (keys %stpl) { # festlegen welche Daten geliefert werden sollen
next if($stpl{$key}{doit}); # die default Provider nicht noch einmal ausführen if($stpl{$key}{doit}) { # Datenprovider nach Login ausführen (mandatories)
$mandatory{$name}{$key}{doit} = $stpl{$key}{doit};
$mandatory{$name}{$key}{level} = $stpl{$key}{level};
$mandatory{$name}{$key}{func} = $stpl{$key}{func};
next;
}
$subs{$name}{$key}{doit} = $stpl{$key}{doit}; $subs{$name}{$key}{doit} = $stpl{$key}{doit};
$subs{$name}{$key}{level} = $stpl{$key}{level}; $subs{$name}{$key}{level} = $stpl{$key}{level};
$subs{$name}{$key}{func} = $stpl{$key}{func}; $subs{$name}{$key}{func} = $stpl{$key}{func};
} }
my @pl = split ",", AttrVal($name, "providerLevel", ""); my @pl = split ",", AttrVal($name, "providerLevel", "");
for my $p (@pl) { for my $p (@pl) {
$subs{$name}{$p}{doit} = 1; $subs{$name}{$p}{doit} = 1;
@ -759,6 +768,16 @@ sub CallInfo {
Log3 ($name, 4, "$name - calculated timeout: $timeout"); Log3 ($name, 4, "$name - calculated timeout: $timeout");
} }
if(AttrVal($name, "noHomeManager", 0)) { # wenn kein Home Manager installiert ist keine mandatories ausführen
%mandatory = ();
for my $k (keys %stpl) {
if($stpl{$k}{nohm}) {
$subs{$name}{$k}{doit} = 0;
Log3 ($name, 3, qq{$name - ignore provider "$k" - SMA Home Manager is not installed}) if(!$nc && !$nr);
}
}
}
if(!$nc) { if(!$nc) {
$hash->{HELPER}{ACTCYCLE} = 1; $hash->{HELPER}{ACTCYCLE} = 1;
$hash->{HELPER}{CYCLEBTIME} = (gettimeofday())[0]; $hash->{HELPER}{CYCLEBTIME} = (gettimeofday())[0];
@ -876,7 +895,7 @@ sub GetSetData { ## no cri
### Login ### Login
############## ##############
my $paref = [ $name, $ua, $state, $errstate ]; my $paref = [ $name, $ua, $state, $errstate ];
($state, $errstate) = _doLogin ($paref); ($state, $errstate) = _doLogin ($paref);
if($errstate) { if($errstate) {
@ -884,16 +903,17 @@ sub GetSetData { ## no cri
return "$name|0|0|$errstate|$getp|$setp|$st"; return "$name|0|0|$errstate|$getp|$setp|$st";
} }
### die Anlagen Asset Daten auslesen (Funktionen in Template %stpl default doit=1) ### die Anlagen Asset Daten auslesen (Funktionen aus %mandatory mit doit=1)
### (Hash %mandatory ist leer wenn kein SMA Home Manager eingesetzt)
################################################################################## ##################################################################################
for my $k (keys %stpl) { for my $k (keys %{$mandatory{$name}}) {
next if(!$stpl{$k}{doit}); next if(!$mandatory{$name}{$k}{doit});
no strict "refs"; ## no critic 'NoStrict' no strict "refs"; ## no critic 'NoStrict'
($errstate,$state,$reread,$retry) = &{$stpl{$k}{func}} ({ name => $name, ($errstate,$state,$reread,$retry) = &{$mandatory{$name}{$k}{func}} ({ name => $name,
ua => $ua, ua => $ua,
state => $state, state => $state,
daref => \@da daref => \@da
}); });
use strict "refs"; use strict "refs";
if($errstate) { if($errstate) {
@ -3000,7 +3020,7 @@ sub PortalAsHtml {
} elsif (!defined $pv0) { } elsif (!defined $pv0) {
$ret .= "Awaiting minor level forecast data ..."; $ret .= "Awaiting minor level forecast data ...";
} elsif (!defined $pv1) { } elsif (!defined $pv1) {
$ret .= "Awaiting level major level forecast data ..."; $ret .= "Awaiting major level forecast data ...";
} }
$ret .= "</td>"; $ret .= "</td>";
@ -3842,7 +3862,8 @@ return;
After a successful login, only the asset master data are retrieved. After a successful login, only the asset master data are retrieved.
The attribute <a href="#providerLevel">providerLevel</a> is used to set the data suppliers its data The attribute <a href="#providerLevel">providerLevel</a> is used to set the data suppliers its data
the device should retrieve. the device should retrieve. If no Sunny Home Manager is installed, the attribute
<a href="#noHomeManager">noHomeManager</a> must be set.
</ul> </ul>
<br><br> <br><br>
@ -3926,7 +3947,7 @@ return;
Time interval for continuous data retrieval from the aus dem SMA Sunny Portal (default: 300 seconds). <br> Time interval for continuous data retrieval from the aus dem SMA Sunny Portal (default: 300 seconds). <br>
if the interval is set to "0", no continuous data retrieval is executed and has to be triggered manually by the if the interval is set to "0", no continuous data retrieval is executed and has to be triggered manually by the
"get &lt;name&gt; data" command. <br><br> "get &lt;name&gt; data" command. <br><br>
<ul> <ul>
<b>Note:</b> <b>Note:</b>
The retrieval interval should not be less than 120 seconds. As of previous experiences SMA suffers an interval of The retrieval interval should not be less than 120 seconds. As of previous experiences SMA suffers an interval of
@ -3934,6 +3955,11 @@ return;
</ul> </ul>
</li><br> </li><br>
<a name="noHomeManager"></a>
<li><b>noHomeManager</b><br>
Must be set if no Sunny Home Manager is installed.
</li><br>
<a name="plantLogbookApprovalState"></a> <a name="plantLogbookApprovalState"></a>
<li><b>plantLogbookApprovalState</b><br> <li><b>plantLogbookApprovalState</b><br>
With this attribute the entries are filtered according to their status. <br> With this attribute the entries are filtered according to their status. <br>
@ -4084,7 +4110,8 @@ return;
Nach einem erfolgreichen Login werden nur die Anlagenstammdaten abgerufen. Nach einem erfolgreichen Login werden nur die Anlagenstammdaten abgerufen.
Mit dem Attribut <a href="#providerLevel">providerLevel</a> werden die Datenlieferanten eingestellt, die durch das Mit dem Attribut <a href="#providerLevel">providerLevel</a> werden die Datenlieferanten eingestellt, die durch das
Device abgerufen werden sollen. Device abgerufen werden sollen. Ist kein Sunny Home Manager installiert, muss das Attribut
<a href="#noHomeManager">noHomeManager</a> gesetzt werden.
</ul> </ul>
<br><br> <br><br>
@ -4166,7 +4193,8 @@ return;
<a name="disable"></a> <a name="disable"></a>
<li><b>disable</b><br> <li><b>disable</b><br>
Deaktiviert das Device. </li><br> Deaktiviert das Device.
</li><br>
<a name="interval"></a> <a name="interval"></a>
<li><b>interval &lt;Sekunden&gt; </b><br> <li><b>interval &lt;Sekunden&gt; </b><br>
@ -4181,6 +4209,11 @@ return;
</ul> </ul>
</li><br> </li><br>
<a name="noHomeManager"></a>
<li><b>noHomeManager</b><br>
Muss gesetzt werden wenn kein Sunny Home Manager installiert ist.
</li><br>
<a name="plantLogbookApprovalState"></a> <a name="plantLogbookApprovalState"></a>
<li><b>plantLogbookApprovalState</b><br> <li><b>plantLogbookApprovalState</b><br>
Mit diesem Attribut werden die Einträge entsprechend ihres Status gefiltert. <br> Mit diesem Attribut werden die Einträge entsprechend ihres Status gefiltert. <br>