mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
49_SSCam / 49_SSCamSTRM: switch to packages, changes according PBP
git-svn-id: https://svn.fhem.de/fhem/trunk@22329 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d567d45247
commit
cb2e5d217f
@ -1,5 +1,6 @@
|
|||||||
# 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.
|
||||||
|
- change: 49_SSCam / 49_SSCamSTRM: switch to packages, changes according PBP
|
||||||
- bugfix: 73_AutoShuttersControl: fix commandref and bug in shading function
|
- bugfix: 73_AutoShuttersControl: fix commandref and bug in shading function
|
||||||
change code
|
change code
|
||||||
- feature: 76_SMAPortal: statistics data provider of Month, Year and Total
|
- feature: 76_SMAPortal: statistics data provider of Month, Year and Total
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -33,7 +33,7 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use GPUtils qw(GP_Import GP_Export); # wird für den Import der FHEM Funktionen aus der fhem.pl benötigt
|
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);
|
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
|
# Run before module compilation
|
||||||
BEGIN {
|
BEGIN {
|
||||||
@ -62,9 +62,10 @@ BEGIN {
|
|||||||
FW_cmd
|
FW_cmd
|
||||||
FW_directNotify
|
FW_directNotify
|
||||||
FW_wname
|
FW_wname
|
||||||
SSCam_ptzpanel
|
FHEM::SSCam::ptzPanel
|
||||||
SSCam_StreamDev
|
FHEM::SSCam::streamDev
|
||||||
SSCam_getclhash
|
FHEM::SSCam::composeGallery
|
||||||
|
FHEM::SSCam::getClHash
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -86,6 +87,7 @@ BEGIN {
|
|||||||
|
|
||||||
# Versions History intern
|
# Versions History intern
|
||||||
my %vNotesIntern = (
|
my %vNotesIntern = (
|
||||||
|
"2.12.0" => "28.06.2020 upgrade SSCam functions due to SSCam switch to packages ",
|
||||||
"2.11.0" => "24.06.2020 switch to packages, changes according to PBP ",
|
"2.11.0" => "24.06.2020 switch to packages, changes according to PBP ",
|
||||||
"2.10.2" => "08.11.2019 undef \$link in FwFn / streamAsHtml to save memory ",
|
"2.10.2" => "08.11.2019 undef \$link in FwFn / streamAsHtml to save memory ",
|
||||||
"2.10.1" => "18.10.2019 set parentState initial in Define, Forum: https://forum.fhem.de/index.php/topic,45671.msg985136.html#msg985136 ",
|
"2.10.1" => "18.10.2019 set parentState initial in Define, Forum: https://forum.fhem.de/index.php/topic,45671.msg985136.html#msg985136 ",
|
||||||
@ -119,6 +121,18 @@ my %vNotesIntern = (
|
|||||||
"0.1.0" => "10.06.2018 initial Version "
|
"0.1.0" => "10.06.2018 initial Version "
|
||||||
);
|
);
|
||||||
|
|
||||||
|
my %fupgrade = ( # Funktionsupgrade in SSCamSTRM devices definiert vor SSCam Version 9.4.0
|
||||||
|
1 => { of => "SSCam_ptzpanel", nf => "FHEM::SSCam::ptzPanel" },
|
||||||
|
2 => { of => "SSCam_composegallery", nf => "FHEM::SSCam::composeGallery" },
|
||||||
|
3 => { of => "SSCam_StreamDev", nf => "FHEM::SSCam::streamDev" },
|
||||||
|
);
|
||||||
|
|
||||||
|
my %SSCAM_imc = ( # disbled String modellabhängig (SVS / CAM)
|
||||||
|
0 => { 0 => "initialized", 1 => "inactive" },
|
||||||
|
1 => { 0 => "off", 1 => "inactive" },
|
||||||
|
);
|
||||||
|
|
||||||
|
my $todef = 5; # Default Popup Zeit für set <> popupStream
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
sub Initialize {
|
sub Initialize {
|
||||||
@ -156,11 +170,13 @@ sub Initialize {
|
|||||||
# $hash->{FW_addDetailToSummary} = 1;
|
# $hash->{FW_addDetailToSummary} = 1;
|
||||||
# $hash->{FW_atPageEnd} = 1; # wenn 1 -> kein Longpoll ohne informid in HTML-Tag
|
# $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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Define
|
||||||
################################################################
|
################################################################
|
||||||
sub Define {
|
sub Define {
|
||||||
my ($hash, $def) = @_;
|
my ($hash, $def) = @_;
|
||||||
@ -170,6 +186,8 @@ sub Define {
|
|||||||
return "Usage: define <name> SSCamSTRM <arg>";
|
return "Usage: define <name> SSCamSTRM <arg>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$link = migrateFunc($hash,$link);
|
||||||
|
|
||||||
explodeDEF ($hash,$link);
|
explodeDEF ($hash,$link);
|
||||||
|
|
||||||
$hash->{HELPER}{MODMETAABSENT} = 1 if($modMetaAbsent); # Modul Meta.pm nicht vorhanden
|
$hash->{HELPER}{MODMETAABSENT} = 1 if($modMetaAbsent); # Modul Meta.pm nicht vorhanden
|
||||||
@ -181,7 +199,22 @@ sub Define {
|
|||||||
readingsSingleUpdate($hash,"state", "initialized", 1); # Init für "state"
|
readingsSingleUpdate($hash,"state", "initialized", 1); # Init für "state"
|
||||||
readingsSingleUpdate($hash,"parentState", "initialized", 1); # Init für "parentState" Forum: https://forum.fhem.de/index.php/topic,45671.msg985136.html#msg985136
|
readingsSingleUpdate($hash,"parentState", "initialized", 1); # Init für "parentState" Forum: https://forum.fhem.de/index.php/topic,45671.msg985136.html#msg985136
|
||||||
|
|
||||||
return undef;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# im DEF hinterlegte Funktionen vor SSCam V9.4.0 migrieren
|
||||||
|
################################################################
|
||||||
|
sub migrateFunc {
|
||||||
|
my $hash = shift;
|
||||||
|
my $link = shift;
|
||||||
|
|
||||||
|
for my $k (keys %fupgrade) {
|
||||||
|
$hash->{DEF} =~ s/$fupgrade{$k}{of}/$fupgrade{$k}{nf}/gx;
|
||||||
|
$link =~ s/$fupgrade{$k}{of}/$fupgrade{$k}{nf}/gx;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $link;
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################
|
###############################################################
|
||||||
@ -218,30 +251,27 @@ sub Set {
|
|||||||
my $opt = $a[1];
|
my $opt = $a[1];
|
||||||
my $prop = $a[2];
|
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 ".
|
my $setlist = "Unknown argument $opt, choose one of ".
|
||||||
"popupStream "
|
"popupStream "
|
||||||
;
|
;
|
||||||
|
|
||||||
if ($opt eq "popupStream") {
|
if ($opt eq "popupStream") {
|
||||||
my $txt = SSCam_getclhash($hash);
|
my $txt = FHEM::SSCam::getClHash($hash);
|
||||||
return $txt if($txt);
|
return $txt if($txt);
|
||||||
|
|
||||||
my $link = AnalyzePerlCommand(undef, $hash->{LINK});
|
my $link = AnalyzePerlCommand(undef, $hash->{LINK});
|
||||||
|
|
||||||
# OK-Dialogbox oder Autoclose
|
# OK-Dialogbox oder Autoclose
|
||||||
my $todef = 5;
|
|
||||||
my $temp = AttrVal($name, "popupStreamTo", $todef);
|
my $temp = AttrVal($name, "popupStreamTo", $todef);
|
||||||
my $to = $prop?$prop:$temp;
|
my $to = $prop // $temp;
|
||||||
unless ($to =~ /^\d+$/ || lc($to) eq "ok") { $to = $todef; }
|
unless ($to =~ /^\d+$/x || lc($to) eq "ok") { $to = $todef; }
|
||||||
$to = ($to =~ /\d+/)?(1000 * $to):$to;
|
$to = ($to =~ /\d+/x) ? (1000 * $to) : $to;
|
||||||
|
|
||||||
my $pd = AttrVal($name, "popupStreamFW", "TYPE=FHEMWEB");
|
my $pd = AttrVal($name, "popupStreamFW", "TYPE=FHEMWEB");
|
||||||
|
|
||||||
my $parent = $hash->{PARENT};
|
my $parent = $hash->{PARENT};
|
||||||
my $parentHash = $defs{$parent};
|
my $parentHash = $defs{$parent};
|
||||||
|
|
||||||
my $htmlCode = $hash->{HELPER}{STREAM};
|
my $htmlCode = $hash->{HELPER}{STREAM};
|
||||||
|
|
||||||
if ($hash->{HELPER}{STREAMACTIVE}) {
|
if ($hash->{HELPER}{STREAMACTIVE}) {
|
||||||
@ -252,10 +282,10 @@ sub Set {
|
|||||||
Log3($name, 4, "$name - Stream to display: $htmlCode");
|
Log3($name, 4, "$name - Stream to display: $htmlCode");
|
||||||
Log3($name, 4, "$name - Stream display to webdevice: $pd");
|
Log3($name, 4, "$name - Stream display to webdevice: $pd");
|
||||||
|
|
||||||
if($to =~ /\d+/) {
|
if($to =~ /\d+/x) {
|
||||||
map {FW_directNotify("#FHEMWEB:$_", "FW_errmsg('$out', $to)", "")} devspec2array("$pd");
|
map {FW_directNotify("#FHEMWEB:$_", "FW_errmsg('$out', $to)", "")} devspec2array("$pd"); ## no critic 'void context';
|
||||||
} else {
|
} else {
|
||||||
map {FW_directNotify("#FHEMWEB:$_", "FW_okDialog('$out')", "")} devspec2array("$pd");
|
map {FW_directNotify("#FHEMWEB:$_", "FW_okDialog('$out')", "")} devspec2array("$pd"); ## no critic 'void context';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,8 +313,7 @@ sub Get {
|
|||||||
return streamAsHtml($hash,"ftui");
|
return streamAsHtml($hash,"ftui");
|
||||||
}
|
}
|
||||||
|
|
||||||
return undef;
|
return;
|
||||||
return "Unknown argument $cmd, choose one of html:noArg";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
@ -312,12 +341,12 @@ sub Attr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($cmd eq "set") {
|
if ($cmd eq "set") {
|
||||||
if ($aName =~ m/popupStreamTo/) {
|
if ($aName =~ m/popupStreamTo/x) {
|
||||||
unless ($aVal =~ /^\d+$/ || $aVal eq "OK") { $_[3] = 5; }
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
#############################################################################################
|
#############################################################################################
|
||||||
@ -331,7 +360,7 @@ sub FwFn {
|
|||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
$hash->{HELPER}{FW} = $FW_wname;
|
$hash->{HELPER}{FW} = $FW_wname;
|
||||||
|
|
||||||
$link = AnalyzePerlCommand(undef, $link) if($link =~ m/^{(.*)}$/s);
|
$link = AnalyzePerlCommand(undef, $link) if($link =~ m/^{(.*)}$/xs);
|
||||||
|
|
||||||
my $ret = "";
|
my $ret = "";
|
||||||
if(IsDisabled($name)) {
|
if(IsDisabled($name)) {
|
||||||
@ -361,10 +390,9 @@ return $ret;
|
|||||||
sub explodeDEF {
|
sub explodeDEF {
|
||||||
my $hash = shift;
|
my $hash = shift;
|
||||||
my $link = shift;
|
my $link = shift;
|
||||||
my $d = $hash->{NAME};
|
|
||||||
|
|
||||||
my $arg = (split("[()]",$link))[1];
|
my $arg = (split("[()]",$link))[1];
|
||||||
$arg =~ s/'//g;
|
$arg =~ s/'//xg;
|
||||||
($hash->{PARENT},undef,$hash->{MODEL}) = split(",",$arg);
|
($hash->{PARENT},undef,$hash->{MODEL}) = split(",",$arg);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -376,15 +404,15 @@ return;
|
|||||||
#############################################################################################
|
#############################################################################################
|
||||||
sub webRefresh {
|
sub webRefresh {
|
||||||
my $hash = shift;
|
my $hash = shift;
|
||||||
my $d = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
my $rd = AttrVal($d, "autoRefreshFW", $hash->{HELPER}{FW});
|
my $rd = AttrVal($name, "autoRefreshFW", $hash->{HELPER}{FW});
|
||||||
{ map { FW_directNotify("#FHEMWEB:$_", "location.reload('true')", "") } $rd }
|
{ 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) {
|
if($al) {
|
||||||
InternalTimer(gettimeofday()+$al, "FHEM::SSCamSTRM::webRefresh", $hash, 0);
|
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 {
|
} else {
|
||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
}
|
}
|
||||||
@ -440,7 +468,7 @@ sub streamAsHtml {
|
|||||||
$link = $s.",'$ftui')}";
|
$link = $s.",'$ftui')}";
|
||||||
}
|
}
|
||||||
|
|
||||||
$link = AnalyzePerlCommand(undef, $link) if($link =~ m/^{(.*)}$/s);
|
$link = AnalyzePerlCommand(undef, $link) if($link =~ m/^{(.*)}$/xs);
|
||||||
|
|
||||||
my $ret = "<html>";
|
my $ret = "<html>";
|
||||||
if(IsDisabled($name)) {
|
if(IsDisabled($name)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user