mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-28 17:12:32 +00:00
76_Solarforcast: contrib 0.71.2
git-svn-id: https://svn.fhem.de/fhem/trunk@26590 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
7b4498bab5
commit
b3b30e7441
@ -61,6 +61,7 @@ BEGIN {
|
|||||||
AttrVal
|
AttrVal
|
||||||
AttrNum
|
AttrNum
|
||||||
CommandAttr
|
CommandAttr
|
||||||
|
CommandGet
|
||||||
CommandSet
|
CommandSet
|
||||||
CommandSetReading
|
CommandSetReading
|
||||||
data
|
data
|
||||||
@ -129,6 +130,7 @@ BEGIN {
|
|||||||
|
|
||||||
# Versions History intern
|
# Versions History intern
|
||||||
my %vNotesIntern = (
|
my %vNotesIntern = (
|
||||||
|
"0.71.2" => "26.10.2022 fix 'connection refused ...' ",
|
||||||
"0.71.1" => "26.10.2022 save no datasets with pv_estimate = 0 (__solCast_ApiResponse) to save time/space ".
|
"0.71.1" => "26.10.2022 save no datasets with pv_estimate = 0 (__solCast_ApiResponse) to save time/space ".
|
||||||
"changed some graphic default settings, typo todayRemaingAPIcalls, input check currentBatteryDev ".
|
"changed some graphic default settings, typo todayRemaingAPIcalls, input check currentBatteryDev ".
|
||||||
"change attr Css to flowGraphicCss ",
|
"change attr Css to flowGraphicCss ",
|
||||||
@ -406,7 +408,7 @@ my %hset = ( # Ha
|
|||||||
currentRadiationDev => { fn => \&_setcurrentRadiationDev },
|
currentRadiationDev => { fn => \&_setcurrentRadiationDev },
|
||||||
modulePeakString => { fn => \&_setmodulePeakString },
|
modulePeakString => { fn => \&_setmodulePeakString },
|
||||||
inverterStrings => { fn => \&_setinverterStrings },
|
inverterStrings => { fn => \&_setinverterStrings },
|
||||||
consumerAction => { fn => \&_setconsumerAction },
|
clientAction => { fn => \&_setclientAction },
|
||||||
currentInverterDev => { fn => \&_setinverterDevice },
|
currentInverterDev => { fn => \&_setinverterDevice },
|
||||||
currentMeterDev => { fn => \&_setmeterDevice },
|
currentMeterDev => { fn => \&_setmeterDevice },
|
||||||
currentBatteryDev => { fn => \&_setbatteryDevice },
|
currentBatteryDev => { fn => \&_setbatteryDevice },
|
||||||
@ -1857,10 +1859,10 @@ return $ret;
|
|||||||
}
|
}
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# Setter consumerAction
|
# Setter clientAction
|
||||||
# ohne Menüeintrag ! für Aktivität aus Grafik
|
# ohne Menüeintrag ! für Aktivität aus Grafik
|
||||||
################################################################
|
################################################################
|
||||||
sub _setconsumerAction { ## no critic "not used"
|
sub _setclientAction { ## no critic "not used"
|
||||||
my $paref = shift;
|
my $paref = shift;
|
||||||
my $hash = $paref->{hash};
|
my $hash = $paref->{hash};
|
||||||
my $name = $paref->{name};
|
my $name = $paref->{name};
|
||||||
@ -1868,6 +1870,8 @@ sub _setconsumerAction { ## no critic "not used"
|
|||||||
my $arg = $paref->{arg};
|
my $arg = $paref->{arg};
|
||||||
my $argsref = $paref->{argsref};
|
my $argsref = $paref->{argsref};
|
||||||
|
|
||||||
|
my $noUpdState = 0; # state nicht updaten = 0 -> state updaten !
|
||||||
|
|
||||||
if(!$arg) {
|
if(!$arg) {
|
||||||
return qq{The command "$opt" needs an argument !};
|
return qq{The command "$opt" needs an argument !};
|
||||||
}
|
}
|
||||||
@ -1878,8 +1882,19 @@ sub _setconsumerAction { ## no critic "not used"
|
|||||||
my $cname = shift @args; # Consumername
|
my $cname = shift @args; # Consumername
|
||||||
my $tail = join " ", map { my $p = $_; $p =~ s/\s//xg; $p; } @args; ## no critic 'Map blocks' # restliche Befehlsargumente
|
my $tail = join " ", map { my $p = $_; $p =~ s/\s//xg; $p; } @args; ## no critic 'Map blocks' # restliche Befehlsargumente
|
||||||
|
|
||||||
|
Log3($name, 4, qq{$name - Consumer Action received / execute: "$action $cname $tail"});
|
||||||
|
|
||||||
if($action eq "set") {
|
if($action eq "set") {
|
||||||
CommandSet (undef, "$cname $tail");
|
CommandSet (undef, "$cname $tail");
|
||||||
|
$noUpdState = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($action eq "get") {
|
||||||
|
if($tail eq 'data') {
|
||||||
|
$noUpdState = 1;
|
||||||
|
centralTask ($hash, $noUpdState);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($action eq "setreading") {
|
if($action eq "setreading") {
|
||||||
@ -1890,9 +1905,7 @@ sub _setconsumerAction { ## no critic "not used"
|
|||||||
CommandSet (undef, "$name $action $cname noTaskcall");
|
CommandSet (undef, "$name $action $cname noTaskcall");
|
||||||
}
|
}
|
||||||
|
|
||||||
Log3($name, 4, qq{$name - Consumer Action received / executed: "$action $cname $tail"});
|
centralTask ($hash, $noUpdState);
|
||||||
|
|
||||||
centralTask ($hash);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2936,9 +2949,10 @@ return @pvconf;
|
|||||||
################################################################
|
################################################################
|
||||||
sub centralTask {
|
sub centralTask {
|
||||||
my $hash = shift;
|
my $hash = shift;
|
||||||
|
my $noUpdState = shift // 0; # state updaten 0, nicht updaten 1
|
||||||
|
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $type = $hash->{TYPE};
|
my $type = $hash->{TYPE};
|
||||||
|
|
||||||
my $cst = [gettimeofday]; # Zyklus-Startzeit
|
my $cst = [gettimeofday]; # Zyklus-Startzeit
|
||||||
|
|
||||||
RemoveInternalTimer($hash, "FHEM::SolarForecast::centralTask");
|
RemoveInternalTimer($hash, "FHEM::SolarForecast::centralTask");
|
||||||
@ -2986,7 +3000,7 @@ sub centralTask {
|
|||||||
|
|
||||||
return if(IsDisabled($name));
|
return if(IsDisabled($name));
|
||||||
|
|
||||||
readingsSingleUpdate($hash, "state", "running", 1);
|
readingsSingleUpdate($hash, "state", "running", 1) if(!$noUpdState);
|
||||||
|
|
||||||
my $ret = createStringConfig ($hash); # die String Konfiguration erstellen
|
my $ret = createStringConfig ($hash); # die String Konfiguration erstellen
|
||||||
if ($ret) {
|
if ($ret) {
|
||||||
@ -3053,7 +3067,7 @@ sub centralTask {
|
|||||||
|
|
||||||
saveEnergyConsumption ($centpars); # Energie Hausverbrauch speichern
|
saveEnergyConsumption ($centpars); # Energie Hausverbrauch speichern
|
||||||
|
|
||||||
readingsSingleUpdate ($hash, "state", $centpars->{state}, 1); # Abschluß state
|
readingsSingleUpdate ($hash, "state", $centpars->{state}, 1) if(!$noUpdState); # Abschluß state
|
||||||
setTimeTracking ($hash, $cst, 'runTimeCentralTask'); # Zyklus-Laufzeit ermitteln
|
setTimeTracking ($hash, $cst, 'runTimeCentralTask'); # Zyklus-Laufzeit ermitteln
|
||||||
|
|
||||||
genStatisticReadings ($centpars); # optionale Statistikreadings erstellen
|
genStatisticReadings ($centpars); # optionale Statistikreadings erstellen
|
||||||
@ -6230,7 +6244,7 @@ sub entryGraphic {
|
|||||||
colorw => AttrVal ($name, 'weatherColor', $wthcolddef), # Wetter Icon Farbe Tag
|
colorw => AttrVal ($name, 'weatherColor', $wthcolddef), # Wetter Icon Farbe Tag
|
||||||
colorwn => AttrVal ($name, 'weatherColorNight', $wthcolndef), # Wetter Icon Farbe Nacht
|
colorwn => AttrVal ($name, 'weatherColorNight', $wthcolndef), # Wetter Icon Farbe Nacht
|
||||||
wlalias => AttrVal ($name, 'alias', $name),
|
wlalias => AttrVal ($name, 'alias', $name),
|
||||||
header => AttrNum ($name, 'showHeader', 1),
|
sheader => AttrNum ($name, 'showHeader', 1),
|
||||||
hdrDetail => AttrVal ($name, 'headerDetail', 'all'), # ermöglicht den Inhalt zu begrenzen, um bspw. passgenau in ftui einzubetten
|
hdrDetail => AttrVal ($name, 'headerDetail', 'all'), # ermöglicht den Inhalt zu begrenzen, um bspw. passgenau in ftui einzubetten
|
||||||
lang => AttrVal ("global", 'language', 'EN'),
|
lang => AttrVal ("global", 'language', 'EN'),
|
||||||
flowgsize => AttrVal ($name, 'flowGraphicSize', $flowGSizedef), # Größe Energieflußgrafik
|
flowgsize => AttrVal ($name, 'flowGraphicSize', $flowGSizedef), # Größe Energieflußgrafik
|
||||||
@ -6256,12 +6270,12 @@ sub entryGraphic {
|
|||||||
# Headerzeile generieren
|
# Headerzeile generieren
|
||||||
##########################
|
##########################
|
||||||
my $header = _graphicHeader ($paref);
|
my $header = _graphicHeader ($paref);
|
||||||
$paref->{header} = $header;
|
#$paref->{header} = $header;
|
||||||
|
|
||||||
# Verbraucherlegende und Steuerung
|
# Verbraucherlegende und Steuerung
|
||||||
###################################
|
###################################
|
||||||
my $legendtxt = _graphicConsumerLegend ($paref);
|
my $legendtxt = _graphicConsumerLegend ($paref);
|
||||||
$paref->{legendtxt} = $legendtxt;
|
#$paref->{legendtxt} = $legendtxt;
|
||||||
|
|
||||||
$ret .= "\n<table class='block'>"; # das \n erleichtert das Lesen der debug Quelltextausgabe
|
$ret .= "\n<table class='block'>"; # das \n erleichtert das Lesen der debug Quelltextausgabe
|
||||||
my $m = $paref->{modulo} % 2;
|
my $m = $paref->{modulo} % 2;
|
||||||
@ -6441,9 +6455,9 @@ return;
|
|||||||
################################################################
|
################################################################
|
||||||
sub _graphicHeader {
|
sub _graphicHeader {
|
||||||
my $paref = shift;
|
my $paref = shift;
|
||||||
my $header = $paref->{header};
|
my $sheader = $paref->{sheader};
|
||||||
|
|
||||||
return if(!$header);
|
return if(!$sheader);
|
||||||
|
|
||||||
my $hdrDetail = $paref->{hdrDetail}; # ermöglicht den Inhalt zu begrenzen, um bspw. passgenau in ftui einzubetten
|
my $hdrDetail = $paref->{hdrDetail}; # ermöglicht den Inhalt zu begrenzen, um bspw. passgenau in ftui einzubetten
|
||||||
my $ftui = $paref->{ftui};
|
my $ftui = $paref->{ftui};
|
||||||
@ -6502,7 +6516,7 @@ sub _graphicHeader {
|
|||||||
|
|
||||||
## Header Start
|
## Header Start
|
||||||
#################
|
#################
|
||||||
$header = qq{<table width='100%'>};
|
my $header = qq{<table width='100%'>};
|
||||||
|
|
||||||
# Header Link + Status + Update Button
|
# Header Link + Status + Update Button
|
||||||
#########################################
|
#########################################
|
||||||
@ -6516,10 +6530,10 @@ sub _graphicHeader {
|
|||||||
$lup = "$day.$month.$year $time";
|
$lup = "$day.$month.$year $time";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $cmdupdate = qq{"FW_cmd('$FW_ME$FW_subdir?XHR=1&cmd=get $name data')"}; # Update Button generieren
|
my $cmdupdate = qq{"FW_cmd('$FW_ME$FW_subdir?XHR=1&cmd=set $name clientAction get $name data')"}; # Update Button generieren
|
||||||
|
|
||||||
if ($ftui eq "ftui") {
|
if ($ftui eq "ftui") {
|
||||||
$cmdupdate = qq{"ftui.setFhemStatus('get $name data')"};
|
$cmdupdate = qq{"ftui.setFhemStatus('set $name clientAction get $name data')"};
|
||||||
}
|
}
|
||||||
|
|
||||||
my $cmdplchk = qq{"FW_cmd('$FW_ME$FW_subdir?XHR=1&cmd=get $name plantConfigCheck', function(data){FW_okDialog(data)})"}; # Plant Check Button generieren
|
my $cmdplchk = qq{"FW_cmd('$FW_ME$FW_subdir?XHR=1&cmd=get $name plantConfigCheck', function(data){FW_okDialog(data)})"}; # Plant Check Button generieren
|
||||||
@ -6810,18 +6824,18 @@ sub _graphicConsumerLegend {
|
|||||||
my $autord = ConsumerVal ($hash, $c, "autoreading", ""); # Readingname f. Automatiksteuerung
|
my $autord = ConsumerVal ($hash, $c, "autoreading", ""); # Readingname f. Automatiksteuerung
|
||||||
my $auto = ConsumerVal ($hash, $c, "auto", 1); # Automatic Mode
|
my $auto = ConsumerVal ($hash, $c, "auto", 1); # Automatic Mode
|
||||||
|
|
||||||
my $cmdon = qq{"FW_cmd('$FW_ME$FW_subdir?XHR=1&cmd=set $name consumerAction set $cname $oncom')"};
|
my $cmdon = qq{"FW_cmd('$FW_ME$FW_subdir?XHR=1&cmd=set $name clientAction set $cname $oncom')"};
|
||||||
my $cmdoff = qq{"FW_cmd('$FW_ME$FW_subdir?XHR=1&cmd=set $name consumerAction set $cname $offcom')"};
|
my $cmdoff = qq{"FW_cmd('$FW_ME$FW_subdir?XHR=1&cmd=set $name clientAction set $cname $offcom')"};
|
||||||
my $cmdautoon = qq{"FW_cmd('$FW_ME$FW_subdir?XHR=1&cmd=set $name consumerAction setreading $cname $autord 1')"};
|
my $cmdautoon = qq{"FW_cmd('$FW_ME$FW_subdir?XHR=1&cmd=set $name clientAction setreading $cname $autord 1')"};
|
||||||
my $cmdautooff = qq{"FW_cmd('$FW_ME$FW_subdir?XHR=1&cmd=set $name consumerAction setreading $cname $autord 0')"};
|
my $cmdautooff = qq{"FW_cmd('$FW_ME$FW_subdir?XHR=1&cmd=set $name clientAction setreading $cname $autord 0')"};
|
||||||
my $implan = qq{"FW_cmd('$FW_ME$FW_subdir?XHR=1&cmd=set $name consumerAction consumerImmediatePlanning $c')"};
|
my $implan = qq{"FW_cmd('$FW_ME$FW_subdir?XHR=1&cmd=set $name clientAction consumerImmediatePlanning $c')"};
|
||||||
|
|
||||||
if ($ftui eq "ftui") {
|
if ($ftui eq "ftui") {
|
||||||
$cmdon = qq{"ftui.setFhemStatus('set $name consumerAction set $cname $oncom')"};
|
$cmdon = qq{"ftui.setFhemStatus('set $name clientAction set $cname $oncom')"};
|
||||||
$cmdoff = qq{"ftui.setFhemStatus('set $name consumerAction set $cname $offcom')"};
|
$cmdoff = qq{"ftui.setFhemStatus('set $name clientAction set $cname $offcom')"};
|
||||||
$cmdautoon = qq{"ftui.setFhemStatus('set $name consumerAction set $cname setreading $cname $autord 1')"};
|
$cmdautoon = qq{"ftui.setFhemStatus('set $name clientAction set $cname setreading $cname $autord 1')"};
|
||||||
$cmdautooff = qq{"ftui.setFhemStatus('set $name consumerAction set $cname setreading $cname $autord 0')"};
|
$cmdautooff = qq{"ftui.setFhemStatus('set $name clientAction set $cname setreading $cname $autord 0')"};
|
||||||
$implan = qq{"ftui.setFhemStatus('set $name consumerAction consumerImmediatePlanning $c')"};
|
$implan = qq{"ftui.setFhemStatus('set $name clientAction consumerImmediatePlanning $c')"};
|
||||||
}
|
}
|
||||||
|
|
||||||
$cmdon = q{} if(!$oncom);
|
$cmdon = q{} if(!$oncom);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user