diff --git a/fhem/contrib/DS_Starter/76_SMAPortal.pm b/fhem/contrib/DS_Starter/76_SMAPortal.pm
index d1dde8801..fa3ea3c7d 100644
--- a/fhem/contrib/DS_Starter/76_SMAPortal.pm
+++ b/fhem/contrib/DS_Starter/76_SMAPortal.pm
@@ -161,7 +161,7 @@ use vars qw($FW_ME); # webname (default is fh
# Versions History intern
our %vNotesIntern = (
- "2.3.6" => "20.06.2019 BatteryDischarging, BatteryCharging summary of daily measurement",
+ "2.3.6" => "21.06.2019 revise commandref ",
"2.3.5" => "20.06.2019 subroutine consinject added to pv, pvco style ",
"2.3.4" => "19.06.2019 change some readingnames, delete L4_plantOid, next04hours_state ",
"2.3.3" => "16.06.2019 change verbose 4 output, fix warning if no weather info was got ",
@@ -1549,17 +1549,6 @@ sub extractConsumerHistData($$$) {
Log3 ($name, 4, "$name - ##### extracting consumer history data #### ");
my $bataval = (defined(ReadingsNum($name,"L1_BatteryIn", undef)) || defined(ReadingsNum($name,"L1_BatteryOut", undef)))?1:0; # Identifikation ist Battery vorhanden ?
-
- if($tf =~ /day/) {
- ($bdcd,$bcd) = (0,0);
- foreach my $di (@{$chdata->{'BatteryDischarging'}}) {
- $bdcd += $di->{'Measurement'}/4; # aufsummierte Batterieentladung pro Zeiteinheit (day) in Wh
- }
-
- foreach my $ch (@{$chdata->{'BatteryCharging'}}) {
- $bcd += $ch->{'Measurement'}/4; # aufsummierte Batterieladung pro Zeiteinheit (day) in Wh
- }
- }
readingsBeginUpdate($hash);
@@ -1603,10 +1592,7 @@ sub extractConsumerHistData($$$) {
$i++;
}
-
- readingsBulkUpdate($hash, "L3_BatteryDischargingDay", sprintf("%.0f", $bdcd) ." Wh") if(defined($bdcd) && $bataval && $tf eq "day");
- readingsBulkUpdate($hash, "L3_BatteryChargingDay", sprintf("%.0f", $bcd) ." Wh") if(defined($bcd) && $bataval && $tf eq "day");
-
+
readingsEndUpdate($hash, 1);
return;
@@ -2606,11 +2592,201 @@ return;
SMAPortal
-
-
+
+ With this module it is possible to fetch data from the SMA Sunny Portal and switch
+ consumers (e.g. bluetooth plug sockets) if any are present.
+ At the momentent that are the following data:
+
+
+ - Live data (Consumption and PV-Generation)
+ - Battery data (In/Out) and usage data of consumers
+ - Weather data delivered from SMA for the facility location
+ - Forecast data (Consumption and PV-Generation) inclusive suggestion times to switch comsumers on
+ - the planned times by the Sunny Home Manager to switch consumers on and the current state of consumers (if present)
+
+
+
+
+ Preparation
+
+
+ This module use the Perl module JSON which has typically to be installed discrete.
+ On Debian linux based systems that can be done by command:
+
+ sudo apt-get install libjson-perl
+
+ Subsequent there are an overview of used Perl modules:
+
+ POSIX
+ JSON
+ Data::Dumper
+ Time::HiRes
+ Time::Local
+ Blocking (FHEM-Modul)
+ GPUtils (FHEM-Modul)
+ FHEM::Meta (FHEM-Modul)
+ LWP::UserAgent
+ HTTP::Cookies
+ MIME::Base64
+ Encode
+
+
+
- Is coming soon ...
+
+ Definition
+
+
+ A SMAPortal device will be defined by:
+
+
+ define <name> SMAPortal
+
+
+ After the definition of the device the credentials for the SMA Sunny Portal must be saved with the
+ following command:
+
+
+ set <name> credentials <Username> <Password>
+
+
+
+
+
+ Set
+
+
+
+ - set <name> createPortalGraphic <Generation | Consumption | Generation_Consumption | Differential>
+ Creates graphical devices to show the SMA Sunny Portal forecast data in several layouts.
+ The attribute "detailLevel" has to be set to level 4. The command set this attribut to the needed value automatically.
+ With the "attributes of the graphic device" the appearance and coloration of the forecast
+ data in the created graphic device can be adjusted.
+
+
+
+
+ - set <name> credentials <username> <password>
+ Set Username / Password used for the login into the SMA Sunny Portal.
+
+
+
+
+ - set <name> <consumer name> <on | off | auto>
+ If the attribute "detailLevel" is set to 3 or higher, consumer data are fetched from the SMA Sunny Portal.
+ Once these data are available, the consumer are shown in the Set and can be switched to on, off or the automatic mode (auto)
+ that means the consumer are controlled by the Sunny Home Manager.
+
+
+
+
+
+
+ Get
+
+
+
+ - get <name> data
+ This command fetch the data from the SMA Sunny Portal manually.
+
+
+
+
+ - get <name> storedCredentials
+ The saved credentials are displayed in a popup window.
+
+
+
+
+
+ Attributes
+
+
+
+
+ - cookielifetime <Sekunden>
+ Validity period of a received Cookie (default: 3000 seconds).
+
+
+
+ - cookieLocation <Pfad/File>
+ The path and filename of received Cookies (default: ./log/mycookies.txt).
+
+
+
+ Example:
+ attr <name> cookieLocation ./log/cookies.txt
+
+
+
+
+ - detailLevel
+ Adjust the complexity of the generated data.
+
+
+
+
+
+ | L1 | - only live data and weather data are generated. |
+ | L2 | - as L1 and additional forecast of the current data, the data of the next 4 hours as well as PV-Generation / Consumption the rest of day and the next day |
+ | L3 | - as L2 and additional forecast of the planned switch-on times of consumers, whose current state and energy data as well as their battery usage data |
+ | L4 | - as L3 and additional a detailed forecast of the next 24 hours |
+
+
+
+
+
+
+ - disable
+ Deactivate/activate the device.
+
+
+ - getDataRetries <Anzahl>
+ Number of repetitions (get data) in case of no live data are fetched from the SMA Sunny Portal (default: 3).
+
+
+ - interval <seconds>
+ Time interval for continuous data retrieval from the aus dem SMA Sunny Portal (default: 300 seconds).
+ if the "interval = 0" is set, no continuous data retrieval is executed and has to be triggered by the
+ "get <name> data" command manually.
+ If a value of 120 seconds or less (but >0) should be set, the value will be corrected to 120 soconds.
+
+ Note:
+ The retrieval interval should not be less than 120 seconds. As of previous experiences SMA suffers an interval of
+ 120 seconds although the SMA terms and conditions don't permit an automatic data fetch by computer programs.
+
+
+
+ - showPassInLog
+ If set, the used password will be displayed in Logfile output.
+ (default = 0)
+
+
+ - timeout <seconds>
+ Timeout value for HTTP-calls to the SMA Sunny Portal (default: 30 seconds).
+
+
+
+ - userAgent <identifier>
+ An user agent identifier for identifikation against the SMA Sunny Portal can be specified.
+
+
+
+ Example:
+ attr <name> userAgent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0
+
+
+
+
+ - verbose5Data
+ If verbose 5 is set, huge data are generated. With this attribute only the interesting verbose 5 output
+ can be specified. (default: none).
+
+
+
+
+
@@ -2671,8 +2847,8 @@ return;
define <Name> SMAPortal
- Nach der Definition des Devices müssen noch die Zugangsparameter für das SMA-Portal gespeichert werden.
- Das geschieht mit dem Befehl:
+ Nach der Definition des Devices müssen die Zugangsparameter für das SMA Sunny Portal gespeichert werden
+ mit dem Befehl:
set <Name> credentials <Username> <Passwort>
@@ -2716,7 +2892,7 @@ return;
- get <name> data
- Mit diesem Befehl werden die Daten aus dem SMA-Portal manuell abgerufen.
+ Mit diesem Befehl werden die Daten aus dem SMA Sunny Portal manuell abgerufen.
@@ -2771,14 +2947,14 @@ return;
- getDataRetries <Anzahl>
- Anzahl der Wiederholungen (get data) im Fall dass keine Live-Daten vom SMA-Portal geliefert
+ Anzahl der Wiederholungen (get data) im Fall dass keine Live-Daten vom SMA Sunny Portal geliefert
wurden (default: 3).
- interval <Sekunden>
- Zeitintervall zum kontinuierlichen Datenabruf aus dem SMA-Portal (Default: 300 Sekunden).
+ Zeitintervall zum kontinuierlichen Datenabruf aus dem SMA Sunny Portal (Default: 300 Sekunden).
Ist "interval = 0" gesetzt, erfolgt kein automatischer Datenabruf und muss mit "get <name> data" manuell
- erfolgen. Wird ein Wert kleiner 120 Sekunden (und >0) angegeben, wird der Wert auf 120 Sekunden korrigiert.
+ erfolgen. Wird ein Wert kleiner 120 Sekunden (aber >0) angegeben, wird der Wert auf 120 Sekunden korrigiert.
Hinweis:
Das Abfrageintervall sollte nicht kleiner 120 Sekunden sein. Nach bisherigen Erfahrungen toleriert SMA ein
@@ -2792,12 +2968,12 @@ return;
- timeout <Sekunden>
- Timeout-Wert für HTTP-Aufrufe zum SMA-Portal (default: 30 Sekunden).
+ Timeout-Wert für HTTP-Aufrufe zum SMA Sunny Portal (default: 30 Sekunden).
- userAgent <Kennung>
- Es kann die User-Agent-Kennung zur Identifikation gegenüber dem Portal angegeben werden.
+ Es kann die User-Agent-Kennung zur Identifikation gegenüber dem SMA Sunny Portal angegeben werden.
@@ -2836,7 +3012,7 @@ return;
"smaportal"
],
"version": "v1.1.1",
- "release_status": "testing",
+ "release_status": "stable",
"author": [
"Heiko Maaz ",
"Wzut",