49_SSCam: minor fixes, refactored setter: createReadingsGroup enable disable motdetsc expmode homeMode autocreateCams goPreset optimizeParams
git-svn-id: https://svn.fhem.de/fhem/trunk@22711 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -164,6 +164,8 @@ BEGIN {
|
||||
|
||||
# Versions History intern
|
||||
my %vNotesIntern = (
|
||||
"9.7.7" => "01.09.2020 minor fixes, refactored setter: createReadingsGroup enable disable motdetsc expmode homeMode ".
|
||||
"autocreateCams goPreset optimizeParams ",
|
||||
"9.7.6" => "31.08.2020 refactored setter: snapGallery createSnapGallery createPTZcontrol createStreamDev, minor bugfixes ",
|
||||
"9.7.5" => "30.08.2020 some more code review and optimisation, exitOnDis with fix check Availability instead of state ",
|
||||
"9.7.4" => "29.08.2020 some code changes ",
|
||||
@@ -398,19 +400,28 @@ my %ttips_de = (
|
||||
);
|
||||
|
||||
my %hset = ( # Hash für Set-Funktion (needcred => 1: Funktion benötigt gesetzte Credentials)
|
||||
credentials => { fn => "_setcredentials", needcred => 0 },
|
||||
smtpcredentials => { fn => "_setsmtpcredentials", needcred => 0 },
|
||||
on => { fn => "_seton", needcred => 1 },
|
||||
off => { fn => "_setoff", needcred => 1 },
|
||||
snap => { fn => "_setsnap", needcred => 1 },
|
||||
snapCams => { fn => "_setsnapCams", needcred => 1 },
|
||||
startTracking => { fn => "_setstartTracking", needcred => 1 },
|
||||
stopTracking => { fn => "_setstopTracking", needcred => 1 },
|
||||
setZoom => { fn => "_setsetZoom", needcred => 1 },
|
||||
snapGallery => { fn => "_setsnapGallery", needcred => 1 },
|
||||
createSnapGallery => { fn => "_setcreateSnapGallery", needcred => 1 },
|
||||
createPTZcontrol => { fn => "_setcreatePTZcontrol", needcred => 1 },
|
||||
createStreamDev => { fn => "_setcreateStreamDev", needcred => 1 },
|
||||
credentials => { fn => "_setcredentials", needcred => 0 },
|
||||
smtpcredentials => { fn => "_setsmtpcredentials", needcred => 0 },
|
||||
on => { fn => "_seton", needcred => 1 },
|
||||
off => { fn => "_setoff", needcred => 1 },
|
||||
snap => { fn => "_setsnap", needcred => 1 },
|
||||
snapCams => { fn => "_setsnapCams", needcred => 1 },
|
||||
startTracking => { fn => "_setstartTracking", needcred => 1 },
|
||||
stopTracking => { fn => "_setstopTracking", needcred => 1 },
|
||||
setZoom => { fn => "_setsetZoom", needcred => 1 },
|
||||
snapGallery => { fn => "_setsnapGallery", needcred => 1 },
|
||||
createSnapGallery => { fn => "_setcreateSnapGallery", needcred => 1 },
|
||||
createPTZcontrol => { fn => "_setcreatePTZcontrol", needcred => 1 },
|
||||
createStreamDev => { fn => "_setcreateStreamDev", needcred => 1 },
|
||||
createReadingsGroup => { fn => "_setcreateReadingsGroup", needcred => 1 },
|
||||
enable => { fn => "_setenable", needcred => 1 },
|
||||
disable => { fn => "_setdisable", needcred => 1 },
|
||||
motdetsc => { fn => "_setmotdetsc", needcred => 1 },
|
||||
expmode => { fn => "_setexpmode", needcred => 1 },
|
||||
homeMode => { fn => "_sethomeMode", needcred => 1 },
|
||||
autocreateCams => { fn => "_setautocreateCams", needcred => 1 },
|
||||
goPreset => { fn => "_setgoPreset", needcred => 1 },
|
||||
optimizeParams => { fn => "_setoptimizeParams", needcred => 1 },
|
||||
);
|
||||
|
||||
my %imc = ( # disbled String modellabhängig (SVS / CAM)
|
||||
@@ -1131,156 +1142,7 @@ sub Set {
|
||||
use strict "refs";
|
||||
|
||||
|
||||
if ($opt eq "createReadingsGroup") {
|
||||
if (!$hash->{CREDENTIALS}) {return qq{Credentials of $name are not set - make sure you've set it with "set $name credentials username password"};}
|
||||
my $rgdev = $prop?$prop:"RG.SSCam";
|
||||
|
||||
my $rgdef = '<%it_camera>,<Kamera<br>On/Offline>,< >,<Status>,< >,<Bewegungs<br>erkennung>,< >,<letzte Aufnahme>,< >,<bel. Platz<br>(MB)>,< >,<letzte Aktualisierung>,< >,<Disable<br>Modul>,< >,<Wiedergabe>'."\n".
|
||||
'TYPE=SSCam:FILTER=MODEL!=SVS:Availability,< >,state,< >,!CamMotDetSc,< >,!CamLastRecTime,< >,!UsedSpaceMB,< >,!LastUpdateTime,< >,?!disable,< >,?!LSnap,?!LRec,?!Start,?!Stop'."\n".
|
||||
'< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >'."\n".
|
||||
'< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >'."\n".
|
||||
'< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >'."\n".
|
||||
'<%it_server>,<HomeMode<br>On/Off>,< >,<Status>,< >, >,< >,< >,< >,< >, >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >'."\n".
|
||||
'TYPE=SSCam:FILTER=MODEL=SVS:!HomeModeState,< >,state,< >,< >,< >,< >,< >,< >, >,< >,< >,< >,?!disable,< >,< >,< >,< >,< >'."\n".
|
||||
'';
|
||||
|
||||
my $ret = CommandDefine($hash->{CL},"$rgdev readingsGroup $rgdef");
|
||||
return $ret if($ret);
|
||||
|
||||
my $room = AttrVal($name,"room","SSCam");
|
||||
CommandAttr($hash->{CL},"$rgdev room $room");
|
||||
CommandAttr($hash->{CL},"$rgdev alias Überblick Kameras");
|
||||
|
||||
my $cellStyle = '{'."\n".
|
||||
' "c:0" => \'style="text-align:left;font-weight:normal"\','."\n".
|
||||
' "c:1" => \'style="text-align:left;font-weight:normal"\','."\n".
|
||||
' "c:4" => \'style="text-align:center;font-weight:bold"\','."\n".
|
||||
' "c:5" => \'style="text-align:center;color:green;font-weight:normal"\','."\n".
|
||||
' "c:9" => \'style="text-align:center;font-weight:normal"\''."\n".
|
||||
'}';
|
||||
CommandAttr($hash->{CL},"$rgdev cellStyle $cellStyle");
|
||||
|
||||
my $commands = '{'."\n".
|
||||
' "Availability.enabled" => "set $DEVICE disable",'."\n".
|
||||
' "Availability.disabled" => "set $DEVICE enable",'."\n".
|
||||
' "HomeModeState.on" => "set $DEVICE homeMode off",'."\n".
|
||||
' "HomeModeState.off" => "set $DEVICE homeMode on",'."\n".
|
||||
' "'.$rgdev.'.Start" => "set %DEVICE runView live_fw",'."\n".
|
||||
' "Start" => "set %DEVICE runView live_fw",'."\n".
|
||||
' "LRec" => "set %DEVICE runView lastrec_fw",'."\n".
|
||||
' "LSnap" => "set %DEVICE runView lastsnap_fw",'."\n".
|
||||
' "Stop" => "set %DEVICE stopView",'."\n".
|
||||
' "Record" => "runView:",'."\n".
|
||||
' "disable" => "disable:"'."\n".
|
||||
'}';
|
||||
CommandAttr($hash->{CL},"$rgdev commands $commands");
|
||||
|
||||
my $nameStyle = 'style = "color:black;font-weight:bold;text-align:center"';
|
||||
CommandAttr($hash->{CL},"$rgdev nameStyle $nameStyle");
|
||||
|
||||
my $valueColumns = '{'."\n".
|
||||
' \'Wiedergabe\' => \'colspan="4"\''."\n".
|
||||
'}';
|
||||
CommandAttr($hash->{CL},"$rgdev valueColumns $valueColumns");
|
||||
|
||||
my $valueFormat = '{'."\n".
|
||||
' ($READING eq "CamMotDetSc" && $VALUE eq "disabled") ? "external" : $VALUE'."\n".
|
||||
'}';
|
||||
CommandAttr($hash->{CL},"$rgdev valueFormat $valueFormat");
|
||||
|
||||
my $valueIcon = '{'."\n".
|
||||
' "Availability.enabled" => "remotecontrol/black_btn_GREEN",'."\n".
|
||||
' "Availability.disabled" => "remotecontrol/black_btn_RED",'."\n".
|
||||
' "HomeModeState.on" => "status_available",'."\n".
|
||||
' "HomeModeState.off" => "status_away_1\@orange",'."\n".
|
||||
' "Start" => "black_btn_MJPEG",'."\n".
|
||||
' "LRec" => "black_btn_LASTRECIFRAME",'."\n".
|
||||
' "LSnap" => "black_btn_LSNAP",'."\n".
|
||||
' "Stop" => "remotecontrol/black_btn_POWEROFF3",'."\n".
|
||||
' "state.initialized" => "remotecontrol/black_btn_STOP",'."\n".
|
||||
' "state" => "%devStateIcon"'."\n".
|
||||
'}';
|
||||
CommandAttr($hash->{CL},"$rgdev valueIcon $valueIcon");
|
||||
|
||||
my $valueStyle = '{'."\n".
|
||||
' if($READING eq "Availability" && $VALUE eq "enabled"){ \' style="color:green" \' }'."\n".
|
||||
' elsif( $READING eq "Availability" && $VALUE eq "disabled"){ \' style="color:red" \' }'."\n".
|
||||
' elsif( $READING eq "CamMotDetSc" && $VALUE =~ /SVS.*/ ){ \' style="color:orange" \' }'."\n".
|
||||
' elsif( $READING eq "CamMotDetSc" && $VALUE eq "disabled"){ \' style="color:LimeGreen" \' }'."\n".
|
||||
' elsif( $READING eq "CamMotDetSc" && $VALUE =~ /Cam.*/ ){ \' style="color:SandyBrown" \' }'."\n".
|
||||
'}';
|
||||
CommandAttr($hash->{CL},"$rgdev valueStyle $valueStyle");
|
||||
|
||||
|
||||
return "readingsGroup device \"$rgdev\" created and assigned to room \"$room\".";
|
||||
|
||||
} elsif ($opt eq "enable" && IsModelCam($hash)) {
|
||||
if (!$hash->{CREDENTIALS}) {return qq{Credentials of $name are not set - make sure you've set it with "set $name credentials username password"};}
|
||||
camEnable($hash);
|
||||
|
||||
} elsif ($opt eq "disable" && IsModelCam($hash)) {
|
||||
if (!$hash->{CREDENTIALS}) {return qq{Credentials of $name are not set - make sure you've set it with "set $name credentials username password"};}
|
||||
camDisable($hash);
|
||||
|
||||
} elsif ($opt eq "motdetsc" && IsModelCam($hash)) {
|
||||
if (!$hash->{CREDENTIALS}) {return qq{Credentials of $name are not set - make sure you've set it with "set $name credentials username password"};}
|
||||
if (!$prop || $prop !~ /disable|camera|SVS/x) { return qq{Command "$opt" needs one of those arguments: disable, camera, SVS !}; }
|
||||
|
||||
$hash->{HELPER}{MOTDETSC} = $prop;
|
||||
|
||||
if ($prop1) {
|
||||
# check ob Zahl zwischen 1 und 99
|
||||
return "invalid value for sensitivity (SVS or camera) - use number between 1 - 99" if ($prop1 !~ /^[1-9]$|^[1-9][0-9]$/x);
|
||||
$hash->{HELPER}{MOTDETSC_PROP1} = $prop1;
|
||||
}
|
||||
if ($prop2) {
|
||||
# check ob Zahl zwischen 1 und 99
|
||||
return "invalid value for threshold (SVS) / object size (camera) - use number between 1 - 99" if ($prop1 !~ /^[1-9]$|^[1-9][0-9]$/x);
|
||||
$hash->{HELPER}{MOTDETSC_PROP2} = $prop2;
|
||||
}
|
||||
if ($prop3) {
|
||||
# check ob Zahl zwischen 1 und 99
|
||||
return "invalid value for threshold (SVS) / object size (camera) - use number between 1 - 99" if ($prop1 !~ /^[1-9]$|^[1-9][0-9]$/x);
|
||||
$hash->{HELPER}{MOTDETSC_PROP3} = $prop3;
|
||||
}
|
||||
camMotDetSc($hash);
|
||||
|
||||
} elsif ($opt eq "expmode" && IsModelCam($hash)) {
|
||||
if (!$hash->{CREDENTIALS}) {return qq{Credentials of $name are not set - make sure you've set it with "set $name credentials username password"};}
|
||||
unless ($prop) { return " \"$opt\" needs one of those arguments: auto, day, night !";}
|
||||
|
||||
$hash->{HELPER}{EXPMODE} = $prop;
|
||||
camExpmode($hash);
|
||||
|
||||
} elsif ($opt eq "homeMode" && !IsModelCam($hash)) {
|
||||
if (!$hash->{CREDENTIALS}) {return qq{Credentials of $name are not set - make sure you've set it with "set $name credentials username password"};}
|
||||
unless ($prop) { return " \"$opt\" needs one of those arguments: on, off !";}
|
||||
|
||||
$hash->{HELPER}{HOMEMODE} = $prop;
|
||||
setHomeMode($hash);
|
||||
|
||||
} elsif ($opt eq "autocreateCams" && !IsModelCam($hash)) {
|
||||
if (!$hash->{CREDENTIALS}) {return qq{Credentials of $name are not set - make sure you've set it with "set $name credentials username password"};}
|
||||
|
||||
camAutocreate($hash);
|
||||
|
||||
} elsif ($opt eq "goPreset" && IsModelCam($hash)) {
|
||||
if (!$hash->{CREDENTIALS}) {return qq{Credentials of $name are not set - make sure you've set it with "set $name credentials username password"};}
|
||||
if (!$prop) {return "Function \"goPreset\" needs a \"Presetname\" as an argument";}
|
||||
|
||||
$hash->{HELPER}{GOPRESETNAME} = $prop;
|
||||
$hash->{HELPER}{PTZACTION} = "gopreset";
|
||||
doPtzAaction($hash);
|
||||
|
||||
} elsif ($opt eq "optimizeParams" && IsModelCam($hash)) {
|
||||
if (!$hash->{CREDENTIALS}) {return qq{Credentials of $name are not set - make sure you've set it with "set $name credentials username password"};}
|
||||
my %cpcl = (ntp => 1, mirror => 2, flip => 4, rotate => 8);
|
||||
extoptpar($hash,$prop,\%cpcl) if($prop);
|
||||
extoptpar($hash,$prop1,\%cpcl) if($prop1);
|
||||
extoptpar($hash,$prop2,\%cpcl) if($prop2);
|
||||
setOptParams($hash);
|
||||
|
||||
} elsif ($opt eq "pirSensor" && IsModelCam($hash)) {
|
||||
if ($opt eq "pirSensor" && IsModelCam($hash)) {
|
||||
if (!$hash->{CREDENTIALS}) {return qq{Credentials of $name are not set - make sure you've set it with "set $name credentials username password"};}
|
||||
if(ReadingsVal("$name", "CapPIR", "false") eq "false") {return "Function \"$opt\" not possible. Camera \"$name\" don't have a PIR sensor."}
|
||||
if(!$prop) {return "Function \"$opt\" needs an argument";}
|
||||
@@ -1927,8 +1789,6 @@ sub _setcreateStreamDev { ## no critic "not used"
|
||||
my $name = $paref->{name};
|
||||
my $prop = $paref->{prop};
|
||||
|
||||
return if(!IsModelCam($hash));
|
||||
|
||||
my ($livedev,$ret);
|
||||
|
||||
if($prop =~ /mjpeg/x) {
|
||||
@@ -1948,7 +1808,7 @@ sub _setcreateStreamDev { ## no critic "not used"
|
||||
$ret = CommandDefine($hash->{CL},"$livedev SSCamSTRM {FHEM::SSCam::streamDev('$name','$livedev','hls')}");
|
||||
return $ret if($ret);
|
||||
|
||||
my $c = "The device needs to set attribute \"hlsStrmObject\" in camera device \"$name\" to a valid HLS videostream";
|
||||
my $c = qq{The device needs to set attribute "hlsStrmObject" in camera device "$name" to a valid HLS videostream};
|
||||
CommandAttr($hash->{CL},"$livedev comment $c");
|
||||
}
|
||||
|
||||
@@ -1957,9 +1817,9 @@ sub _setcreateStreamDev { ## no critic "not used"
|
||||
$ret = CommandDefine($hash->{CL},"$livedev SSCamSTRM {FHEM::SSCam::streamDev('$name','$livedev','lastsnap')}");
|
||||
return $ret if($ret);
|
||||
|
||||
my $c = "The device shows the last snapshot of camera device \"$name\". \n".
|
||||
"If you always want to see the newest snapshot, please set attribute \"pollcaminfoall\" in camera device \"$name\".\n".
|
||||
"Set also attribute \"snapGallerySize = Full\" in camera device \"$name\" to retrieve snapshots in original resolution.";
|
||||
my $c = qq{The device shows the last snapshot of camera device "$name". \n}.
|
||||
qq{If you always want to see the newest snapshot, please set attribute "pollcaminfoall" in camera device "$name".\n}.
|
||||
qq{Set also attribute "snapGallerySize = Full" in camera device "$name" to retrieve snapshots in original resolution.};
|
||||
CommandAttr($hash->{CL},"$livedev comment $c");
|
||||
}
|
||||
|
||||
@@ -1981,6 +1841,277 @@ sub _setcreateStreamDev { ## no critic "not used"
|
||||
return qq{Livestream device "$livedev" created and assigned to room "$room".};
|
||||
}
|
||||
|
||||
################################################################
|
||||
# Setter createReadingsGroup
|
||||
################################################################
|
||||
sub _setcreateReadingsGroup { ## no critic "not used"
|
||||
my $paref = shift;
|
||||
my $hash = $paref->{hash};
|
||||
my $name = $paref->{name};
|
||||
my $prop = $paref->{prop};
|
||||
|
||||
my $rgdev = $prop // "RG.SSCam";
|
||||
|
||||
my $rgdef = '<%it_camera>,<Kamera<br>On/Offline>,< >,<Status>,< >,<Bewegungs<br>erkennung>,< >,<letzte Aufnahme>,< >,<bel. Platz<br>(MB)>,< >,<letzte Aktualisierung>,< >,<Disable<br>Modul>,< >,<Wiedergabe>'."\n".
|
||||
'TYPE=SSCam:FILTER=MODEL!=SVS:Availability,< >,state,< >,!CamMotDetSc,< >,!CamLastRecTime,< >,!UsedSpaceMB,< >,!LastUpdateTime,< >,?!disable,< >,?!LSnap,?!LRec,?!Start,?!Stop'."\n".
|
||||
'< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >'."\n".
|
||||
'< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >'."\n".
|
||||
'< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >'."\n".
|
||||
'<%it_server>,<HomeMode<br>On/Off>,< >,<Status>,< >, >,< >,< >,< >,< >, >,< >,< >,< >,< >,< >,< >,< >,< >,< >,< >'."\n".
|
||||
'TYPE=SSCam:FILTER=MODEL=SVS:!HomeModeState,< >,state,< >,< >,< >,< >,< >,< >, >,< >,< >,< >,?!disable,< >,< >,< >,< >,< >'."\n".
|
||||
'';
|
||||
|
||||
my $ret = CommandDefine($hash->{CL},"$rgdev readingsGroup $rgdef");
|
||||
return $ret if($ret);
|
||||
|
||||
my $room = AttrVal($name,"room","SSCam");
|
||||
CommandAttr($hash->{CL},"$rgdev room $room");
|
||||
CommandAttr($hash->{CL},"$rgdev alias Überblick Kameras");
|
||||
|
||||
my $cellStyle = '{'."\n".
|
||||
' "c:0" => \'style="text-align:left;font-weight:normal"\','."\n".
|
||||
' "c:1" => \'style="text-align:left;font-weight:normal"\','."\n".
|
||||
' "c:4" => \'style="text-align:center;font-weight:bold"\','."\n".
|
||||
' "c:5" => \'style="text-align:center;color:green;font-weight:normal"\','."\n".
|
||||
' "c:9" => \'style="text-align:center;font-weight:normal"\''."\n".
|
||||
'}';
|
||||
CommandAttr($hash->{CL},"$rgdev cellStyle $cellStyle");
|
||||
|
||||
my $commands = '{'."\n".
|
||||
' "Availability.enabled" => "set $DEVICE disable",'."\n".
|
||||
' "Availability.disabled" => "set $DEVICE enable",'."\n".
|
||||
' "HomeModeState.on" => "set $DEVICE homeMode off",'."\n".
|
||||
' "HomeModeState.off" => "set $DEVICE homeMode on",'."\n".
|
||||
' "'.$rgdev.'.Start" => "set %DEVICE runView live_fw",'."\n".
|
||||
' "Start" => "set %DEVICE runView live_fw",'."\n".
|
||||
' "LRec" => "set %DEVICE runView lastrec_fw",'."\n".
|
||||
' "LSnap" => "set %DEVICE runView lastsnap_fw",'."\n".
|
||||
' "Stop" => "set %DEVICE stopView",'."\n".
|
||||
' "Record" => "runView:",'."\n".
|
||||
' "disable" => "disable:"'."\n".
|
||||
'}';
|
||||
CommandAttr($hash->{CL},"$rgdev commands $commands");
|
||||
|
||||
my $nameStyle = 'style = "color:black;font-weight:bold;text-align:center"';
|
||||
CommandAttr($hash->{CL},"$rgdev nameStyle $nameStyle");
|
||||
|
||||
my $valueColumns = '{'."\n".
|
||||
' \'Wiedergabe\' => \'colspan="4"\''."\n".
|
||||
'}';
|
||||
CommandAttr($hash->{CL},"$rgdev valueColumns $valueColumns");
|
||||
|
||||
my $valueFormat = '{'."\n".
|
||||
' ($READING eq "CamMotDetSc" && $VALUE eq "disabled") ? "external" : $VALUE'."\n".
|
||||
'}';
|
||||
CommandAttr($hash->{CL},"$rgdev valueFormat $valueFormat");
|
||||
|
||||
my $valueIcon = '{'."\n".
|
||||
' "Availability.enabled" => "remotecontrol/black_btn_GREEN",'."\n".
|
||||
' "Availability.disabled" => "remotecontrol/black_btn_RED",'."\n".
|
||||
' "HomeModeState.on" => "status_available",'."\n".
|
||||
' "HomeModeState.off" => "status_away_1\@orange",'."\n".
|
||||
' "Start" => "black_btn_MJPEG",'."\n".
|
||||
' "LRec" => "black_btn_LASTRECIFRAME",'."\n".
|
||||
' "LSnap" => "black_btn_LSNAP",'."\n".
|
||||
' "Stop" => "remotecontrol/black_btn_POWEROFF3",'."\n".
|
||||
' "state.initialized" => "remotecontrol/black_btn_STOP",'."\n".
|
||||
' "state" => "%devStateIcon"'."\n".
|
||||
'}';
|
||||
CommandAttr($hash->{CL},"$rgdev valueIcon $valueIcon");
|
||||
|
||||
my $valueStyle = '{'."\n".
|
||||
' if($READING eq "Availability" && $VALUE eq "enabled"){ \' style="color:green" \' }'."\n".
|
||||
' elsif( $READING eq "Availability" && $VALUE eq "disabled"){ \' style="color:red" \' }'."\n".
|
||||
' elsif( $READING eq "CamMotDetSc" && $VALUE =~ /SVS.*/ ){ \' style="color:orange" \' }'."\n".
|
||||
' elsif( $READING eq "CamMotDetSc" && $VALUE eq "disabled"){ \' style="color:LimeGreen" \' }'."\n".
|
||||
' elsif( $READING eq "CamMotDetSc" && $VALUE =~ /Cam.*/ ){ \' style="color:SandyBrown" \' }'."\n".
|
||||
'}';
|
||||
CommandAttr($hash->{CL},"$rgdev valueStyle $valueStyle");
|
||||
|
||||
return qq{readingsGroup device "$rgdev" created and assigned to room "$room".};
|
||||
}
|
||||
|
||||
################################################################
|
||||
# Setter enable
|
||||
################################################################
|
||||
sub _setenable { ## no critic "not used"
|
||||
my $paref = shift;
|
||||
my $hash = $paref->{hash};
|
||||
|
||||
return if(!IsModelCam($hash));
|
||||
|
||||
camEnable($hash);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
################################################################
|
||||
# Setter disable
|
||||
################################################################
|
||||
sub _setdisable { ## no critic "not used"
|
||||
my $paref = shift;
|
||||
my $hash = $paref->{hash};
|
||||
|
||||
return if(!IsModelCam($hash));
|
||||
|
||||
camDisable($hash);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
################################################################
|
||||
# Setter motdetsc
|
||||
################################################################
|
||||
sub _setmotdetsc { ## no critic "not used"
|
||||
my $paref = shift;
|
||||
my $hash = $paref->{hash};
|
||||
my $opt = $paref->{opt};
|
||||
my $prop = $paref->{prop};
|
||||
my $prop1 = $paref->{prop1};
|
||||
my $prop2 = $paref->{prop2};
|
||||
my $prop3 = $paref->{prop3};
|
||||
|
||||
return if(!IsModelCam($hash));
|
||||
|
||||
if (!$prop || $prop !~ /disable|camera|SVS/x) {
|
||||
return qq{Command "$opt" needs one of those arguments: disable, camera, SVS !};
|
||||
}
|
||||
|
||||
$hash->{HELPER}{MOTDETSC} = $prop;
|
||||
|
||||
if ($prop1) {
|
||||
if ($prop1 !~ /^[1-9][0-9]?$/x) {
|
||||
return "Invalid value for sensitivity (SVS or camera). Use numbers between 1 - 99";
|
||||
}
|
||||
$hash->{HELPER}{MOTDETSC_PROP1} = $prop1;
|
||||
}
|
||||
|
||||
if ($prop2) {
|
||||
if ($prop2 !~ /^[1-9][0-9]?$/x) {
|
||||
return "Invalid value for threshold (SVS) / object size (camera). Use numbers between 1 - 99";
|
||||
}
|
||||
$hash->{HELPER}{MOTDETSC_PROP2} = $prop2;
|
||||
}
|
||||
|
||||
if ($prop3) {
|
||||
if ($prop3 !~ /^[1-9][0-9]?$/x) {
|
||||
return "Invalid value for threshold (SVS) / object size (camera). Use numbers between 1 - 99";
|
||||
}
|
||||
$hash->{HELPER}{MOTDETSC_PROP3} = $prop3;
|
||||
}
|
||||
|
||||
camMotDetSc($hash);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
################################################################
|
||||
# Setter expmode
|
||||
################################################################
|
||||
sub _setexpmode { ## no critic "not used"
|
||||
my $paref = shift;
|
||||
my $hash = $paref->{hash};
|
||||
my $opt = $paref->{opt};
|
||||
my $prop = $paref->{prop};
|
||||
|
||||
return if(!IsModelCam($hash));
|
||||
|
||||
if(!$prop) {
|
||||
return qq{Command "$opt" needs one of those arguments: auto, day, night};
|
||||
}
|
||||
|
||||
$hash->{HELPER}{EXPMODE} = $prop;
|
||||
|
||||
camExpmode($hash);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
################################################################
|
||||
# Setter homeMode
|
||||
################################################################
|
||||
sub _sethomeMode { ## no critic "not used"
|
||||
my $paref = shift;
|
||||
my $hash = $paref->{hash};
|
||||
my $opt = $paref->{opt};
|
||||
my $prop = $paref->{prop};
|
||||
|
||||
return if(IsModelCam($hash));
|
||||
|
||||
if(!$prop) {
|
||||
return qq{Command "$opt" needs one of those arguments: on, off};
|
||||
}
|
||||
|
||||
$hash->{HELPER}{HOMEMODE} = $prop;
|
||||
|
||||
setHomeMode($hash);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
################################################################
|
||||
# Setter autocreateCams
|
||||
################################################################
|
||||
sub _setautocreateCams { ## no critic "not used"
|
||||
my $paref = shift;
|
||||
my $hash = $paref->{hash};
|
||||
|
||||
return if(IsModelCam($hash));
|
||||
|
||||
camAutocreate($hash);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
################################################################
|
||||
# Setter goPreset
|
||||
################################################################
|
||||
sub _setgoPreset { ## no critic "not used"
|
||||
my $paref = shift;
|
||||
my $hash = $paref->{hash};
|
||||
my $opt = $paref->{opt};
|
||||
my $prop = $paref->{prop};
|
||||
|
||||
return if(!IsModelCam($hash));
|
||||
|
||||
if (!$prop) {
|
||||
return qq{Command "$opt" needs a "Presetname" as an argument};
|
||||
}
|
||||
|
||||
$hash->{HELPER}{GOPRESETNAME} = $prop;
|
||||
$hash->{HELPER}{PTZACTION} = "gopreset";
|
||||
|
||||
doPtzAaction($hash);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
################################################################
|
||||
# Setter optimizeParams
|
||||
################################################################
|
||||
sub _setoptimizeParams { ## no critic "not used"
|
||||
my $paref = shift;
|
||||
my $hash = $paref->{hash};
|
||||
my $opt = $paref->{opt};
|
||||
my $prop = $paref->{prop};
|
||||
my $prop1 = $paref->{prop1};
|
||||
my $prop2 = $paref->{prop2};
|
||||
my $prop3 = $paref->{prop3};
|
||||
|
||||
return if(!IsModelCam($hash));
|
||||
|
||||
my %cpcl = (ntp => 1, mirror => 2, flip => 4, rotate => 8);
|
||||
|
||||
extoptpar($hash,$prop, \%cpcl) if($prop);
|
||||
extoptpar($hash,$prop1,\%cpcl) if($prop1);
|
||||
extoptpar($hash,$prop2,\%cpcl) if($prop2);
|
||||
extoptpar($hash,$prop3,\%cpcl) if($prop3);
|
||||
|
||||
setOptParams($hash);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
################################################################
|
||||
# Get
|
||||
################################################################
|
||||
@@ -5157,7 +5288,7 @@ sub camOp_Parse {
|
||||
readingsBulkUpdate ($hash, "Error" , "none");
|
||||
readingsEndUpdate ($hash, 1);
|
||||
|
||||
Log3($name, 3, "$name - Camera $camname exposure mode was set to \"$hash->{HELPER}{EXPMODE}\"");
|
||||
Log3($name, 3, "$name - Camera $camname exposure mode is set to \"$hash->{HELPER}{EXPMODE}\"");
|
||||
|
||||
} elsif ($OpMode eq "setZoom") {
|
||||
readingsBeginUpdate($hash);
|
||||
@@ -6926,10 +7057,10 @@ sub extoptpar {
|
||||
$hash->{HELPER}{ROTATE} = (split("rotate:",$a))[1] if(lc($a) =~ m/^rotate:/x);
|
||||
$hash->{HELPER}{NTPSERV} = (split("ntp:",$a))[1] if(lc($a) =~ m/^ntp:/x);
|
||||
|
||||
$hash->{HELPER}{CHKLIST} = ($hash->{HELPER}{NTPSERV}?$cpcl->{ntp}:0)+
|
||||
($hash->{HELPER}{MIRROR}?$cpcl->{mirror}:0)+
|
||||
($hash->{HELPER}{FLIP}?$cpcl->{flip}:0)+
|
||||
($hash->{HELPER}{ROTATE}?$cpcl->{rotate}:0);
|
||||
$hash->{HELPER}{CHKLIST} = ($hash->{HELPER}{NTPSERV} ? $cpcl->{ntp} : 0)+
|
||||
($hash->{HELPER}{MIRROR} ? $cpcl->{mirror} : 0)+
|
||||
($hash->{HELPER}{FLIP} ? $cpcl->{flip} : 0)+
|
||||
($hash->{HELPER}{ROTATE} ? $cpcl->{rotate} : 0);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -7645,10 +7776,6 @@ sub _streamDevGENERIC { ## no critic 'not
|
||||
|
||||
if(!$htag) {
|
||||
$ret .= "<td> <br> <b> Set attribute \"genericStrmHtmlTag\" in device <a href=\"/fhem?detail=$camname\">$camname</a> or in device <a href=\"/fhem?detail=$strmdev\">$strmdev</a></b> <br><br></td>";
|
||||
$ret .= '</tr>';
|
||||
$ret .= '</tbody>';
|
||||
$ret .= '</table>';
|
||||
$ret .= '</div>';
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@@ -7746,10 +7873,6 @@ sub _streamDevHLS { ## no critic 'not
|
||||
if(!$m3u8) {
|
||||
$cause = "You have to specify attribute \"hlsStrmObject\" in Camera $cam !";
|
||||
$ret .= "<td> <br> <b> $cause </b> <br><br></td>";
|
||||
$ret .= '</tr>';
|
||||
$ret .= '</tbody>';
|
||||
$ret .= '</table>';
|
||||
$ret .= '</div>';
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user