From 70f1abf86c202e56eaaf6323ee8712859c4ac709 Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Sat, 12 Jun 2021 08:37:50 +0000 Subject: [PATCH] 76_SolarForecast.pm: contrib 0.52.1 git-svn-id: https://svn.fhem.de/fhem/trunk@24615 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/76_SolarForecast.pm | 73 ++++++++++++++------- 1 file changed, 51 insertions(+), 22 deletions(-) diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index 5040b1ef5..631a60dd8 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -119,6 +119,7 @@ BEGIN { # Versions History intern my %vNotesIntern = ( + "0.52.1" => "12.06.2021 change Attr Css behavior ", "0.52.0" => "12.06.2021 new Attr Css ", "0.51.3" => "10.06.2021 more refactoring, add 'none' to graphicSelect ", "0.51.2" => "05.06.2021 minor fixes ", @@ -624,9 +625,7 @@ sub Define { $params->{cachename} = $cachename; _readCacheFile ($params); - readingsSingleUpdate($hash, "state", "initialized", 1); - - CommandAttr (undef,"$name Css $cssdef"); # Css Attribut vorbelegen + readingsSingleUpdate($hash, "state", "initialized", 1); centralTask ($hash); # Einstieg in Abfrage InternalTimer (gettimeofday()+$whistrepeat, "FHEM::SolarForecast::periodicWriteCachefiles", $hash, 0); # Einstieg periodisches Schreiben historische Daten @@ -2599,26 +2598,13 @@ sub _manageConsumerData { ## consumer Hash ergänzen, Reading generieren ############################################### - my $costate = ReadingsVal ($consumer, "state", ""); - my $pstate = ConsumerVal ($hash, $c, "planstate", ""); - - $pstate = $pstate =~ /planned/xs ? "planned" : - $pstate =~ /switched\son/xs ? "started" : - $pstate =~ /switched\soff/xs ? "finished" : - "unknown"; - - my $startts = ConsumerVal ($hash, $c, "planswitchon", ""); - my $stopts = ConsumerVal ($hash, $c, "planswitchoff", ""); - - my ($starttime,$stoptime); - (undef,undef,undef,$starttime) = timestampToTimestring ($startts) if($startts); - (undef,undef,undef,$stoptime) = timestampToTimestring ($stopts) if($stopts); - + my $costate = ReadingsVal ($consumer, "state", ""); + my ($pstate,$starttime,$stoptime) = __planningStateandTimes ($paref); $data{$type}{$name}{consumers}{$c}{state} = $costate; push @$daref, "consumer${c}<>" ."name='$alias' state='$costate' planningstate='$pstate' "; # Consumer Infos - push @$daref, "consumer${c}_planned_start<>"."$starttime" if($startts); # Consumer Start geplant - push @$daref, "consumer${c}_planned_stop<>". "$stoptime" if($stopts); # Consumer Stop geplant + push @$daref, "consumer${c}_planned_start<>"."$starttime" if($starttime); # Consumer Start geplant + push @$daref, "consumer${c}_planned_stop<>". "$stoptime" if($stoptime); # Consumer Stop geplant } delete $paref->{consumer}; @@ -2928,6 +2914,31 @@ sub __switchConsumer { return; } +################################################################### +# Consumer Planungsstatus mit Schaltzeiten liefern +################################################################### +sub __planningStateandTimes { + my $paref = shift; + my $hash = $paref->{hash}; + my $c = $paref->{consumer}; + + my $pstate = ConsumerVal ($hash, $c, "planstate", ""); + + $pstate = $pstate =~ /planned/xs ? "planned" : + $pstate =~ /switched\son/xs ? "started" : + $pstate =~ /switched\soff/xs ? "finished" : + "unknown"; + + my $startts = ConsumerVal ($hash, $c, "planswitchon", ""); + my $stopts = ConsumerVal ($hash, $c, "planswitchoff", ""); + + my ($starttime,$stoptime) = ('',''); + (undef,undef,undef,$starttime) = timestampToTimestring ($startts) if($startts); + (undef,undef,undef,$stoptime) = timestampToTimestring ($stopts) if($stopts); + +return ($pstate,$starttime,$stoptime); +} + ################################################################ # Batteriewerte sammeln ################################################################ @@ -4869,7 +4880,7 @@ sub _flowGraphic { } $ret .= qq{ - + @@ -7059,7 +7070,25 @@ Ein/Ausschaltzeiten sowie deren Ausführung vom SolarForecast Modul übernehmen
  • Css
    - Definiert den Style für die Energieflußgrafik. Das Attribut wird mit einem Default automatisch vorbelegt.
    + Definiert den Style für die Energieflußgrafik. Das Attribut wird automatisch vorbelegt. + Zum Ändern des Css-Attributes bitte den Default übernehmen und anpassen:

    + +
      + .flowg.text { stroke: none; fill: gray; }
      + .flowg.sun_active { stroke: orange; fill: orange; }
      + .flowg.sun_inactive { stroke: gray; fill: gray; }
      + .flowg.bat25 { stroke: red; fill: red; }
      + .flowg.bat50 { stroke: yellow; fill: yellow; }
      + .flowg.bat75 { stroke: green; fill: green; }
      + .flowg.grid_color1 { fill: green; }
      + .flowg.grid_color2 { fill: red; }
      + .flowg.grid_color3 { fill: gray; }
      + .flowg.inactive_in { stroke: gray; stroke-dashoffset: 20; stroke-dasharray: 10; opacity: 0.2; }
      + .flowg.inactive_out { stroke: gray; stroke-dashoffset: 20; stroke-dasharray: 10; opacity: 0.2; }
      + .flowg.active_in { stroke: red; stroke-dashoffset: 20; stroke-dasharray: 10; opacity: 0.8; animation: dash 0.5s linear; animation-iteration-count: infinite; }
      + .flowg.active_out { stroke: yellow; stroke-dashoffset: 20; stroke-dasharray: 10; opacity: 0.8; animation: dash 0.5s linear; animation-iteration-count: infinite; }
      +
    +