diff --git a/fhem/contrib/DS_Starter/49_SSCamSTRM.pm b/fhem/contrib/DS_Starter/49_SSCamSTRM.pm index 2ceea532a..2d19aef5d 100644 --- a/fhem/contrib/DS_Starter/49_SSCamSTRM.pm +++ b/fhem/contrib/DS_Starter/49_SSCamSTRM.pm @@ -26,29 +26,30 @@ # along with fhem. If not, see . # ######################################################################################################################### -# Versions History: -# -# 1.2.4 27.10.2018 Undefined subroutine &main::SSCam_ptzpanel -# 1.2.3 03.07.2018 behavior changed if device is disabled -# 1.2.2 26.06.2018 make changes for generic stream dev -# 1.2.1 23.06.2018 no name add-on if MODEL is snapgallery -# 1.2.0 20.06.2018 running stream as human readable entry for SSCamSTRM-Device -# 1.1.0 16.06.2018 attr hideDisplayName regarding to Forum #88667 -# 1.0.1 14.06.2018 commandref revised -# 1.0.0 14.06.2018 switch to longpoll refresh -# 0.4 13.06.2018 new attribute "noDetaillink" (deleted in V1.0.0) -# 0.3 12.06.2018 new attribute "forcePageRefresh" -# 0.2 11.06.2018 check in with SSCam 5.0.0 -# 0.1 10.06.2018 initial Version - package main; use strict; use warnings; -my $SSCamSTRMVersion = "1.2.4"; +# Versions History intern +our %SSCamSTRM_vNotesIntern = ( + "1.3.0" => "28.10.2018 direct help for attributes, new attribute \"autoLoop\" ", + "1.2.4" => "27.10.2018 fix undefined subroutine &main::SSCam_ptzpanel (https://forum.fhem.de/index.php/topic,45671.msg850505.html#msg850505) ", + "1.2.3" => "03.07.2018 behavior changed if device is disabled ", + "1.2.2" => "26.06.2018 make changes for generic stream dev ", + "1.2.1" => "23.06.2018 no name add-on if MODEL is snapgallery ", + "1.2.0" => "20.06.2018 running stream as human readable entry for SSCamSTRM-Device ", + "1.1.0" => "16.06.2018 attr hideDisplayName regarding to Forum #88667 ", + "1.0.1" => "14.06.2018 commandref revised ", + "1.0.0" => "14.06.2018 switch to longpoll refresh ", + "0.4.0" => "13.06.2018 new attribute \"noDetaillink\" (deleted in V1.0.0) ", + "0.3.0" => "12.06.2018 new attribute \"forcePageRefresh\" ", + "0.2.0" => "11.06.2018 check in with SSCam 5.0.0 ", + "0.1.0" => "10.06.2018 initial Version " +); +# Standardvariablen und Forward-Declaration sub SSCam_ptzpanel($;$$); sub SSCam_StreamDev($$$); @@ -57,7 +58,12 @@ sub SSCamSTRM_Initialize($) { my ($hash) = @_; $hash->{DefFn} = "SSCamSTRM_Define"; - $hash->{AttrList} = "disable:1,0 forcePageRefresh:1,0 htmlattr hideDisplayName:1,0 "; + $hash->{AttrList} = "autoLoop:selectnumbers,10,0.2,1800,0,log10 ". + "disable:1,0 ". + "forcePageRefresh:1,0 ". + "htmlattr ". + "hideDisplayName:1,0 " + ; $hash->{FW_summaryFn} = "SSCamSTRM_FwFn"; $hash->{FW_detailFn} = "SSCamSTRM_FwFn"; $hash->{AttrFn} = "SSCamSTRM_Attr"; @@ -80,7 +86,7 @@ sub SSCamSTRM_Define($$) { $arg =~ s/'//g; ($hash->{PARENT},$hash->{MODEL}) = ((split(",",$arg))[0],(split(",",$arg))[2]); - $hash->{VERSION} = $SSCamSTRMVersion; + $hash->{VERSION} = $hash->{VERSION} = (reverse sort(keys %SSCamSTRM_vNotesIntern))[0]; $hash->{LINK} = $link; readingsSingleUpdate($hash,"state", "initialized", 1); # Init für "state" @@ -112,13 +118,15 @@ return undef; } ################################################################ -sub SSCamSTRM_FwFn($$$$) { +sub SSCamSTRM_FwFn($;$$$) { my ($FW_wname, $d, $room, $pageHash) = @_; # pageHash is set for summaryFn. - my $hash = $defs{$d}; + my $hash; + if (ref($FW_wname) eq "HASH" ) { + $d = $FW_wname->{NAME}; + } + $hash = $defs{$d}; my $link = $hash->{LINK}; - # return undef if(IsDisabled($d)); - $link = AnalyzePerlCommand(undef, $link) if($link =~ m/^{(.*)}$/s); my $show = $defs{$hash->{PARENT}}->{HELPER}{ACTSTRM} if($hash->{MODEL} =~ /switched/); $show = $show?"($show)":""; @@ -137,6 +145,16 @@ sub SSCamSTRM_FwFn($$$$) { } else { $ret .= $link; } + + if($d) { + # Autoloop zur stabilen Anzeige in Anwendungen (z.B. Dashboard) + RemoveInternalTimer($hash); + my $al = AttrVal($d, "autoLoop", 0); + if($al) { + InternalTimer(gettimeofday()+$al, "SSCamSTRM_FwFn", $hash, 0); + Log3($d, 5, "$d - next start of autoLoop: ".FmtDateTime(gettimeofday()+$al)); + } + } return $ret; } @@ -196,30 +214,41 @@ Dependend of the Streaming-Device state, different buttons are provided to start