2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-21 20:06:18 +00:00

49_SSCam: V7.7.0, autocreateCams command added to SVS device, SSCamSTRM devices have get popupStream command, pls. execute "get <SSCam> versionNotes" for further info

git-svn-id: https://svn.fhem.de/fhem/trunk@17950 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2018-12-10 22:11:29 +00:00
parent 9a3a442c01
commit 103a4913ec
5 changed files with 511 additions and 297 deletions

View File

@ -1,5 +1,8 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # 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. # Do not insert empty lines here, update check depends on it.
- feature: 49_SSCam: V7.7.0, autocreateCams command added to SVS device,
SSCamSTRM devices have get popupStream command, pls.
execute "get <SSCam> versionNotes" for further info
- bugfix: 51_MOBILEALERTS.pm: Offlimit for decodeHumidityDecimal added - bugfix: 51_MOBILEALERTS.pm: Offlimit for decodeHumidityDecimal added
- change: 98_MSwitch.pm, update V2.07 - change: 98_MSwitch.pm, update V2.07
- change: 20_FRM_IN: only update on change (Forum #81815) - change: 20_FRM_IN: only update on change (Forum #81815)

File diff suppressed because it is too large Load Diff

View File

@ -34,6 +34,7 @@ use warnings;
# Versions History intern # Versions History intern
our %SSCamSTRM_vNotesIntern = ( our %SSCamSTRM_vNotesIntern = (
"2.0.0" => "09.12.2018 get command \"popupStream\" and attribute \"popupStreamFW\" ",
"1.5.0" => "02.12.2018 new attribute \"popupWindowSize\" ", "1.5.0" => "02.12.2018 new attribute \"popupWindowSize\" ",
"1.4.1" => "31.10.2018 attribute \"autoLoop\" changed to \"autoRefresh\", new attribute \"autoRefreshFW\" ", "1.4.1" => "31.10.2018 attribute \"autoLoop\" changed to \"autoRefresh\", new attribute \"autoRefreshFW\" ",
"1.4.0" => "29.10.2018 readingFnAttributes added ", "1.4.0" => "29.10.2018 readingFnAttributes added ",
@ -55,6 +56,7 @@ our %SSCamSTRM_vNotesIntern = (
# Standardvariablen und Forward-Declaration # Standardvariablen und Forward-Declaration
sub SSCam_ptzpanel($;$$); sub SSCam_ptzpanel($;$$);
sub SSCam_StreamDev($$$); sub SSCam_StreamDev($$$);
sub SSCam_getclhash($;$$);
################################################################ ################################################################
sub SSCamSTRM_Initialize($) { sub SSCamSTRM_Initialize($) {
@ -63,6 +65,7 @@ sub SSCamSTRM_Initialize($) {
my $fwd = join(",",devspec2array("TYPE=FHEMWEB:FILTER=STATE=Initialized")); my $fwd = join(",",devspec2array("TYPE=FHEMWEB:FILTER=STATE=Initialized"));
$hash->{DefFn} = "SSCamSTRM_Define"; $hash->{DefFn} = "SSCamSTRM_Define";
$hash->{GetFn} = "SSCamSTRM_Get";
$hash->{AttrList} = "autoRefresh:selectnumbers,120,0.2,1800,0,log10 ". $hash->{AttrList} = "autoRefresh:selectnumbers,120,0.2,1800,0,log10 ".
"autoRefreshFW:$fwd ". "autoRefreshFW:$fwd ".
"disable:1,0 ". "disable:1,0 ".
@ -70,6 +73,8 @@ sub SSCamSTRM_Initialize($) {
"htmlattr ". "htmlattr ".
"hideDisplayName:1,0 ". "hideDisplayName:1,0 ".
"popupWindowSize ". "popupWindowSize ".
"popupStreamFW:$fwd ".
"popupStreamTo:OK,1,2,3,4,5,6,7,8,9,10,15,20,25,30,40,50,60 ".
$readingFnAttributes; $readingFnAttributes;
$hash->{FW_summaryFn} = "SSCamSTRM_FwFn"; $hash->{FW_summaryFn} = "SSCamSTRM_FwFn";
$hash->{FW_detailFn} = "SSCamSTRM_FwFn"; $hash->{FW_detailFn} = "SSCamSTRM_FwFn";
@ -101,6 +106,59 @@ sub SSCamSTRM_Define($$) {
return undef; return undef;
} }
################################################################
sub SSCamSTRM_Get($@) {
my ($hash, @a) = @_;
return "\"set X\" needs at least an argument" if ( @a < 2 );
my $name = $a[0];
my $opt = $a[1];
my $prop = $a[2];
return if(IsDisabled($name) || $hash->{MODEL} =~ /ptzcontrol|snapgallery/);
my $getlist = "Unknown argument $opt, choose one of ".
"popupStream "
;
if ($opt eq "popupStream") {
my $txt = SSCam_getclhash($hash);
return $txt if($txt);
my $link = AnalyzePerlCommand(undef, $hash->{LINK}) if($hash->{LINK} =~ m/^{(.*)}$/s);
# OK-Dialogbox oder Autoclose
my $todef = 5;
my $temp = AttrVal($name, "popupStreamTo", $todef);
my $to = $prop?$prop:$temp;
unless ($to =~ /^\d+$/ || lc($to) eq "ok") { $to = $todef; }
$to = ($to =~ /\d+/)?(1000 * $to):$to;
my $pd = AttrVal($name, "popupStreamFW", "TYPE=FHEMWEB");
my $parent = $hash->{PARENT};
my $parentHash = $defs{$parent};
my $htmlCode = $hash->{HELPER}{STREAM};
if ($hash->{HELPER}{STREAMACTIVE}) {
my $out = "<html>";
$out .= $htmlCode;
$out .= "</html>";
if($to =~ /\d+/) {
map {FW_directNotify("#FHEMWEB:$_", "FW_errmsg('$out', $to)", "")} devspec2array("$pd");
} else {
map {FW_directNotify("#FHEMWEB:$_", "FW_okDialog('$out')", "")} devspec2array("$pd");
}
}
} else {
return "$getlist";
}
return;
}
################################################################ ################################################################
sub SSCamSTRM_Attr($$$$) { sub SSCamSTRM_Attr($$$$) {
my ($cmd,$name,$aName,$aVal) = @_; my ($cmd,$name,$aName,$aVal) = @_;
@ -121,6 +179,12 @@ sub SSCamSTRM_Attr($$$$) {
readingsSingleUpdate($hash, "state", $val, 1); readingsSingleUpdate($hash, "state", $val, 1);
} }
if ($cmd eq "set") {
if ($aName =~ m/popupStreamTo/) {
unless ($aVal =~ /^\d+$/ || $aVal eq "OK") { $_[3] = 5; }
}
}
return undef; return undef;
} }
@ -228,7 +292,23 @@ Dependend of the Streaming-Device state, different buttons are provided to start
<b>Set</b> <ul>N/A</ul><br> <b>Set</b> <ul>N/A</ul><br>
<a name="SSCamSTRMget"></a> <a name="SSCamSTRMget"></a>
<b>Get</b> <ul>N/A</ul><br> <b>Get</b>
<ul>
<ul>
<li><b>popupStream</b> <br>
The current streaming content is depicted in a popup window. By setting attribute "popupWindowSize" the
size of display can be adjusted. The attribute "popupStreamTo" determines the type of the popup window.
If "OK" is set, an OK-dialog window will be opened. A specified number in seconds closes the popup window after this
time automatically (default 5 seconds). <br>
Optionally you can append "OK" or &lt;seconds&gt; directly to override the adjustment by attribute "popupStreamTo".
</li>
</ul>
<br>
</ul>
<br>
<a name="SSCamSTRMattr"></a> <a name="SSCamSTRMattr"></a>
<b>Attributes</b> <b>Attributes</b>
@ -285,10 +365,32 @@ Dependend of the Streaming-Device state, different buttons are provided to start
</li> </li>
<br> <br>
<a name="popupStreamFW"></a>
<li><b>popupStreamFW</b><br>
You can specify a particular FHEMWEB device whose active browser pages should open a popup window by the
"get &lt;name&gt; popupStream" command (default: all active FHEMWEB devices).
</li>
<br>
<a name="popupStreamTo"></a>
<li><b>popupStreamTo [OK | &lt;seconds&gt;]</b><br>
The attribute "popupStreamTo" determines the type of the popup window which is opend by get-function "popupStream".
If "OK" is set, an OK-dialog window will be opened. A specified number in seconds closes the popup window after this
time automatically (default 5 seconds)..
<br><br>
<ul>
<b>Example: </b><br>
attr &lt;name&gt; popupStreamTo 10 <br>
</ul>
<br>
</li>
<a name="popupWindowSize"></a> <a name="popupWindowSize"></a>
<li><b>popupWindowSize</b><br> <li><b>popupWindowSize</b><br>
If the content of playback (Videostream or Snapshot gallery) is suitable, by clicking the content a popup window will appear. If the content of playback (Videostream or Snapshot gallery) is suitable, by clicking the content a popup window will
appear.
The size of display can be setup by this attribute. The size of display can be setup by this attribute.
It is also valid for the get-function "popupStream".
<br><br> <br><br>
<ul> <ul>
<b>Example: </b><br> <b>Example: </b><br>
@ -343,10 +445,27 @@ Abhängig vom Zustand des Streaming-Devices werden zum Start von Aktionen unters
<b>Set</b> <ul>N/A</ul><br> <b>Set</b> <ul>N/A</ul><br>
<a name="SSCamSTRMget"></a> <a name="SSCamSTRMget"></a>
<b>Get</b> <ul>N/A</ul><br> <b>Get</b>
<ul>
<ul>
<li><b>popupStream [OK | &lt;Sekunden&gt;]</b> <br>
Der aktuelle Streaminhalt wird in einem Popup-Fenster dargestellt. Mit dem Attribut "popupWindowSize" kann die
Darstellungsgröße eingestellt werden. Das Attribut "popupStreamTo" legt die Art des Popup-Fensters fest.
Ist "OK" eingestellt, öffnet sich ein OK-Dialogfenster. Die angegebene Zahl in Sekunden schließt das Fenster nach dieser
Zeit automatisch (default 5 Sekunden). <br>
Durch die optionalen Angabe von "OK" oder &lt;Sekunden&gt; kann die Einstellung des Attributes "popupStreamTo" übersteuert
werden.
</li>
</ul>
<br>
</ul>
<br>
<a name="SSCamSTRMattr"></a> <a name="SSCamSTRMattr"></a>
<b>Attributes</b> <b>Attribute</b>
<br><br> <br><br>
<ul> <ul>
@ -400,10 +519,31 @@ Abhängig vom Zustand des Streaming-Devices werden zum Start von Aktionen unters
</li> </li>
<br> <br>
<a name="popupStreamFW"></a>
<li><b>popupStreamFW</b><br>
Es kann mit diesem Attribut das FHEMWEB-Device bestimmt werden, auf dessen Browserseiten sich Popup-Fenster mit
"get &lt;name&gt; popupStream" öffnen sollen (default: alle aktiven FHEMWEB-Devices).
</li>
<br>
<a name="popupStreamTo"></a>
<li><b>popupStreamTo [OK | &lt;Sekunden&gt;]</b><br>
Das Attribut "popupStreamTo" legt die Art des Popup-Fensters fest welches mit der get-Funktion "popupStream" geöffnet wird.
Ist "OK" eingestellt, öffnet sich ein OK-Dialogfenster. Die angegebene Zahl in Sekunden schließt das Fenster nach dieser
Zeit automatisch (default 5 Sekunden).
<br><br>
<ul>
<b>Beispiel: </b><br>
attr &lt;name&gt; popupStreamTo 10 <br>
</ul>
<br>
</li>
<a name="popupWindowSize"></a> <a name="popupWindowSize"></a>
<li><b>popupWindowSize</b><br> <li><b>popupWindowSize</b><br>
Bei geeigneten Wiedergabeinhalten (Videostream oder Schnappschußgalerie) öffnet ein Klick auf den Bildinhalt ein Bei geeigneten Wiedergabeinhalten (Videostream oder Schnappschußgalerie) öffnet ein Klick auf den Bildinhalt ein
Popup-Fenster mit diesem Inhalt. Die Darstellungsgröße kann mit diesem Attribut eingestellt werden. Popup-Fenster mit diesem Inhalt. Die Darstellungsgröße kann mit diesem Attribut eingestellt werden.
Das Attribut gilt ebenfalls für die get-Funktion "popupStream".
<br><br> <br><br>
<ul> <ul>
<b>Beispiel: </b><br> <b>Beispiel: </b><br>

View File

@ -45,8 +45,8 @@ use HttpUtils;
# Versions History intern # Versions History intern
our %SSCam_vNotesIntern = ( our %SSCam_vNotesIntern = (
"7.7.0" => "07.12.2018 SVS-Device: autocreateCams command added, some other fixes and improvements, minor code rewrite, ". "7.7.0" => "10.12.2018 SVS-Device: autocreateCams command added, some other fixes and improvements, minor code rewrite, ".
"save Stream \$streamHash->{HELPER}{STREAM} for popupStream in SSCamSTRM-Device ", "save Stream in \$streamHash->{HELPER}{STREAM} for popupStream in SSCamSTRM-Device ",
"7.6.0" => "02.12.2018 sub SSCam_ptzpanel completed by Preset and Patrol, minor fixes ", "7.6.0" => "02.12.2018 sub SSCam_ptzpanel completed by Preset and Patrol, minor fixes ",
"7.5.0" => "02.12.2018 sub SSCam_StreamDev and SSCam_composegallery changed to use popup window ", "7.5.0" => "02.12.2018 sub SSCam_StreamDev and SSCam_composegallery changed to use popup window ",
"7.4.1" => "26.11.2018 sub composegallery deleted, SSCam_composegallery changed to get information for SSCam_refresh ", "7.4.1" => "26.11.2018 sub composegallery deleted, SSCam_composegallery changed to get information for SSCam_refresh ",
@ -99,7 +99,7 @@ our %SSCam_vNotesIntern = (
# Versions History extern # Versions History extern
our %SSCam_vNotesExtern = ( our %SSCam_vNotesExtern = (
"7.7.0" => "07.12.2018 autocreateCams command added in SVS device. By this command all cameras installed in SVS can be ". "7.7.0" => "10.12.2018 autocreateCams command added to SVS device. By this command all cameras installed in SVS can be ".
"defined automatically. <br>". "defined automatically. <br>".
"In SSCamSTRM devices the \"get &lt;name&gt; popupStream\" command is implemented which may open a popup window with the ". "In SSCamSTRM devices the \"get &lt;name&gt; popupStream\" command is implemented which may open a popup window with the ".
"active streaming content. ", "active streaming content. ",
@ -6266,7 +6266,7 @@ sub SSCam_StreamDev($$$) {
my $ha = AttrVal($camname, "htmlattr", 'width="500" height="325"'); # HTML Attribute der Cam my $ha = AttrVal($camname, "htmlattr", 'width="500" height="325"'); # HTML Attribute der Cam
$ha = AttrVal($strmdev, "htmlattr", $ha); # htmlattr mit htmattr Streaming-Device übersteuern $ha = AttrVal($strmdev, "htmlattr", $ha); # htmlattr mit htmattr Streaming-Device übersteuern
my $pws = AttrVal($strmdev, "popupWindowSize", ""); # Größe eines Popups my $pws = AttrVal($strmdev, "popupWindowSize", ""); # Größe eines Popups
$pws =~ s/"//g if($pws); $pws =~ s/"//g if($pws);
my $StmKey = ReadingsVal($camname,"StmKey",undef); my $StmKey = ReadingsVal($camname,"StmKey",undef);
$ret = ""; $ret = "";
@ -6344,8 +6344,12 @@ sub SSCam_StreamDev($$$) {
$ret .= "<td>"; $ret .= "<td>";
$ret .= "$htag"; $ret .= "$htag";
$streamHash->{HELPER}{STREAM} = "$htag"; # Stream für "get <SSCamSTRM-Device> popupStream" speichern if($htag) {
$streamHash->{HELPER}{STREAMACTIVE} = 1 if($htag); # Statusbit wenn ein Stream aktiviert ist $streamHash->{HELPER}{STREAM} = "$htag"; # Stream für "get <SSCamSTRM-Device> popupStream" speichern
$streamHash->{HELPER}{STREAM} =~ s/["']//g;
$streamHash->{HELPER}{STREAM} =~ s/\s+/ /g;
$streamHash->{HELPER}{STREAMACTIVE} = 1; # Statusbit wenn ein Stream aktiviert ist
}
$ret .= "<br>"; $ret .= "<br>";
Log3($strmdev, 4, "$strmdev - generic Stream params:\n$htag"); Log3($strmdev, 4, "$strmdev - generic Stream params:\n$htag");
$ret .= "<a onClick=\"FW_cmd('$FW_ME$FW_subdir?XHR=1&$cmdrefresh')\">$imgrefresh </a>"; $ret .= "<a onClick=\"FW_cmd('$FW_ME$FW_subdir?XHR=1&$cmdrefresh')\">$imgrefresh </a>";

View File

@ -34,7 +34,7 @@ use warnings;
# Versions History intern # Versions History intern
our %SSCamSTRM_vNotesIntern = ( our %SSCamSTRM_vNotesIntern = (
"2.0.0" => "09.12.2018 get command \"popupStream\" ", "2.0.0" => "09.12.2018 get command \"popupStream\" and attribute \"popupStreamFW\" ",
"1.5.0" => "02.12.2018 new attribute \"popupWindowSize\" ", "1.5.0" => "02.12.2018 new attribute \"popupWindowSize\" ",
"1.4.1" => "31.10.2018 attribute \"autoLoop\" changed to \"autoRefresh\", new attribute \"autoRefreshFW\" ", "1.4.1" => "31.10.2018 attribute \"autoLoop\" changed to \"autoRefresh\", new attribute \"autoRefreshFW\" ",
"1.4.0" => "29.10.2018 readingFnAttributes added ", "1.4.0" => "29.10.2018 readingFnAttributes added ",