2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-09 01:34:19 +00:00

49_SSCam: activate/deactivate cam internal PIR-sensor

git-svn-id: https://svn.fhem.de/fhem/trunk@17256 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2018-09-02 17:38:12 +00:00
parent 6c8440f93a
commit 0ec58117c2
3 changed files with 166 additions and 9044 deletions

View File

@ -1,5 +1,6 @@
# 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.
- feature: 49_SSCam: activate/deactivate cam internal PIR-sensor
- new: 10_MQTT_GENERIC_BRIDGE an MQTT bridge, which simultaneously
collects data from several FHEM devices and passes
their readings via MQTT or set readings from

View File

@ -27,6 +27,7 @@
#########################################################################################################################
# Versions History:
#
# 7.1.0 02.09.2018 PIR Sensor enable/disable, SSCam_Set/SSCam_Get optimized
# 7.0.1 27.08.2018 enable/disable issue (https://forum.fhem.de/index.php/topic,45671.msg830869.html#msg830869)
# 7.0.0 27.07.2018 compatibility to API v2.8
# 6.0.1 04.07.2018 Reading CamFirmware
@ -248,7 +249,7 @@ use HttpUtils;
# no if $] >= 5.017011, warnings => 'experimental';
# Version und getestete SVS-Version
my $SSCamVersion = "7.0.0";
my $SSCamVersion = "7.1.0";
my $compstat = "8.2.0";
# Aufbau Errorcode-Hashes (siehe Surveillance Station Web API)
@ -638,7 +639,12 @@ sub SSCam_Set($@) {
return if(IsDisabled($name));
if(SSCam_IsModelCam($hash)) {
if(!$hash->{CREDENTIALS}) {
# initiale setlist für neue Devices
$setlist = "Unknown argument $opt, choose one of ".
"credentials "
;
} elsif(SSCam_IsModelCam($hash)) {
# selist für Cams
my $hlslfw = SSCam_IsHLSCap($hash)?",live_fw_hls,":",";
$setlist = "Unknown argument $opt, choose one of ".
@ -656,6 +662,7 @@ sub SSCam_Set($@) {
"enable:noArg ".
"disable:noArg ".
"optimizeParams ".
((ReadingsVal("$name", "CapPIR", "false") ne "false") ? "pirSensor:activate,deactivate ": "").
"runView:live_fw".$hlslfw."live_link,live_open,lastrec_fw,lastrec_fw_MJPEG,lastrec_fw_MPEG4/H.264,lastrec_open,lastsnap_fw ".
((ReadingsVal("$name", "CapPTZPan", "false") ne "false") ? "setPreset ": "").
((ReadingsVal("$name", "CapPTZPan", "false") ne "false") ? "setHome:---currentPosition---,".ReadingsVal("$name","Presets","")." " : "").
@ -673,11 +680,30 @@ sub SSCam_Set($@) {
"credentials ".
"extevent:1,2,3,4,5,6,7,8,9,10 ".
($hash->{HELPER}{APIHMMAXVER}?"homeMode:on,off ": "");
}
}
if ($opt eq "on" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if ($opt eq "credentials") {
return "Credentials are incomplete, use username password" if (!$prop || !$prop1);
return "Password is too long. It is limited up to and including 20 characters." if (length $prop1 > 20);
delete $hash->{HELPER}{SID} if($hash->{HELPER}{SID});
($success) = SSCam_setcredentials($hash,$prop,$prop1);
$hash->{HELPER}{ACTIVE} = "off";
if($success) {
SSCam_getcaminfoall($hash,0);
RemoveInternalTimer($hash, "SSCam_getptzlistpreset");
InternalTimer(gettimeofday()+11, "SSCam_getptzlistpreset", $hash, 0);
RemoveInternalTimer($hash, "SSCam_getptzlistpatrol");
InternalTimer(gettimeofday()+12, "SSCam_getptzlistpatrol", $hash, 0);
return "Username and Password saved successfully";
} else {
return "Error while saving Username / Password - see logfile for details";
}
}
if ($opt eq "on" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (defined($prop)) {
unless ($prop =~ /^\d+$/) { return " The Value for \"$opt\" is not valid. Use only figures 0-9 without decimal places !";}
$hash->{HELPER}{RECTIME_TEMP} = $prop;
@ -685,26 +711,26 @@ sub SSCam_Set($@) {
SSCam_camstartrec($hash);
} elsif ($opt eq "off" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
SSCam_camstoprec($hash);
} elsif ($opt eq "snap" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
$hash->{HELPER}{SNAPBYSTRMDEV} = 1 if ($prop); # $prop wird mitgegeben durch Snap by SSCamSTRM-Device
SSCam_camsnap($hash);
} elsif ($opt eq "startTracking" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if ($hash->{HELPER}{APIPTZMAXVER} < 5) {return "Function \"$opt\" needs a higher version of Surveillance Station";}
SSCam_starttrack($hash);
} elsif ($opt eq "stopTracking" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if ($hash->{HELPER}{APIPTZMAXVER} < 5) {return "Function \"$opt\" needs a higher version of Surveillance Station";}
SSCam_stoptrack($hash);
} elsif ($opt eq "snapGallery" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
my $ret = SSCam_getclhash($hash);
return $ret if($ret);
@ -735,7 +761,7 @@ sub SSCam_Set($@) {
}
} elsif ($opt eq "createSnapGallery" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
my ($ret,$sgdev);
return "Before use \"$opt\" you have to set the attribute \"snapGalleryBoost\" first due to the technology of retrieving snapshots automatically is needed."
if(!AttrVal($name,"snapGalleryBoost",0));
@ -747,7 +773,7 @@ sub SSCam_Set($@) {
return "Snapgallery device \"$sgdev\" created and assigned to room \"$room\".";
} elsif ($opt eq "createPTZcontrol" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
my $ptzcdev = "SSCamSTRM.$name.PTZcontrol";
my $ret = CommandDefine($hash->{CL},"$ptzcdev SSCamSTRM {SSCam_ptzpanel('$name','$ptzcdev','ptzcontrol')}");
return $ret if($ret);
@ -757,7 +783,7 @@ sub SSCam_Set($@) {
return "PTZ control device \"$ptzcdev\" created and assigned to room \"$room\".";
} elsif ($opt eq "createStreamDev" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
my ($livedev,$ret);
if($prop =~ /mjpeg/) {
@ -781,15 +807,15 @@ sub SSCam_Set($@) {
return "Livestream device \"$livedev\" created and assigned to room \"$room\".";
} elsif ($opt eq "enable" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
SSCam_camenable($hash);
} elsif ($opt eq "disable" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
SSCam_camdisable($hash);
} elsif ($opt eq "motdetsc" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$prop || $prop !~ /^(disable|camera|SVS)$/) { return " \"$opt\" needs one of those arguments: disable, camera, SVS !";}
$hash->{HELPER}{MOTDETSC} = $prop;
@ -811,40 +837,22 @@ sub SSCam_Set($@) {
}
SSCam_cammotdetsc($hash);
} elsif ($opt eq "credentials") {
return "Credentials are incomplete, use username password" if (!$prop || !$prop1);
return "Password is too long. It is limited up to and including 20 characters." if (length $prop1 > 20);
delete $hash->{HELPER}{SID} if($hash->{HELPER}{SID});
($success) = SSCam_setcredentials($hash,$prop,$prop1);
$hash->{HELPER}{ACTIVE} = "off";
if($success) {
SSCam_getcaminfoall($hash,0);
RemoveInternalTimer($hash, "SSCam_getptzlistpreset");
InternalTimer(gettimeofday()+11, "SSCam_getptzlistpreset", $hash, 0);
RemoveInternalTimer($hash, "SSCam_getptzlistpatrol");
InternalTimer(gettimeofday()+12, "SSCam_getptzlistpatrol", $hash, 0);
return "Username and Password saved successfully";
} else {
return "Error while saving Username / Password - see logfile for details";
}
} elsif ($opt eq "expmode" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "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;
SSCam_camexpmode($hash);
} elsif ($opt eq "homeMode" && !SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "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;
SSCam_sethomemode($hash);
} elsif ($opt eq "goPreset" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "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;
@ -852,25 +860,31 @@ sub SSCam_Set($@) {
SSCam_doptzaction($hash);
} elsif ($opt eq "optimizeParams" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "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);
SSCam_extoptpar($hash,$prop,\%cpcl) if($prop);
SSCam_extoptpar($hash,$prop1,\%cpcl) if($prop1);
SSCam_extoptpar($hash,$prop2,\%cpcl) if($prop2);
SSCam_setoptpar($hash);
} elsif ($opt eq "pirSensor" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "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";}
$hash->{HELPER}{PIRACT} = ($prop eq "activate")?0:($prop eq "deactivate")?-1:5;
if($hash->{HELPER}{PIRACT} == 5) {return " Illegal argument for \"$opt\" detected, use \"activate\" or \"activate\" !";}
SSCam_piract($hash);
} elsif ($opt eq "runPatrol" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$prop) {return "Function \"runPatrol\" needs a \"Patrolname\" as an argument";}
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$prop) {return "Function \"$opt\" needs a \"Patrolname\" as an argument";}
$hash->{HELPER}{GOPATROLNAME} = $prop;
$hash->{HELPER}{PTZACTION} = "runpatrol";
SSCam_doptzaction($hash);
} elsif ($opt eq "goAbsPTZ" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if ($prop eq "up" || $prop eq "down" || $prop eq "left" || $prop eq "right") {
if ($prop eq "up") {$hash->{HELPER}{GOPTZPOSX} = 320; $hash->{HELPER}{GOPTZPOSY} = 480;}
if ($prop eq "down") {$hash->{HELPER}{GOPTZPOSX} = 320; $hash->{HELPER}{GOPTZPOSY} = 0;}
@ -896,9 +910,8 @@ sub SSCam_Set($@) {
}
return "Function \"goAbsPTZ\" needs two coordinates, posX=0-640 and posY=0-480, as arguments or use up, down, left, right instead";
} elsif ($opt eq "move" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
} elsif ($opt eq "move" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
return "PTZ version of Synology API isn't set. Use \"get $name scanVirgin\" first." if(!$hash->{HELPER}{APIPTZMAXVER});
if($hash->{HELPER}{APIPTZMAXVER} <= 4) {
@ -926,8 +939,7 @@ sub SSCam_Set($@) {
SSCam_doptzaction($hash);
} elsif ($opt eq "runView" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if ($prop eq "live_open") {
if ($prop1) {$hash->{HELPER}{VIEWOPENROOM} = $prop1;} else {delete $hash->{HELPER}{VIEWOPENROOM};}
$hash->{HELPER}{OPENWINDOW} = 1;
@ -994,12 +1006,12 @@ sub SSCam_Set($@) {
} elsif ($opt eq "hlsreactivate" && SSCam_IsModelCam($hash)) {
# ohne SET-Menüeintrag
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
SSCam_hlsreactivate($hash);
} elsif ($opt eq "hlsactivate" && SSCam_IsModelCam($hash)) {
# ohne SET-Menüeintrag
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
SSCam_hlsactivate($hash);
} elsif ($opt eq "refresh" && SSCam_IsModelCam($hash)) {
@ -1009,13 +1021,13 @@ sub SSCam_Set($@) {
SSCam_refresh($hash,0,0,1); # kein Room-Refresh, kein SSCam-state-Event, SSCamSTRM-Event
}
} elsif ($opt eq "extevent" && !SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
} elsif ($opt eq "extevent" && !SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
$hash->{HELPER}{EVENTID} = $prop;
SSCam_extevent($hash);
} elsif ($opt eq "stopView" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
SSCam_stopliveview($hash);
} elsif ($opt eq "setPreset" && SSCam_IsModelCam($hash)) {
@ -1027,13 +1039,13 @@ sub SSCam_Set($@) {
SSCam_setPreset($hash);
} elsif ($opt eq "setHome" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$prop) {return "Function \"$opt\" needs a \"Presetname\" as argument";}
$hash->{HELPER}{SETHOME} = $prop;
SSCam_setHome($hash);
} elsif ($opt eq "delPreset" && SSCam_IsModelCam($hash)) {
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$hash->{CREDENTIALS}) {return "Credentials of $name are not set - make sure you've set it with \"set $name credentials username password\"";}
if (!$prop) {return "Function \"$opt\" needs a \"Presetname\" as argument";}
$hash->{HELPER}{DELPRESETNAME} = $prop;
SSCam_delPreset($hash);
@ -1057,7 +1069,10 @@ sub SSCam_Get($@) {
my $ret = "";
my $getlist;
if(SSCam_IsModelCam($hash)) {
if(!$hash->{CREDENTIALS}) {
return;
} elsif(SSCam_IsModelCam($hash)) {
# getlist für Cams
$getlist = "Unknown argument $opt, choose one of ".
"caminfoall:noArg ".
@ -2109,6 +2124,55 @@ sub SSCam_setHome($) {
}
}
###############################################################################
# PIR Sensor aktivieren/deaktivieren
###############################################################################
sub SSCam_piract($) {
my ($hash) = @_;
my $camname = $hash->{CAMNAME};
my $name = $hash->{NAME};
my $errorcode;
my $error;
RemoveInternalTimer($hash, "SSCam_piract");
return if(IsDisabled($name));
if (ReadingsVal("$name", "state", "") =~ /^dis.*/) {
if (ReadingsVal("$name", "state", "") eq "disabled") {
$errorcode = "402";
} elsif (ReadingsVal("$name", "state", "") eq "disconnected") {
$errorcode = "502";
}
# Fehlertext zum Errorcode ermitteln
$error = SSCam_experror($hash,$errorcode);
readingsBeginUpdate($hash);
readingsBulkUpdate($hash,"Errorcode",$errorcode);
readingsBulkUpdate($hash,"Error",$error);
readingsEndUpdate($hash, 1);
Log3($name, 2, "$name - ERROR - Home preset of Camera $camname can't be set - $error");
return;
}
if ($hash->{HELPER}{ACTIVE} eq "off") {
$hash->{OPMODE} = "piract";
$hash->{HELPER}{ACTIVE} = "on";
$hash->{HELPER}{LOGINRETRIES} = 0;
if (AttrVal($name,"debugactivetoken",0)) {
Log3($name, 3, "$name - Active-Token was set by OPMODE: $hash->{OPMODE}");
}
SSCam_getapisites($hash);
} else {
InternalTimer(gettimeofday()+1.2, "SSCam_piract", $hash, 0);
}
}
###############################################################################
# Kamera Liveview starten
###############################################################################
@ -3788,6 +3852,11 @@ sub SSCam_camop ($) {
# Liste der Presets abrufen
$url = "$proto://$serveraddr:$serverport/webapi/$apipresetpath?api=\"$apipreset\"&version=\"$apipresetmaxver\"&method=\"Enum\"&cameraId=\"$camid\"&_sid=\"$sid\"";
} elsif ($OpMode eq "piract") {
# PIR Sensor aktivieren/deaktivieren
my $piract = $hash->{HELPER}{PIRACT};
$url = "$proto://$serveraddr:$serverport/webapi/$apicameventpath?api=\"$apicamevent\"&version=\"$apicameventmaxver\"&method=\"PDParamSave\"&keep=true&source=$piract&camId=\"$camid\"&_sid=\"$sid\"";
} elsif ($OpMode eq "setPreset") {
# einen Preset setzen
my $pnumber = $hash->{HELPER}{PNUMBER};
@ -4349,6 +4418,17 @@ sub SSCam_camop_parse ($) {
Log3($name, 3, "$name - Preset \"$dp\" of camera \"$camname\" was deleted successfully");
SSCam_getptzlistpreset($hash);
} elsif ($OpMode eq "piract") {
readingsBeginUpdate($hash);
readingsBulkUpdate($hash,"Errorcode","none");
readingsBulkUpdate($hash,"Error","none");
readingsEndUpdate($hash, 1);
# Logausgabe
my $piract = ($hash->{HELPER}{PIRACT} == 0)?"activated":"deactivated";
Log3($name, 3, "$name - PIR sensor $piract");
} elsif ($OpMode eq "setHome") {
readingsBeginUpdate($hash);
readingsBulkUpdate($hash,"Errorcode","none");
@ -4853,7 +4933,6 @@ sub SSCam_camop_parse ($) {
$camLiveMode = $data->{'data'}->{'cameras'}->[0]->{'camLiveMode'};
if ($camLiveMode eq "0") {$camLiveMode = "Liveview from DS";}elsif ($camLiveMode eq "1") {$camLiveMode = "Liveview from Camera";}
# $update_time = $data->{'data'}->{'cameras'}->[0]->{'update_time'};
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
$update_time = sprintf "%02d.%02d.%04d / %02d:%02d:%02d" , $mday , $mon+=1 ,$year+=1900 , $hour , $min , $sec ;
@ -4942,8 +5021,15 @@ sub SSCam_camop_parse ($) {
$camaudiotype = "AAC";
} elsif ($camaudiotype == 5) {
$camaudiotype = "AMR";
}
}
my $pdcap = SSCam_jboolmap($data->{'data'}->{'cameras'}->[0]->{'PDCap'});
if (!$pdcap || $pdcap == 0) {
$pdcap = "false";
} else {
$pdcap = "true";
}
$data->{'data'}->{'cameras'}->[0]->{'video_flip'} = SSCam_jboolmap($data->{'data'}->{'cameras'}->[0]->{'video_flip'});
$data->{'data'}->{'cameras'}->[0]->{'video_mirror'} = SSCam_jboolmap($data->{'data'}->{'cameras'}->[0]->{'video_mirror'});
$data->{'data'}->{'cameras'}->[0]->{'blPresetSpeed'} = SSCam_jboolmap($data->{'data'}->{'cameras'}->[0]->{'blPresetSpeed'});
@ -4977,6 +5063,7 @@ sub SSCam_camop_parse ($) {
readingsBulkUpdate($hash,"CamVideoMirror",$data->{'data'}->{'cameras'}->[0]->{'video_mirror'});
readingsBulkUpdate($hash,"CamVideoFlip",$data->{'data'}->{'cameras'}->[0]->{'video_flip'});
readingsBulkUpdate($hash,"CamVideoRotate",$rotate);
readingsBulkUpdate($hash,"CapPIR",$pdcap);
readingsBulkUpdate($hash,"Availability",$camStatus);
readingsBulkUpdate($hash,"DeviceType",$deviceType);
readingsBulkUpdate($hash,"LastUpdateTime",$update_time);
@ -5260,7 +5347,7 @@ sub SSCam_camop_parse ($) {
readingsBulkUpdate($hash,"Error",$error);
readingsEndUpdate($hash, 1);
if ($errorcode =~ /(105|401)/) {
if ($errorcode =~ /105/) {
Log3($name, 2, "$name - ERROR - $errorcode - $error in operation $OpMode -> try new login");
return SSCam_login($hash,'SSCam_getapisites');
}
@ -5280,18 +5367,11 @@ sub SSCam_camop_parse ($) {
return;
}
#############################################################################################################################
######### Ende Kameraoperationen mit NonblockingGet (nicht blockierender HTTP-Call) #############
#############################################################################################################################
#############################################################################################################################
######### Hilfsroutinen #############
#############################################################################################################################
####################################################################################
# Login in SVS wenn kein oder ungültige Session-ID vorhanden ist
sub SSCam_login ($$) {
@ -6389,6 +6469,7 @@ sub SSCam_experror {
<li>set a Preset or current position as Home Preset (at PTZ-cameras) </li>
<li>provides a panel for camera control (at PTZ-cameras) </li>
<li>create different types of discrete Streaming-Devices (createStreamDev) </li>
<li>Activation / Deactivation of a camera integrated PIR sensor </li>
</ul>
</ul>
<br>
@ -6929,6 +7010,13 @@ attr &lt;name&gt; genericStrmHtmlTag &lt;video $HTMLATTR controls autoplay&gt;
<br><br>
</ul>
<ul>
<li><b> set &lt;name&gt; pirSensor [activate | deactivate] </b> &nbsp;&nbsp;&nbsp;&nbsp;(valid for CAM)</li> <br>
Activates / deactivates the infrared sensor of the camera (only posible if the camera has got a PIR sensor).
</ul>
<br><br>
<ul>
<li><b> set &lt;name&gt; runPatrol &lt;Patrolname&gt; </b> &nbsp;&nbsp;&nbsp;&nbsp;(valid for CAM)</li> <br>
@ -7554,6 +7642,7 @@ attr &lt;name&gt; genericStrmHtmlTag &lt;video $HTMLATTR controls autoplay&gt;
<tr><td><li>CamVideoRotate</li> </td><td>- Is the video rotate </td></tr>
<tr><td><li>CapAudioOut</li> </td><td>- Capability to Audio Out over Surveillance Station (false/true) </td></tr>
<tr><td><li>CapChangeSpeed</li> </td><td>- Capability to various motion speed </td></tr>
<tr><td><li>CapPIR</li> </td><td>- has the camera a PIR sensor feature </td></tr>
<tr><td><li>CapPTZAbs</li> </td><td>- Capability to perform absolute PTZ action </td></tr>
<tr><td><li>CapPTZAutoFocus</li> </td><td>- Capability to perform auto focus action </td></tr>
<tr><td><li>CapPTZDirections</li> </td><td>- the PTZ directions that camera support </td></tr>
@ -7636,6 +7725,7 @@ attr &lt;name&gt; genericStrmHtmlTag &lt;video $HTMLATTR controls autoplay&gt;
<li>Setzen der Home-Position (bei PTZ-Kameras) </li>
<li>erstellen eines Paneels zur Kamera-Steuerung. (bei PTZ-Kameras) </li>
<li>erzeugen unterschiedlicher Typen von separaten Streaming-Devices (createStreamDev) </li>
<li>Aktivierung / Deaktivierung eines kamerainternen PIR-Sensors </li>
</ul>
</ul>
<br>
@ -8184,6 +8274,13 @@ attr &lt;name&gt; genericStrmHtmlTag &lt;video $HTMLATTR controls autoplay&gt;
<br><br>
</ul>
<ul>
<li><b> set &lt;name&gt; pirSensor [activate | deactivate] </b> &nbsp;&nbsp;&nbsp;&nbsp;(gilt für CAM)</li> <br>
Aktiviert / deaktiviert den Infrarot-Sensor der Kamera (sofern die Kamera einen PIR-Sensor enthält).
</ul>
<br><br>
<ul>
<li><b> set &lt;name&gt; runPatrol &lt;Patrolname&gt; </b> &nbsp;&nbsp;&nbsp;&nbsp;(gilt für CAM)</li> <br>
@ -8829,6 +8926,7 @@ attr &lt;name&gt; genericStrmHtmlTag &lt;video $HTMLATTR controls autoplay&gt;
<tr><td><li>CamVideoRotate</li> </td><td>- Ist das Video gedreht </td></tr>
<tr><td><li>CapAudioOut</li> </td><td>- Fähigkeit der Kamera zur Audioausgabe über Surveillance Station (false/true) </td></tr>
<tr><td><li>CapChangeSpeed</li> </td><td>- Fähigkeit der Kamera verschiedene Bewegungsgeschwindigkeiten auszuführen </td></tr>
<tr><td><li>CapPIR</li> </td><td>- besitzt die Kamera einen PIR-Sensor </td></tr>
<tr><td><li>CapPTZAbs</li> </td><td>- Fähigkeit der Kamera für absolute PTZ-Aktionen </td></tr>
<tr><td><li>CapPTZAutoFocus</li> </td><td>- Fähigkeit der Kamera für Autofokus Aktionen </td></tr>
<tr><td><li>CapPTZDirections</li> </td><td>- die verfügbaren PTZ-Richtungen der Kamera </td></tr>

File diff suppressed because it is too large Load Diff