diff --git a/fhem/CHANGED b/fhem/CHANGED index c501243df..c708965f4 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -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. + - change: 01_FHEMWEB.pm: default plotEmbed to 0 (Forum #82351) - feature: 73_GardenaSmartBridge: 74_GeardenaSmartDevice: add support for Irrigation Control - change: 98_feels_like.pm: Improved algorithms, fix reDEFINE diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index d0d500728..699e6268c 100644 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -6,6 +6,7 @@ use strict; use warnings; use TcpServerUtils; use HttpUtils; +use Blocking; use Time::HiRes qw(gettimeofday); ######################### @@ -89,9 +90,7 @@ use vars qw($FW_userAgent); # user agent string $FW_formmethod = "post"; -my $FW_zlib_checked; -my $FW_use_zlib = 1; -my $FW_use_sha = 0; +my %FW_use; my $FW_activateInform = 0; my $FW_lastWebName = ""; # Name of last FHEMWEB instance, for caching my $FW_lastHashUpdate = 0; @@ -119,6 +118,7 @@ my $FW_headerlines; # my $FW_chash; # client fhem hash my $FW_encoding="UTF-8"; my $FW_styleStamp=time(); +my %FW_svgData; ##################################### @@ -228,13 +228,21 @@ FHEMWEB_Initialize($) } } - eval { require Digest::SHA; }; - if($@) { - Log 4, $@; - Log 3, "FHEMWEB: Can't load Digest::SHA, ". - "longpoll via websocket is not available"; + my %optMod = ( + zlib => { mod=>"Compress::Zlib", txt=>"compressed HTTP transfer" }, + sha => { mod=>"Digest::SHA", txt=>"longpoll via websocket" }, + base64 => { mod=>"MIME::Base64", txt=>"parallel SVG computing" } + ); + foreach my $mod (keys %optMod) { + eval "require $optMod{$mod}{mod}"; + if($@) { + Log 4, $@; + Log 3, "FHEMWEB: Can't load $optMod{$mod}{mod}, ". + "$optMod{$mod}{txt} is not available"; + } else { + $FW_use{$mod} = 1; + } } - $FW_use_sha = 1; } ##################################### @@ -310,20 +318,6 @@ FW_Read($$) $FW_subdir = ""; my $c = $hash->{CD}; - if(!$FW_zlib_checked) { - $FW_zlib_checked = 1; - $FW_use_zlib = AttrVal($FW_wname, "fwcompress", 1); - if($FW_use_zlib) { - eval { require Compress::Zlib; }; - if($@) { - $FW_use_zlib = 0; - Log3 $FW_wname, 1, $@; - Log3 $FW_wname, 1, - "$FW_wname: Can't load Compress::Zlib, deactivating compression"; - $attr{$FW_wname}{fwcompress} = 0; - } - } - } if(!$reread) { # Data from HTTP Client @@ -478,7 +472,7 @@ FW_Read($$) $FW_CSRF = (defined($defs{$FW_wname}{CSRFTOKEN}) ? "&fwcsrf=".$defs{$FW_wname}{CSRFTOKEN} : ""); - if($FW_use_sha && $method eq 'GET' && + if($FW_use{sha} && $method eq 'GET' && $FW_httpheader{Connection} && $FW_httpheader{Connection} =~ /Upgrade/i) { my $shastr = Digest::SHA::sha1_base64($FW_httpheader{'Sec-WebSocket-Key'}. @@ -504,7 +498,7 @@ FW_Read($$) $arg = "" if(!defined($arg)); Log3 $FW_wname, 4, "$name $method $arg; BUFLEN:".length($hash->{BUF}); - my $pf = AttrVal($FW_wname, "plotfork", undef); + my $pf = AttrVal($FW_wname, "plotfork", 0); if($pf) { # 0 disables # Process SVG rendering as a parallel process my $p = $data{FWEXT}; @@ -540,12 +534,22 @@ FW_Read($$) FW_closeConn($hash); return; } + return if($cacheable == -2); # async op, well be answered later + FW_finishRead($hash, $cacheable, $arg); + +} + +sub +FW_finishRead($$$) +{ + my ($hash, $cacheable, $arg) = @_; + my $name = $hash->{NAME}; my $compressed = ""; if($FW_RETTYPE =~ m/(text|xml|json|svg|script)/i && ($FW_httpheader{"Accept-Encoding"} && $FW_httpheader{"Accept-Encoding"} =~ m/gzip/) && - $FW_use_zlib) { + $FW_use{zlib}) { utf8::encode($FW_RET) if(utf8::is_utf8($FW_RET) && $FW_RET =~ m/[^\x00-\xFF]/ ); eval { $FW_RET = Compress::Zlib::memGzip($FW_RET); }; @@ -558,7 +562,7 @@ FW_Read($$) my $length = length($FW_RET); my $expires = ($cacheable? - ("Expires: ".FmtDateTimeRFC1123($now+900)."\r\n") : ""); + ("Expires: ".FmtDateTimeRFC1123($hash->{LASTACCESS}+900)."\r\n") : ""); Log3 $FW_wname, 4, "$FW_wname: $arg / RL:$length / $FW_RETTYPE / $compressed / $expires"; if( ! FW_addToWritebuffer($hash, @@ -1025,7 +1029,7 @@ FW_answerCall($) my $csrf= ($FW_CSRF ? "fwcsrf='$defs{$FW_wname}{CSRFTOKEN}'" : ""); my $gen = 'generated="'.(time()-1).'"'; my $lp = 'longpoll="'.AttrVal($FW_wname,"longpoll", - $FW_use_sha && $FW_userAgent=~m/Chrome/ ? "websocket": 1).'"'; + $FW_use{sha} && $FW_userAgent=~m/Chrome/ ? "websocket": 1).'"'; $FW_id = $FW_chash->{NR} if( !$FW_id ); my $dataAttr = FW_dataAttr(); @@ -1069,15 +1073,16 @@ FW_answerCall($) return $ret if($ret); } + my $srVal = 0; if($cmd =~ m/^style /) { FW_style($cmd,undef); } elsif($FW_detail) { FW_doDetail($FW_detail); } - elsif($FW_room) { FW_showRoom(); } + elsif($FW_room) { $srVal = FW_showRoom(); } elsif(!defined($FW_cmdret) && !$FW_contentFunc) { $FW_room = AttrVal($FW_wname, "defaultRoom", ''); if($FW_room ne '') { - FW_showRoom(); + $srVal = FW_showRoom(); } else { my $motd = AttrVal("global","motd","none"); @@ -1086,6 +1091,7 @@ FW_answerCall($) } } } + return $srVal if($srVal); FW_pO ""; return 0; } @@ -1810,7 +1816,7 @@ FW_sortIndex($) sub FW_showRoom() { - return if(!$FW_room); + return 0 if(!$FW_room); %FW_hiddengroup = (); foreach my $r (split(",",AttrVal($FW_wname, "hiddengroup", ""))) { @@ -1898,15 +1904,60 @@ FW_showRoom() FW_pO "
"; # Now the "atEnds" - foreach my $d (sort { $sortIndex{$a} cmp $sortIndex{$b} } @atEnds) { + my $doBC = (AttrVal($FW_wname, "plotfork", 0) && + AttrVal($FW_wname, "plotEmbed", 0) == 0); + my %res; + my $idx = 1; + @atEnds = sort { $sortIndex{$a} cmp $sortIndex{$b} } @atEnds; + foreach my $d (@atEnds) { no strict "refs"; + my $fn = $modules{$defs{$d}{TYPE}}{FW_summaryFn}; $extPage{group} = "atEnd"; - FW_pO &{$modules{$defs{$d}{TYPE}}{FW_summaryFn}}($FW_wname, $d, - $FW_room, \%extPage); + $extPage{index} = $idx++; + if($doBC && $defs{$d}{TYPE} eq "SVG" && $FW_use{base64}) { + BlockingCall(sub { + return "$FW_cname,$d,". + encode_base64(&{$fn}($FW_wname,$d,$FW_room,\%extPage),''); + }, undef, "FW_svgCollect"); + } else { + $res{$d} = &{$fn}($FW_wname,$d,$FW_room,\%extPage); + } use strict "refs"; } + return FW_svgDone(\%res, \@atEnds, undef); +} + +sub +FW_svgDone($$$) +{ + my ($res, $atEnds, $delayedReturn) = @_; + + if(int(keys %{$res}) != int(@{$atEnds})) { + $FW_svgData{$FW_cname} = { FW_RET=>$FW_RET, RES=>$res, ATENDS=>$atEnds }; + return -2 ; + } + + foreach my $d (@{$atEnds}) { + FW_pO $res->{$d}; + } FW_pO ""; FW_pO ""; + FW_pO "" if($delayedReturn); + return 0; +} + +sub +FW_svgCollect($) +{ + my ($cname,$d,$enc) = split(",",$_[0],3); + my $h = $FW_svgData{$cname}; + my ($res, $atEnds) = ($h->{RES}, $h->{ATENDS}); + $res->{$d} = decode_base64($enc); + return if(int(keys %{$res}) != int(@{$atEnds})); + $FW_RET = $h->{FW_RET}; + delete($FW_svgData{$cname}); + FW_svgDone($res, $atEnds, 1); + FW_finishRead($defs{$cname}, 0, ""); } # Room1:col1group1,col1group2|col2group1,col2group2 Room2:... @@ -2021,7 +2072,7 @@ FW_returnFileAsStream($$$$$) $etag = defined($etag) ? "ETag: \"$etag\"\r\n" : ""; my $expires = $cacheable ? ("Expires: ".gmtime(time()+900)." GMT\r\n"): ""; my $compr = ($FW_httpheader{"Accept-Encoding"} && - $FW_httpheader{"Accept-Encoding"} =~ m/gzip/ && $FW_use_zlib) ? + $FW_httpheader{"Accept-Encoding"} =~ m/gzip/ && $FW_use{zlib}) ? "Content-Encoding: gzip\r\n" : ""; TcpServer_WriteBlocking($FW_chash, "HTTP/1.1 200 OK\r\n". $compr . $expires . $FW_headerlines . $etag . @@ -2608,7 +2659,7 @@ FW_Attr(@) if($attrName eq "longpoll" && $type eq "set" && $param[0] eq "websocket") { return "$devName: Could not load Digest::SHA on startup, no websocket" - if(!$FW_use_sha); + if(!$FW_use{sha}); } return $retMsg; @@ -3732,25 +3783,18 @@ FW_widgetOverride($$)
-
  • plotEmbed 0
    - SVG plots are rendered as part of <embed> tags, as in the past - this was the only way to display SVG, and it allows to render them in - parallel, see plotfork. - Setting plotEmbed to 0 will render SVG in-place, but as a side-effect - makes the plotfork attribute meaningless.
    +
  • plotEmbed
    + If set (to 1), SVG plots will be rendered as part of <embed> + tags, as in the past this was the only way to display SVG. Setting + plotEmbed to 0 (the default) will render SVG in-place.

  • -
  • plotfork [<Δp>]
    +
  • plotfork
    If set to a nonzero value, run part of the processing (e.g. SVG plot generation or RSS feeds) in - parallel processes. Actually, child processes are forked whose - priorities are the FHEM process' priority plus Δp. - Higher values mean lower priority. e.g. use Δp= 10 to renice the - child processes and provide more CPU power to the main FHEM process. - Δp is optional and defaults to 0.
    - Note: do not use it - on Windows and on systems with small memory footprint. + parallel processes, default is 0. Note: do not use it on systems with + small memory footprint.

  • @@ -4439,24 +4483,17 @@ FW_widgetOverride($$)
  • plotEmbed 0
    - SVG Grafiken werden als Teil der <embed> Tags dargestellt, da - früher das der einzige Weg war SVG darzustellen, weiterhin - erlaubt es das parallele Berechnen via plotfork (s.o.) - Falls plotEmbed auf 0 gesetzt wird, dann werden die SVG Grafiken als - Teil der HTML-Seite generiert, was leider das plotfork Attribut - wirkungslos macht. + Falls gesetzt (auf 1), dann werden SVG Grafiken mit <embed> Tags + gerendert, da auf älteren Browsern das die einzige + Möglichkeit war, SVG dastellen zu können. Falls 0 (die + Voreinstellung), dann werden die SVG Grafiken "in-place" gezeichnet.

  • plotfork
    - Normalerweise wird die Ploterstellung im Hauptprozess ausgeführt, - FHEM wird wärend dieser Zeit nicht auf andere Ereignisse - reagieren. - Falls dieses Attribut auf einen nicht 0 Wert gesetzt ist, dann wird die - Berechnung in weitere Prozesse ausgelagert. Das kann die Berechnung auf - Rechnern mit mehreren Prozessoren beschleunigen, allerdings kann es auf - Rechnern mit wenig Speicher (z.Bsp. FRITZ!Box 7390) zum automatischen - Abschuss des FHEM Prozesses durch das OS führen. + Falls gesetzt, dann werden bestimmte Berechnungen (z.Bsp. SVG und RSS) + auf nebenläufige Prozesse verteilt. Voreinstellung ist 0. Achtung: + nicht auf Systemen mit wenig Hauptspeicher verwenden.

  • diff --git a/fhem/FHEM/98_SVG.pm b/fhem/FHEM/98_SVG.pm index ad5834fce..4937d5354 100644 --- a/fhem/FHEM/98_SVG.pm +++ b/fhem/FHEM/98_SVG.pm @@ -199,8 +199,7 @@ SVG_getplotsize($) sub SVG_isEmbed($) { - return (AttrVal($FW_wname, "plotEmbed", 1)); - # $FW_userAgent !~ m/(iPhone|iPad|iPod).*OS (8|9)/)); + return AttrVal($FW_wname, "plotEmbed", 0); } sub @@ -222,16 +221,13 @@ SVG_FwFn($$$$) my $hash = $defs{$d}; my $ret = ""; - if(!$pageHash || !$pageHash->{jsLoaded}) { - $ret .= ""; - $pageHash->{jsLoaded} = 1 if($pageHash); - } + my $isFirst = (!$pageHash || !$pageHash->{index} || $pageHash->{index} == 1); + $ret .= "" + if($isFirst); # plots navigation buttons my $pm = AttrVal($d,"plotmode",$FW_plotmode); - if((!$pageHash || !$pageHash->{buttons}) && - AttrVal($d, "fixedrange", "x") !~ m/^[ 0-9:-]*$/) { - + if($isFirst) { $ret .= '
    '; $ret .= SVG_zoomLink("zoom=-1", "Zoom-in", "zoom in"); $ret .= SVG_zoomLink("zoom=1", "Zoom-out","zoom out"); @@ -243,34 +239,6 @@ SVG_FwFn($$$$) } - if($pm eq "jsSVG") { - my @d=split(":",$defs{$d}{DEF}); - my ($err, @svgplotfile) = FileRead("$FW_gplotdir/$d[1].gplot"); - ($err, @svgplotfile) = FileRead("$FW_gplotdir/template.gplot") if($err); - my $gplot = join("", @svgplotfile); - $gplot =~ s/'/'/g; - my %webattrflt = ( endPlotNow=>1, endPlotToday=>1, plotmode=>1, - plotsize=>1, nrAxis=>1, stylesheetPrefix=>1 ); - if(!$pageHash || !$pageHash->{jssvgLoaded}) { - $ret .= - ""; - $pageHash->{jssvgLoaded} = 1 if($pageHash); - } - - SVG_calcOffsets($d[0], $d); - $ret .= "
    ". - "
    "; - $ret .= (SVG_PEdit($FW_wname,$d,$room,$pageHash) . "
    ") - if(!$pageHash); - return $ret; - } - my $arg="$FW_ME/SVG_showLog?dev=$d". "&logdev=$hash->{LOGDEVICE}". "&gplotfile=$hash->{GPLOTFILE}". diff --git a/fhem/FHEM/Blocking.pm b/fhem/FHEM/Blocking.pm index 09db5bda0..7ac415ca5 100644 --- a/fhem/FHEM/Blocking.pm +++ b/fhem/FHEM/Blocking.pm @@ -122,7 +122,7 @@ BlockingStart(;$) BC_searchTelnet($curr && $curr->{fn} ? $curr->{fn}: "BlockingStart"); my $chld_alive = 0; - my $max = AttrVal('global', 'blockingCallMax', 0); + my $max = AttrVal('global', 'blockingCallMax', 32); for my $bpid (sort { $a <=> $b} keys %BC_hash) { my $h = $BC_hash{$bpid}; @@ -131,7 +131,7 @@ BlockingStart(;$) if($^O =~ m/Win/) { # MaxNr of concurrent forked processes @Win is 64, and must use wait as # $SIG{CHLD} = 'IGNORE' does not work. - wait if(!$h->{telnet} || !$defs{$h->{telnet}}); + wait if($h->{terminated}); } else { use POSIX ":sys_wait_h"; waitpid(-1, WNOHANG); # Forum #58867 diff --git a/fhem/FHEM/TcpServerUtils.pm b/fhem/FHEM/TcpServerUtils.pm index 86ff38d2c..91bce498a 100644 --- a/fhem/FHEM/TcpServerUtils.pm +++ b/fhem/FHEM/TcpServerUtils.pm @@ -30,7 +30,7 @@ TcpServer_Open($$$) Domain => ($hash->{IPV6} ? AF_INET6() : AF_UNSPEC), # Linux bug LocalHost => $lh, LocalPort => $port, - Listen => 10, + Listen => 32, # For Windows Blocking => ($^O =~ /Win/ ? 1 : 0), # Needed for .WRITEBUFFER@darwin ReuseAddr => 1 ); diff --git a/fhem/demolog/LightScenes.dd.save b/fhem/demolog/LightScenes.dd.save index f97ef666c..ec8113769 100644 --- a/fhem/demolog/LightScenes.dd.save +++ b/fhem/demolog/LightScenes.dd.save @@ -1,30 +1,30 @@ -#Sun Jan 4 16:24:11 2015 +#Sun Jul 15 15:31:10 2018 { 'lcCinema' => { + 'AllOff' => { + 'Screen' => 'up', + 'ReadingLight' => 'off', + 'Projector' => 'off', + 'CeilingLight' => 'off', + 'TV' => 'off' + }, 'Break' => { - 'CeilingLight' => 'dim37%', - 'ReadingLight' => 'dim37%' + 'ReadingLight' => 'dim37%', + 'CeilingLight' => 'dim37%' }, 'Cinema' => { 'CeilingLight' => 'off', - 'Projector' => 'on', + 'TV' => 'off', 'Screen' => 'down', 'ReadingLight' => 'off', - 'TV' => 'off' + 'Projector' => 'on' }, 'WatchTV' => { - 'CeilingLight' => 'off', - 'Projector' => 'off', 'Screen' => 'up', 'ReadingLight' => 'dim12%', + 'Projector' => 'off', + 'CeilingLight' => 'off', 'TV' => 'on' - }, - 'AllOff' => { - 'CeilingLight' => 'off', - 'Projector' => 'off', - 'Screen' => 'up', - 'ReadingLight' => 'off', - 'TV' => 'off' - } + } } } diff --git a/fhem/demolog/fhem.save b/fhem/demolog/fhem.save index 0f31bd268..e0fd76c08 100644 --- a/fhem/demolog/fhem.save +++ b/fhem/demolog/fhem.save @@ -1,4 +1,4 @@ -#Sun Jan 4 16:24:11 2015 +#Sun Jul 15 15:31:10 2018 setstate Alarm on setstate Alarm 2015-01-04 16:22:21 state on setstate AllLights on @@ -6,10 +6,11 @@ setstate AllLights 2015-01-04 16:22:04 LastDevice Alarm setstate AllLights 2015-01-04 16:22:04 LastDevice_Abs Alarm setstate AllLights 2015-01-04 16:22:04 state undefined setstate AllResidentsAway active +setstate AllResidentsAway 2018-07-15 15:27:23 state active setstate CT off setstate CT 2015-01-03 01:10:50 ct 3703 setstate CT 2015-01-04 13:30:52 lastCmd off -setstate CT 2015-01-04 16:22:04 state off +setstate CT 2018-07-15 15:27:23 state off setstate CeilingLight dim0% setstate CeilingLight 2015-01-04 16:22:40 state off setstate Cellar T: 21.1 H: 54.6 @@ -30,7 +31,7 @@ setstate Garden 2013-08-13 15:03:17 israining no setstate Garden 2013-08-13 15:03:17 rain 81.9 setstate Garden 2013-08-13 15:03:17 rain_raw 321 setstate Garden 2013-08-13 15:03:17 rain_raw_adj 321 -setstate Garden 2015-01-04 16:19:04 state defined +setstate Garden 2018-07-15 15:27:23 state defined setstate Garden 2013-08-13 15:03:17 temperature 18.3 setstate Garden 2013-08-13 15:03:17 tsecs 1376805797 setstate Garden 2013-08-13 15:03:17 unknown1 a @@ -42,6 +43,7 @@ setstate Livingroom 2015-01-04 16:22:21 state on setstate Log.Cellar active setstate Log.Dewpoint active setstate Log.Garden active +setstate Log.Predicted active setstate Logfile active setstate Office on setstate Office 2015-01-04 16:22:21 state on @@ -53,32 +55,33 @@ setstate RGB off setstate RGB 2015-01-04 12:55:47 hue 220 setstate RGB 2015-01-04 13:30:54 lastCmd off setstate RGB 2015-01-04 12:55:47 rgb 0054FF -setstate RGB 2015-01-04 16:22:04 state off +setstate RGB 2018-07-15 15:27:23 state off setstate ReadingLight dim0% setstate ReadingLight 2015-01-04 16:22:40 state off setstate ResidentsComeHome active +setstate ResidentsComeHome 2018-07-15 15:27:23 state active setstate SVG_01_Garden initialized setstate SVG_02_Cellar initialized setstate SVG_03_Dewpoint initialized +setstate SVG_04_Sun initialized +setstate SVG_05_Polar initialized setstate Screen up setstate Screen 2015-01-04 16:22:40 state up setstate TV off setstate TV 2015-01-04 16:22:40 state off -setstate anyViews 2015-01-04 16:24:11 lockstate 0 -setstate anyViews 2015-01-04 16:19:04 state Initialized -setstate anyViews_weblink initialized +setstate Weather.weblink initialized setstate autocreate active -setstate colorInit 2015-01-04 16:19:04 +setstate colorInit 2018-07-15 15:27:23 +setstate colorInit 2018-07-15 15:27:23 state active setstate dew_all active setstate eventTypes active -setstate global - -setstate lcCinema AllOff +setstate global no definition setstate lcCinema 2015-01-04 16:22:40 state AllOff -setstate outdoorNotifier 2015-01-04 16:22:21 +setstate outdoorNotifier active +setstate outdoorNotifier 2018-07-15 15:27:23 state active setstate rg_Guest1 none -setstate rg_Guest1 2015-01-04 16:19:19 durTimerAbsence 00:00:00 -setstate rg_Guest1 2015-01-04 16:19:19 durTimerAbsence_cr 0 +setstate rg_Guest1 2018-07-15 15:30:38 durTimerAbsence 38640:21:18 +setstate rg_Guest1 2018-07-15 15:30:38 durTimerAbsence_cr 2318421 setstate rg_Guest1 2015-01-04 16:19:19 durTimerPresence 00:00:00 setstate rg_Guest1 2015-01-04 16:19:19 durTimerPresence_cr 0 setstate rg_Guest1 2015-01-04 16:19:19 durTimerSleep 00:00:00 @@ -99,8 +102,8 @@ setstate rg_Guest1 2014-02-16 14:09:20 presence absent setstate rg_Guest1 2014-02-16 14:09:20 state none setstate rg_Guest1 2014-02-15 16:16:27 wayhome 0 setstate rg_Guest2 none -setstate rg_Guest2 2015-01-04 16:19:19 durTimerAbsence 00:00:00 -setstate rg_Guest2 2015-01-04 16:19:19 durTimerAbsence_cr 0 +setstate rg_Guest2 2018-07-15 15:30:38 durTimerAbsence 38640:29:53 +setstate rg_Guest2 2018-07-15 15:30:38 durTimerAbsence_cr 2318430 setstate rg_Guest2 2015-01-04 16:19:19 durTimerPresence 00:00:00 setstate rg_Guest2 2015-01-04 16:19:19 durTimerPresence_cr 0 setstate rg_Guest2 2015-01-04 16:19:19 durTimerSleep 00:00:00 @@ -121,6 +124,12 @@ setstate rg_Guest2 2014-02-16 14:00:46 presence absent setstate rg_Guest2 2014-02-16 14:01:22 state none setstate rg_Guest2 2014-02-15 16:16:29 wayhome 0 setstate rgr_Children home +setstate rgr_Children 2018-07-15 15:19:54 durTimerAbsence 00:00:00 +setstate rgr_Children 2018-07-15 15:19:54 durTimerAbsence_cr 0 +setstate rgr_Children 2018-07-15 15:30:38 durTimerPresence 38639:59:33 +setstate rgr_Children 2018-07-15 15:30:38 durTimerPresence_cr 2318400 +setstate rgr_Children 2018-07-15 15:19:54 durTimerSleep 00:00:00 +setstate rgr_Children 2018-07-15 15:19:54 durTimerSleep_cr 0 setstate rgr_Children 2015-01-04 16:19:19 lastActivity gone setstate rgr_Children 2015-01-04 16:19:19 lastActivityBy Son setstate rgr_Children 2014-02-16 14:31:05 lastArrival 2014-02-16 14:31:05 @@ -145,6 +154,12 @@ setstate rgr_Children 2014-02-16 14:58:01 residentsTotalPresent 1 setstate rgr_Children 2014-02-15 16:16:25 residentsTotalWayhome 0 setstate rgr_Children 2014-02-17 20:45:12 state home setstate rgr_Guests none +setstate rgr_Guests 2018-07-15 15:30:38 durTimerAbsence 38640:21:18 +setstate rgr_Guests 2018-07-15 15:30:38 durTimerAbsence_cr 2318421 +setstate rgr_Guests 2018-07-15 15:19:54 durTimerPresence 00:00:00 +setstate rgr_Guests 2018-07-15 15:19:54 durTimerPresence_cr 0 +setstate rgr_Guests 2018-07-15 15:19:54 durTimerSleep 00:00:00 +setstate rgr_Guests 2018-07-15 15:19:54 durTimerSleep_cr 0 setstate rgr_Guests 2014-02-16 14:09:20 lastActivity none setstate rgr_Guests 2014-02-16 14:09:20 lastActivityBy Guests setstate rgr_Guests 2014-02-16 14:09:17 lastArrival 2014-02-16 14:09:17 @@ -166,6 +181,12 @@ setstate rgr_Guests 2014-02-16 14:09:20 residentsTotalPresent 0 setstate rgr_Guests 2014-02-15 16:16:27 residentsTotalWayhome 0 setstate rgr_Guests 2014-02-16 14:09:20 state none setstate rgr_Parents home +setstate rgr_Parents 2018-07-15 15:19:54 durTimerAbsence 00:00:00 +setstate rgr_Parents 2018-07-15 15:19:54 durTimerAbsence_cr 0 +setstate rgr_Parents 2018-07-15 15:30:38 durTimerPresence 38640:14:21 +setstate rgr_Parents 2018-07-15 15:30:38 durTimerPresence_cr 2318414 +setstate rgr_Parents 2018-07-15 15:19:54 durTimerSleep 00:00:00 +setstate rgr_Parents 2018-07-15 15:19:54 durTimerSleep_cr 0 setstate rgr_Parents 2015-01-04 16:19:19 lastActivity gone setstate rgr_Parents 2015-01-04 16:19:19 lastActivityBy Father setstate rgr_Parents 2014-02-16 14:16:17 lastArrival 2014-02-16 14:16:17 @@ -190,6 +211,12 @@ setstate rgr_Parents 2014-02-16 14:26:52 residentsTotalPresent 1 setstate rgr_Parents 2014-02-15 16:13:39 residentsTotalWayhome 0 setstate rgr_Parents 2014-02-16 14:16:17 state home setstate rgr_Residents home +setstate rgr_Residents 2018-07-15 15:19:54 durTimerAbsence 00:00:00 +setstate rgr_Residents 2018-07-15 15:19:54 durTimerAbsence_cr 0 +setstate rgr_Residents 2018-07-15 15:30:38 durTimerPresence 38640:14:21 +setstate rgr_Residents 2018-07-15 15:30:38 durTimerPresence_cr 2318414 +setstate rgr_Residents 2018-07-15 15:19:54 durTimerSleep 00:00:00 +setstate rgr_Residents 2018-07-15 15:19:54 durTimerSleep_cr 0 setstate rgr_Residents 2015-01-04 16:19:19 lastActivity gone setstate rgr_Residents 2015-01-04 16:19:19 lastActivityBy Son setstate rgr_Residents 2014-02-16 14:16:17 lastArrival 2014-02-16 14:16:17 @@ -216,8 +243,8 @@ setstate rgr_Residents 2014-02-16 14:16:17 state home setstate rr_Baby home setstate rr_Baby 2015-01-04 16:19:19 durTimerAbsence 00:00:00 setstate rr_Baby 2015-01-04 16:19:19 durTimerAbsence_cr 0 -setstate rr_Baby 2015-01-04 16:23:19 durTimerPresence 7729:52:58 -setstate rr_Baby 2015-01-04 16:23:19 durTimerPresence_cr 463793 +setstate rr_Baby 2018-07-15 15:30:38 durTimerPresence 38640:00:17 +setstate rr_Baby 2018-07-15 15:30:38 durTimerPresence_cr 2318400 setstate rr_Baby 2015-01-04 16:19:19 durTimerSleep 00:00:00 setstate rr_Baby 2015-01-04 16:19:19 durTimerSleep_cr 0 setstate rr_Baby 2014-02-16 14:30:21 lastArrival 2014-02-16 14:30:21 @@ -234,8 +261,8 @@ setstate rr_Baby 2014-02-16 14:30:21 presence present setstate rr_Baby 2014-02-17 20:45:12 state home setstate rr_Baby 2014-02-16 14:30:21 wayhome 0 setstate rr_Daughter gone -setstate rr_Daughter 2015-01-04 16:23:19 durTimerAbsence 7729:25:20 -setstate rr_Daughter 2015-01-04 16:23:19 durTimerAbsence_cr 463765 +setstate rr_Daughter 2018-07-15 15:30:38 durTimerAbsence 38639:32:39 +setstate rr_Daughter 2018-07-15 15:30:38 durTimerAbsence_cr 2318373 setstate rr_Daughter 2015-01-04 16:19:19 durTimerPresence 00:00:00 setstate rr_Daughter 2015-01-04 16:19:19 durTimerPresence_cr 0 setstate rr_Daughter 2015-01-04 16:19:19 durTimerSleep 00:00:00 @@ -256,8 +283,8 @@ setstate rr_Daughter 2014-02-16 14:57:59 presence absent setstate rr_Daughter 2015-01-04 16:19:19 state gone setstate rr_Daughter 2014-02-16 13:46:26 wayhome 0 setstate rr_Father gone -setstate rr_Father 2015-01-04 16:23:19 durTimerAbsence 7729:56:27 -setstate rr_Father 2015-01-04 16:23:19 durTimerAbsence_cr 463796 +setstate rr_Father 2018-07-15 15:30:38 durTimerAbsence 38640:03:46 +setstate rr_Father 2018-07-15 15:30:38 durTimerAbsence_cr 2318404 setstate rr_Father 2015-01-04 16:19:19 durTimerPresence 00:00:00 setstate rr_Father 2015-01-04 16:19:19 durTimerPresence_cr 0 setstate rr_Father 2015-01-04 16:19:19 durTimerSleep 00:00:00 @@ -277,8 +304,8 @@ setstate rr_Father 2014-02-16 13:46:02 wayhome 0 setstate rr_Mother home setstate rr_Mother 2015-01-04 16:19:19 durTimerAbsence 00:00:00 setstate rr_Mother 2015-01-04 16:19:19 durTimerAbsence_cr 0 -setstate rr_Mother 2015-01-04 16:23:19 durTimerPresence 7730:07:02 -setstate rr_Mother 2015-01-04 16:23:19 durTimerPresence_cr 463807 +setstate rr_Mother 2018-07-15 15:30:38 durTimerPresence 38640:14:21 +setstate rr_Mother 2018-07-15 15:30:38 durTimerPresence_cr 2318414 setstate rr_Mother 2015-01-04 16:19:19 durTimerSleep 00:00:00 setstate rr_Mother 2015-01-04 16:19:19 durTimerSleep_cr 0 setstate rr_Mother 2014-02-16 14:16:17 lastArrival 2014-02-16 14:16:17 @@ -294,8 +321,8 @@ setstate rr_Mother 2014-02-16 14:16:17 presence present setstate rr_Mother 2014-02-16 14:16:17 state home setstate rr_Mother 2014-02-16 13:46:09 wayhome 0 setstate rr_Son gone -setstate rr_Son 2015-01-04 16:23:19 durTimerAbsence 7729:25:18 -setstate rr_Son 2015-01-04 16:23:19 durTimerAbsence_cr 463765 +setstate rr_Son 2018-07-15 15:30:38 durTimerAbsence 38639:32:37 +setstate rr_Son 2018-07-15 15:30:38 durTimerAbsence_cr 2318373 setstate rr_Son 2015-01-04 16:19:19 durTimerPresence 00:00:00 setstate rr_Son 2015-01-04 16:19:19 durTimerPresence_cr 0 setstate rr_Son 2015-01-04 16:19:19 durTimerSleep 00:00:00 @@ -315,6 +342,8 @@ setstate rr_Son 2014-02-16 14:58:01 mood - setstate rr_Son 2014-02-16 14:58:01 presence absent setstate rr_Son 2015-01-04 16:19:19 state gone setstate rr_Son 2014-02-16 13:46:38 wayhome 0 -setstate sunRise Next: 07:45:49 -setstate sunSet Next: 17:14:06 +setstate sunRise Next: 04:50:28 +setstate sunRise 2018-07-15 15:27:23 state Next: 04:50:28 +setstate sunSet Next: 22:12:30 +setstate sunSet 2018-07-15 15:27:23 state Next: 22:12:30 setstate wlCinema initialized diff --git a/fhem/fhem.cfg.demo b/fhem/fhem.cfg.demo index 835a75d1f..d5de56d9e 100644 --- a/fhem/fhem.cfg.demo +++ b/fhem/fhem.cfg.demo @@ -1,15 +1,16 @@ -attr global userattr devStateIcon devStateStyle icon lightSceneParamsToSave lightSceneRestoreOnlyIfChanged:1,0 sortby structexclude webCmd widgetOverride +attr global userattr cmdIcon devStateIcon devStateStyle icon lightSceneParamsToSave lightSceneRestoreOnlyIfChanged:1,0 sortby structexclude webCmd webCmdLabel:textField-long widgetOverride attr global autoload_undefined_devices 1 +attr global autosave 0 attr global backup_before_update 0 attr global logfile - attr global modpath . -attr global motd FHEM demo version +attr global motd +attr global mseclog 1 attr global room System attr global sendStatistics never attr global statefile ./demolog/fhem.save attr global updateInBackground 1 attr global verbose 3 -attr global mseclog define telnetPort telnet 7072 global attr telnetPort room System @@ -17,26 +18,197 @@ attr telnetPort room System define WEB FHEMWEB 8083 global attr WEB JavaScripts codemirror/fhem_codemirror.js attr WEB defaultRoom Light -attr WEB hiddenroom DashboardRoom attr WEB iconPath openautomation:fhemSVG:default attr WEB room System attr WEB sortRooms Light Cinema Residents Sensors System - -define WEBphone FHEMWEB 8084 global -attr WEBphone hiddenroom DashboardRoom -attr WEBphone iconPath openautomation:fhemSVG:default -attr WEBphone room System -attr WEBphone sortRooms Light Cinema Residents Sensors System -attr WEBphone smallscreenCommands 1 -attr WEBphone stylesheetPrefix smallscreen - - -define WEBtablet FHEMWEB 8085 global -attr WEBtablet hiddenroom DashboardRoom -attr WEBtablet iconPath openautomation:fhemSVG:default -attr WEBtablet room System -attr WEBtablet sortRooms Light Cinema Residents Sensors System -attr WEBtablet stylesheetPrefix ios7touchpad +attr WEB styleData {\ + "f18": {\ + "Pinned.menu": true,\ + "cols.bg": "FFFFE7",\ + "cols.fg": "000000",\ + "cols.link": "278727",\ + "cols.evenrow": "F8F8E0",\ + "cols.oddrow": "F0F0D8",\ + "cols.header": "E0E0C8",\ + "cols.menu": "D7FFFF",\ + "cols.sel": "A0FFFF",\ + "cols.inpBack": "FFFFFF",\ + "savePinChanges": true,\ + "fixedInput": true,\ + "hidePin": true,\ + "showDragger": false,\ + "Pos.style_list_Styles": {\ + "left": 20,\ + "top": 0,\ + "width": 240,\ + "height": 260,\ + "oTop": 20,\ + "oLeft": 0\ + },\ + "Pos.style_list_f18_special": {\ + "left": 20,\ + "top": 280,\ + "width": 240,\ + "height": 140,\ + "oTop": 40,\ + "oLeft": 0\ + },\ + "Pos.style_list_f18__Room_specific": {\ + "left": 280,\ + "top": -20,\ + "width": 240,\ + "height": 400,\ + "oTop": 40,\ + "oLeft": 0\ + },\ + "Pos.Room_Light_grp_Color_Lights": {\ + "left": 0,\ + "top": 0,\ + "width": 860,\ + "height": 80,\ + "oTop": 21,\ + "oLeft": 1\ + },\ + "Pos.Room_Light_grp_Notify": {\ + "left": 420,\ + "top": 300,\ + "width": 440,\ + "height": 38,\ + "oTop": 41,\ + "oLeft": 1\ + },\ + "Pos.Room_Light_grp_Single_Lights": {\ + "left": 0,\ + "top": 100,\ + "width": 400,\ + "height": 240,\ + "oTop": 41,\ + "oLeft": 1\ + },\ + "Pos.Room_Light_grp_Structure": {\ + "left": 420,\ + "top": 220,\ + "width": 440,\ + "height": 38,\ + "oTop": 41,\ + "oLeft": 1\ + },\ + "Pos.Room_Light_grp_Timer": {\ + "left": 420,\ + "top": 100,\ + "width": 440,\ + "height": 78,\ + "oTop": 41,\ + "oLeft": 1\ + },\ + "snapToGrid": true,\ + "Pos.Room_Cinema_grp_AV": {\ + "left": 0,\ + "top": 0,\ + "width": 560,\ + "height": 120,\ + "oTop": 21,\ + "oLeft": 1\ + },\ + "Pos.Room_Cinema_grp_Control": {\ + "left": 0,\ + "top": 140,\ + "width": 560,\ + "height": 40,\ + "oTop": 41,\ + "oLeft": 1\ + },\ + "Pos.Room_Cinema_grp_Light": {\ + "left": 0,\ + "top": 220,\ + "width": 560,\ + "height": 78,\ + "oTop": 41,\ + "oLeft": 1\ + },\ + "Pos.Room_Cinema_grp_Scenes": {\ + "left": 0,\ + "top": 360,\ + "width": 560,\ + "height": 180,\ + "oTop": 24,\ + "oLeft": 0\ + },\ + "Pos.Room_Sensors_grp_FileLog": {\ + "left": 0,\ + "top": 0,\ + "width": 260,\ + "height": 120,\ + "oTop": 21,\ + "oLeft": 1\ + },\ + "Pos.Room_Sensors_grp_Helper": {\ + "left": 0,\ + "top": 140,\ + "width": 260,\ + "height": 20,\ + "oTop": 41,\ + "oLeft": 1\ + },\ + "Pos.Room_Sensors_grp_Sensors": {\ + "left": 0,\ + "top": 200,\ + "width": 260,\ + "height": 40,\ + "oTop": 41,\ + "oLeft": 1\ + },\ + "Pos.svgZoomControl": {\ + "left": 0,\ + "top": 300,\ + "width": 1040,\ + "height": 0,\ + "oTop": 0,\ + "oLeft": 0\ + },\ + "Pos.SVG_01_Garden": {\ + "left": 0,\ + "top": 500,\ + "width": 1040,\ + "height": 180,\ + "oTop": -164,\ + "oLeft": 0\ + },\ + "Pos.SVG_02_Cellar": {\ + "left": 0,\ + "top": 680,\ + "width": 1040,\ + "height": 180,\ + "oTop": -164,\ + "oLeft": 0\ + },\ + "Pos.SVG_03_Dewpoint": {\ + "left": 0,\ + "top": 860,\ + "width": 1040,\ + "height": 180,\ + "oTop": -164,\ + "oLeft": 0\ + },\ + "Pos.SVG_04_Sun": {\ + "left": 0,\ + "top": 1040,\ + "width": 1040,\ + "height": 180,\ + "oTop": -164,\ + "oLeft": 0\ + },\ + "Pos.SVG_05_Polar": {\ + "left": 280,\ + "top": 300,\ + "width": 1040,\ + "height": 320,\ + "oTop": -304,\ + "oLeft": 0\ + }\ + }\ +} +attr WEB stylesheetPrefix f18 # Fake FileLog entry, to access the fhem log from FHEMWEB define Logfile FileLog ./log/fhem-%Y-%m.log fakelog @@ -121,12 +293,12 @@ attr SVG_03_Dewpoint startDate 2013-08-13 define logProxy logProxy attr logProxy room System define SVG_04_Sun SVG logProxy:SVG_04_Sun:CURRENT -attr SVG_04_Sun room Sensors attr SVG_04_Sun fixedrange year +attr SVG_04_Sun room Sensors attr SVG_04_Sun title {"".logProxy_dec2hms($data{min1})." - ".logProxy_dec2hms($data{max1})." - ".logProxy_dec2hms($data{min2})." - ".logProxy_dec2hms($data{max2})} define SVG_05_Polar SVG logProxy:SVG_05_Polar:CURRENT -attr SVG_05_Polar room Sensors attr SVG_05_Polar plotsize 340,300 +attr SVG_05_Polar room Sensors define sunRise at *{sunrise()} set Office on attr sunRise group Timer @@ -189,20 +361,6 @@ attr lcCinema icon scene_scene attr lcCinema room Cinema attr lcCinema webCmd scene -define anyViews Dashboard -attr anyViews userattr dashboard_tab2backgroundimage dashboard_tab2colcount dashboard_tab2devices dashboard_tab2groups dashboard_tab2icon dashboard_tab2name dashboard_tab2rowcentercolwidth dashboard_tab2sorting -attr anyViews dashboard_colcount 2 -attr anyViews dashboard_row center -attr anyViews dashboard_rowcentercolwidth 50% -attr anyViews dashboard_tab1groups Home State,Light,AV,Single Lights,Color Lights -attr anyViews dashboard_tab1name Dashboard Demo -attr anyViews dashboard_tab1sorting t0c0,Single Lights,true,400,209,0,0:t0c0,AV,true,400,170,0,209:t0c1,Light,true,444,129,h84,0:t0c1,Home State,true,444,204,384,129: -attr anyViews room hidden -attr anyViews alias Dashboard Demo - -define anyViews_weblink weblink htmlCode {DashboardAsHtml("anyViews")} -attr anyViews_weblink room DashboardRoom - define rgr_Residents RESIDENTS attr rgr_Residents alias Residents attr rgr_Residents devStateIcon .*home:status_available:absent .*absent:status_away_1:home .*gone:status_standby:home .*none:control_building_empty .*gotosleep:status_night:asleep .*asleep:status_night:awoken .*awoken:status_available:home @@ -329,21 +487,7 @@ attr CT setFn {if( $CMD =~ m/on|off/ ) { $ARGS=$CMD;;$CMD = "state" } else {fhem attr CT setList on:noArg off:noArg ct:colorpicker,CT,2000,1,6500 attr CT webCmd ct::ct 2040:ct 2630:ct 3703:ct 6250:on:off -define -ignoreErr Weather Weather 673513 1800 de -attr Weather group Weather -attr Weather room Weather define Weather.weblink weblink htmlCode { WeatherAsHtmlH("Weather") } attr Weather.weblink alias Weather Forecast attr Weather.weblink room Weather - -define -ignoreErr Display RSS jpg localhost ./demolog/layout -attr Display room System -attr Display size 800x600 -attr Display bg ./demolog/pictures -attr Display tmin 15 -attr Display refresh 5 - -define rg readingsGroup TYPE=FHEMWEB -attr rg comment Workaround for the dashboard bug. -attr rg room hidden diff --git a/fhem/www/pgm2/f18.js b/fhem/www/pgm2/f18.js index e15a4695e..ffb4dcbcc 100644 --- a/fhem/www/pgm2/f18.js +++ b/fhem/www/pgm2/f18.js @@ -397,12 +397,12 @@ f18_resize() hi = f18_getAttr("hideInput"), pm = f18_getAttr("Pinned.menu"); - var diff = 0; - diff += hl ? 0 : 40; - diff += pm ? 0 : 44; - $("input.maininput") - .css("width", (w-(FW_isiOS ? 40 : 30)-diff)+'px') - .css("display", hi ? "none":"block"); + var left = 0; + left += hl ? 0 : 40; + left += pm ? 0 : 44; + $("input.maininput").css({ width:(w-left-(FW_isiOS ? 30 : 20))+'px', + display: hi ? "none":"block"}); + $("#hdr").css({ left:left+'px' }); $("#menu,#content").css("top", (hi && pm && hl) ? "10px" : "50px"); } diff --git a/fhem/www/pgm2/f18style.css b/fhem/www/pgm2/f18style.css index 2e21c2a36..cb76433a7 100644 --- a/fhem/www/pgm2/f18style.css +++ b/fhem/www/pgm2/f18style.css @@ -5,13 +5,14 @@ textarea, .ui-dialog.ui-widget textarea { font-family:Courier; } input,textarea { border-style:ridge; } #logo { - position:fixed; top:10px; left:52px; width:32px; height:32px; z-index:10; + position:absolute; top:10px; left:52px; width:32px; height:32px; z-index:10; background-image:url(../images/default/fhemicon.png); background-size: contain; background-repeat: no-repeat; } #menuBtn { top:10px; left:10px; width:32px; height:32px; } -#hdr { top:10px; right:10px; } -#content { top:50px; left:10px; bottom:10px; right:10px; } +#hdr { position:absolute; top:10px; left:48px; } +#content { position:absolute; top:50px; left:10px; bottom:10px; right:10px; } +body.small #content { left:10px; } #menu { top:50px; bottom:10px; left:-120%; z-index:20;