mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
49_SSCam: contrib 9.4.0
git-svn-id: https://svn.fhem.de/fhem/trunk@22314 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1a24313cec
commit
47f3671634
@ -156,7 +156,7 @@ BEGIN {
|
||||
|
||||
# Versions History intern
|
||||
my %vNotesIntern = (
|
||||
"9.4.0" => "26.06.2020 change to packages ",
|
||||
"9.4.0" => "26.06.2020 change to packages, changes for PBP ",
|
||||
"9.3.0" => "21.06.2020 SVS device 'inctive' if disabled, add zoom capability, much more internal code changes ",
|
||||
"9.2.3" => "30.05.2020 change SSChatBot_formText to SSChatBot_formString ",
|
||||
"9.2.2" => "14.04.2020 increase read timeout of Redis server cache, fix autocreate bug with https ",
|
||||
@ -465,9 +465,9 @@ my %imc = ( # di
|
||||
|
||||
my %zd = ( # Hash der Zoomsteuerung
|
||||
".++" => {dir => "in", sttime => 6, moveType => "Start", panimg => "Zoom_in_wide.png", },
|
||||
"+" => {dir => "in", sttime => 0.5, moveType => "Start", panimg => "Zoom_in.png", },
|
||||
"stop" => {dir => undef, sttime => undef, moveType => "Stop" , panimg => undef, },
|
||||
"-" => {dir => "out", sttime => 0.5, moveType => "Start", panimg => "Zoom_out.png", },
|
||||
"+" => {dir => "in", sttime => 0.5, moveType => "Start", panimg => "Zoom_in.png", },
|
||||
"stop" => {dir => undef, sttime => undef, moveType => "Stop" , panimg => undef, },
|
||||
"-" => {dir => "out", sttime => 0.5, moveType => "Start", panimg => "Zoom_out.png", },
|
||||
"--." => {dir => "out", sttime => 6, moveType => "Start", panimg => "Zoom_out_wide.png", }
|
||||
);
|
||||
|
||||
@ -7561,13 +7561,13 @@ sub ptzPanel {
|
||||
|
||||
$ptz_ret .= '<table class="rc_body defsize">';
|
||||
$ptz_ret .= "<tr>";
|
||||
$ptz_ret .= "<td class='ptzcontrol pcenter'; colspan=4>";
|
||||
$ptz_ret .= 'Zoom: ';
|
||||
$ptz_ret .= "</td>";
|
||||
$ptz_ret .= "</tr>";
|
||||
$ptz_ret .= "<tr>";
|
||||
#$ptz_ret .= "<td class='ptzcontrol pcenter'; colspan=4>";
|
||||
#$ptz_ret .= 'Zoom: ';
|
||||
#$ptz_ret .= "</td>";
|
||||
#$ptz_ret .= "</tr>";
|
||||
#$ptz_ret .= "<tr>";
|
||||
|
||||
my @za = qw(.++ + - --.);
|
||||
my @za = qw(.++ + Zoom - --.);
|
||||
|
||||
for my $cmd (@za) {
|
||||
$ptz_ret .= "<td class='ptzcontrol'>";
|
||||
@ -7576,8 +7576,6 @@ sub ptzPanel {
|
||||
if(!$img) {
|
||||
$ptz_ret .= $cmd;
|
||||
$ptz_ret .= "</td>";
|
||||
$ptz_ret .= "</tr>";
|
||||
$ptz_ret .= "<tr>";
|
||||
next;
|
||||
}
|
||||
|
||||
@ -7586,7 +7584,7 @@ sub ptzPanel {
|
||||
|
||||
} else { # $FW_ME = URL-Pfad unter dem der FHEMWEB-Server via HTTP erreichbar ist, z.B. /fhem
|
||||
my $iPath = FW_iconPath($img);
|
||||
Log3($name, 2, "$name - IconPath $img: $iPath");
|
||||
|
||||
if($ftui) {
|
||||
$img = "<img src=\"$FW_ME/$FW_icondir/$iPath\" height=\"$pbsf%\" width=\"$pbsf%\">";
|
||||
} else {
|
||||
|
@ -33,7 +33,7 @@ use strict;
|
||||
use warnings;
|
||||
use GPUtils qw(GP_Import GP_Export); # wird für den Import der FHEM Funktionen aus der fhem.pl benötigt
|
||||
use Time::HiRes qw(gettimeofday);
|
||||
eval "use FHEM::Meta;1" or my $modMetaAbsent = 1;
|
||||
eval "use FHEM::Meta;1" or my $modMetaAbsent = 1; ## no critic 'eval'
|
||||
|
||||
# Run before module compilation
|
||||
BEGIN {
|
||||
@ -132,6 +132,8 @@ my %SSCAM_imc = ( # di
|
||||
1 => { 0 => "off", 1 => "inactive" },
|
||||
);
|
||||
|
||||
my $todef = 5; # Default Popup Zeit für set <> popupStream
|
||||
|
||||
################################################################
|
||||
sub Initialize {
|
||||
my $hash = shift;
|
||||
@ -168,7 +170,7 @@ sub Initialize {
|
||||
# $hash->{FW_addDetailToSummary} = 1;
|
||||
# $hash->{FW_atPageEnd} = 1; # wenn 1 -> kein Longpoll ohne informid in HTML-Tag
|
||||
|
||||
eval { FHEM::Meta::InitMod( __FILE__, $hash ) }; # für Meta.pm (https://forum.fhem.de/index.php/topic,97589.0.html)
|
||||
eval { FHEM::Meta::InitMod( __FILE__, $hash ) }; ## no critic 'eval' # für Meta.pm (https://forum.fhem.de/index.php/topic,97589.0.html)
|
||||
|
||||
return;
|
||||
}
|
||||
@ -184,7 +186,7 @@ sub Define {
|
||||
return "Usage: define <name> SSCamSTRM <arg>";
|
||||
}
|
||||
|
||||
$link = upgradeFunc($hash,$link);
|
||||
$link = migrateFunc($hash,$link);
|
||||
|
||||
explodeDEF ($hash,$link);
|
||||
|
||||
@ -201,9 +203,9 @@ return;
|
||||
}
|
||||
|
||||
################################################################
|
||||
# im DEF hinterlegte Funktionen vor SSCam V9.4.0 upgraden
|
||||
# im DEF hinterlegte Funktionen vor SSCam V9.4.0 migrieren
|
||||
################################################################
|
||||
sub upgradeFunc {
|
||||
sub migrateFunc {
|
||||
my $hash = shift;
|
||||
my $link = shift;
|
||||
|
||||
@ -220,7 +222,7 @@ return $link;
|
||||
# passt die Deviceparameter bei kopierten / umbenennen an
|
||||
###############################################################
|
||||
sub Rename {
|
||||
my $new_name = shift;
|
||||
my $new_name = shift;
|
||||
my $old_name = shift;
|
||||
my $hash = $defs{$new_name} // return;
|
||||
|
||||
@ -231,7 +233,7 @@ return;
|
||||
}
|
||||
|
||||
sub Copy {
|
||||
my $old_name = shift;
|
||||
my $old_name = shift;
|
||||
my $new_name = shift;
|
||||
my $hash = $defs{$new_name} // return;
|
||||
|
||||
@ -249,31 +251,28 @@ sub Set {
|
||||
my $opt = $a[1];
|
||||
my $prop = $a[2];
|
||||
|
||||
return if(IsDisabled($name) || $hash->{MODEL} =~ /ptzcontrol|snapgallery/);
|
||||
return if(IsDisabled($name) || $hash->{MODEL} =~ /ptzcontrol|snapgallery/x);
|
||||
|
||||
my $setlist = "Unknown argument $opt, choose one of ".
|
||||
"popupStream "
|
||||
"popupStream "
|
||||
;
|
||||
|
||||
if ($opt eq "popupStream") {
|
||||
my $txt = FHEM::SSCam::getClHash($hash);
|
||||
my $txt = FHEM::SSCam::getClHash($hash);
|
||||
return $txt if($txt);
|
||||
|
||||
my $link = AnalyzePerlCommand(undef, $hash->{LINK});
|
||||
|
||||
# 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 $temp = AttrVal($name, "popupStreamTo", $todef);
|
||||
my $to = $prop // $temp;
|
||||
unless ($to =~ /^\d+$/x || lc($to) eq "ok") { $to = $todef; }
|
||||
$to = ($to =~ /\d+/x) ? (1000 * $to) : $to;
|
||||
|
||||
my $pd = AttrVal($name, "popupStreamFW", "TYPE=FHEMWEB");
|
||||
|
||||
my $parent = $hash->{PARENT};
|
||||
my $pd = AttrVal($name, "popupStreamFW", "TYPE=FHEMWEB");
|
||||
my $parent = $hash->{PARENT};
|
||||
my $parentHash = $defs{$parent};
|
||||
|
||||
my $htmlCode = $hash->{HELPER}{STREAM};
|
||||
my $htmlCode = $hash->{HELPER}{STREAM};
|
||||
|
||||
if ($hash->{HELPER}{STREAMACTIVE}) {
|
||||
my $out = "<html>";
|
||||
@ -282,12 +281,12 @@ sub Set {
|
||||
|
||||
Log3($name, 4, "$name - Stream to display: $htmlCode");
|
||||
Log3($name, 4, "$name - Stream display to webdevice: $pd");
|
||||
|
||||
if($to =~ /\d+/) {
|
||||
map {FW_directNotify("#FHEMWEB:$_", "FW_errmsg('$out', $to)", "")} devspec2array("$pd");
|
||||
|
||||
if($to =~ /\d+/x) {
|
||||
map {FW_directNotify("#FHEMWEB:$_", "FW_errmsg('$out', $to)", "")} devspec2array("$pd"); ## no critic 'void context';
|
||||
} else {
|
||||
map {FW_directNotify("#FHEMWEB:$_", "FW_okDialog('$out')", "")} devspec2array("$pd");
|
||||
}
|
||||
map {FW_directNotify("#FHEMWEB:$_", "FW_okDialog('$out')", "")} devspec2array("$pd"); ## no critic 'void context';
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -314,8 +313,7 @@ sub Get {
|
||||
return streamAsHtml($hash,"ftui");
|
||||
}
|
||||
|
||||
return undef;
|
||||
return "Unknown argument $cmd, choose one of html:noArg";
|
||||
return;
|
||||
}
|
||||
|
||||
################################################################
|
||||
@ -333,7 +331,7 @@ sub Attr {
|
||||
$do = ($aVal) ? 1 : 0;
|
||||
}
|
||||
$do = 0 if($cmd eq "del");
|
||||
$val = ($do == 1 ? "disabled" : "initialized");
|
||||
$val = ($do == 1 ? "disabled" : "initialized");
|
||||
|
||||
readingsSingleUpdate($hash, "state", $val, 1);
|
||||
}
|
||||
@ -343,12 +341,12 @@ sub Attr {
|
||||
}
|
||||
|
||||
if ($cmd eq "set") {
|
||||
if ($aName =~ m/popupStreamTo/) {
|
||||
unless ($aVal =~ /^\d+$/ || $aVal eq "OK") { $_[3] = 5; }
|
||||
if ($aName =~ m/popupStreamTo/x) {
|
||||
unless ($aVal =~ /^\d+$/x || $aVal eq "OK") { return qq{The Value for $aName is not valid. Use only figures 0-9 or "OK" !}; }
|
||||
}
|
||||
}
|
||||
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
|
||||
#############################################################################################
|
||||
@ -362,7 +360,7 @@ sub FwFn {
|
||||
RemoveInternalTimer($hash);
|
||||
$hash->{HELPER}{FW} = $FW_wname;
|
||||
|
||||
$link = AnalyzePerlCommand(undef, $link) if($link =~ m/^{(.*)}$/s);
|
||||
$link = AnalyzePerlCommand(undef, $link) if($link =~ m/^{(.*)}$/xs);
|
||||
|
||||
my $ret = "";
|
||||
if(IsDisabled($name)) {
|
||||
@ -392,10 +390,9 @@ return $ret;
|
||||
sub explodeDEF {
|
||||
my $hash = shift;
|
||||
my $link = shift;
|
||||
my $d = $hash->{NAME};
|
||||
|
||||
my $arg = (split("[()]",$link))[1];
|
||||
$arg =~ s/'//g;
|
||||
$arg =~ s/'//xg;
|
||||
($hash->{PARENT},undef,$hash->{MODEL}) = split(",",$arg);
|
||||
|
||||
return;
|
||||
@ -407,15 +404,15 @@ return;
|
||||
#############################################################################################
|
||||
sub webRefresh {
|
||||
my $hash = shift;
|
||||
my $d = $hash->{NAME};
|
||||
my $name = $hash->{NAME};
|
||||
|
||||
my $rd = AttrVal($d, "autoRefreshFW", $hash->{HELPER}{FW});
|
||||
{ map { FW_directNotify("#FHEMWEB:$_", "location.reload('true')", "") } $rd }
|
||||
my $rd = AttrVal($name, "autoRefreshFW", $hash->{HELPER}{FW});
|
||||
{ map { FW_directNotify("#FHEMWEB:$_", "location.reload('true')", "") } $rd } ## no critic 'void context';
|
||||
|
||||
my $al = AttrVal($d, "autoRefresh", 0);
|
||||
my $al = AttrVal($name, "autoRefresh", 0);
|
||||
if($al) {
|
||||
InternalTimer(gettimeofday()+$al, "FHEM::SSCamSTRM::webRefresh", $hash, 0);
|
||||
Log3($d, 5, "$d - next start of autoRefresh: ".FmtDateTime(gettimeofday()+$al));
|
||||
Log3($name, 5, "$name - next start of autoRefresh: ".FmtDateTime(gettimeofday()+$al));
|
||||
} else {
|
||||
RemoveInternalTimer($hash);
|
||||
}
|
||||
@ -437,22 +434,22 @@ sub setVersionInfo {
|
||||
$hash->{HELPER}{VERSION} = $v;
|
||||
|
||||
if($modules{$type}{META}{x_prereqs_src} && !$hash->{HELPER}{MODMETAABSENT}) {
|
||||
# META-Daten sind vorhanden
|
||||
$modules{$type}{META}{version} = "v".$v; # Version aus META.json überschreiben, Anzeige mit {Dumper $modules{SSCamSTRM}{META}}
|
||||
if($modules{$type}{META}{x_version}) { # {x_version} ( nur gesetzt wenn $Id: 49_SSCamSTRM.pm 22267 2020-06-25 21:07:13Z DS_Starter $ im Kopf komplett! vorhanden )
|
||||
# META-Daten sind vorhanden
|
||||
$modules{$type}{META}{version} = "v".$v; # Version aus META.json überschreiben, Anzeige mit {Dumper $modules{SSCamSTRM}{META}}
|
||||
if($modules{$type}{META}{x_version}) { # {x_version} ( nur gesetzt wenn $Id: 49_SSCamSTRM.pm 22267 2020-06-25 21:07:13Z DS_Starter $ im Kopf komplett! vorhanden )
|
||||
$modules{$type}{META}{x_version} =~ s/1\.1\.1/$v/gx;
|
||||
} else {
|
||||
$modules{$type}{META}{x_version} = $v;
|
||||
}
|
||||
return $@ unless (FHEM::Meta::SetInternals($hash)); # FVERSION wird gesetzt ( nur gesetzt wenn $Id: 49_SSCamSTRM.pm 22267 2020-06-25 21:07:13Z DS_Starter $ im Kopf komplett! vorhanden )
|
||||
if(__PACKAGE__ eq "FHEM::$type" || __PACKAGE__ eq $type) {
|
||||
# es wird mit Packages gearbeitet -> Perl übliche Modulversion setzen
|
||||
# mit {<Modul>->VERSION()} im FHEMWEB kann Modulversion abgefragt werden
|
||||
} else {
|
||||
$modules{$type}{META}{x_version} = $v;
|
||||
}
|
||||
return $@ unless (FHEM::Meta::SetInternals($hash)); # FVERSION wird gesetzt ( nur gesetzt wenn $Id: 49_SSCamSTRM.pm 22267 2020-06-25 21:07:13Z DS_Starter $ im Kopf komplett! vorhanden )
|
||||
if(__PACKAGE__ eq "FHEM::$type" || __PACKAGE__ eq $type) {
|
||||
# es wird mit Packages gearbeitet -> Perl übliche Modulversion setzen
|
||||
# mit {<Modul>->VERSION()} im FHEMWEB kann Modulversion abgefragt werden
|
||||
use version 0.77; our $VERSION = FHEM::Meta::Get( $hash, 'version' ); ## no critic 'VERSION'
|
||||
}
|
||||
} else {
|
||||
# herkömmliche Modulstruktur
|
||||
$hash->{VERSION} = $v;
|
||||
# herkömmliche Modulstruktur
|
||||
$hash->{VERSION} = $v;
|
||||
}
|
||||
|
||||
return;
|
||||
@ -471,7 +468,7 @@ sub streamAsHtml {
|
||||
$link = $s.",'$ftui')}";
|
||||
}
|
||||
|
||||
$link = AnalyzePerlCommand(undef, $link) if($link =~ m/^{(.*)}$/s);
|
||||
$link = AnalyzePerlCommand(undef, $link) if($link =~ m/^{(.*)}$/xs);
|
||||
|
||||
my $ret = "<html>";
|
||||
if(IsDisabled($name)) {
|
||||
@ -482,7 +479,7 @@ sub streamAsHtml {
|
||||
}
|
||||
|
||||
} else {
|
||||
$ret .= $link;
|
||||
$ret .= $link;
|
||||
}
|
||||
|
||||
$ret .= "</html>";
|
||||
@ -618,7 +615,7 @@ return $ret;
|
||||
<br><br>
|
||||
|
||||
<ul>
|
||||
<b>Examples:</b>
|
||||
<b>Examples:</b>
|
||||
<pre>
|
||||
attr <name> genericStrmHtmlTag <video $HTMLATTR controls autoplay>
|
||||
<source src='http://192.168.2.10:32000/$NAME.m3u8' type='application/x-mpegURL'>
|
||||
@ -767,7 +764,7 @@ attr <name> genericStrmHtmlTag <img $HTMLATTR
|
||||
|
||||
<b>Integration in FHEM TabletUI: </b> <br><br>
|
||||
Zur Integration von SSCam Streaming Devices (Typ SSCamSTRM) wird ein Widget bereitgestellt.
|
||||
Für weitere Information dazu bitte den Artikel im Wiki durchlesen: <br>
|
||||
Für weitere Information dazu bitte den Artikel im Wiki durchlesen: <br>
|
||||
<a href="https://wiki.fhem.de/wiki/FTUI_Widget_f%C3%BCr_SSCam_Streaming_Devices_(SSCamSTRM)">FTUI Widget für SSCam Streaming Devices (SSCamSTRM)</a>.
|
||||
<br><br><br>
|
||||
</ul>
|
||||
@ -861,7 +858,7 @@ attr <name> genericStrmHtmlTag <img $HTMLATTR
|
||||
<br><br>
|
||||
|
||||
<ul>
|
||||
<b>Beispiele:</b>
|
||||
<b>Beispiele:</b>
|
||||
<pre>
|
||||
attr <name> genericStrmHtmlTag <video $HTMLATTR controls autoplay>
|
||||
<source src='http://192.168.2.10:32000/$NAME.m3u8' type='application/x-mpegURL'>
|
||||
|
Loading…
Reference in New Issue
Block a user