2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-23 02:31:53 +00:00

49_SSCam: attr simu_SVSversion changed, added 407 errorcode msg,

external recording changed for SVS 7.2

git-svn-id: https://svn.fhem.de/fhem/trunk@12162 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2016-09-16 19:21:53 +00:00
parent 3dd4829aca
commit cf0b75fad4
2 changed files with 72 additions and 25 deletions

View File

@ -1,5 +1,7 @@
# 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.
- change: 49_SSCam: attr simu_SVSversion changed, added 407 errorcode msg,
external recording changed for SVS 7.2
- bugfix: 73_ElectricityCalculator: get/set list per device and not global
- bugfix: 98_DLNARenderer: fix pauseToggle/next/prev (thx@MattG)
- bugfix: 73_GasCalculator: get/set list deleted for CounterDevice

View File

@ -27,6 +27,8 @@
##########################################################################################################
# Versions History:
#
# 1.34 15.09.2016 simu_SVSversion changed, added 407 errorcode message, external recording changed
# for SVS 7.2
# 1.33 21.08.2016 function get stmUrlPath added, fit to new commandref style, attribute showStmInfoFull
# added
# 1.32.1 18.08.2016 empty event LastSnapId fixed
@ -155,9 +157,10 @@ my %SSCam_errauthlist = (
102 => "API does not exist",
400 => "Invalid user or password",
401 => "Guest or disabled account",
402 => "Permission denied - DSM-Session: make sure user is member of Admin-group, SVS-Session: make sure SVS package is started",
402 => "Permission denied - DSM-Session: make sure user is member of Admin-group, SVS-Session: make sure SVS package is started, make sure FHEM-Server IP won't be blocked in DSM automated blocking list",
403 => "One time password not specified",
404 => "One time password authenticate failed",
407 => "Permission denied - make sure FHEM-Server IP won't be blocked in DSM automated blocking list",
);
my %SSCam_errlist = (
@ -217,7 +220,7 @@ sub SSCam_Initialize($) {
"session:SurveillanceStation,DSM ".
"showPassInLog:1,0 ".
"showStmInfoFull:1,0 ".
"simu_SVSversion:7.2 ".
"simu_SVSversion:7.2-xxxx,7.1-xxxx ".
"webCmd ".
$readingFnAttributes;
@ -1996,14 +1999,6 @@ sub login_nonbl ($) {
$success = $data->{'success'};
# aktuelle SVS-Version für Fallentscheidung setzen
no warnings 'uninitialized';
my $major = $hash->{HELPER}{SVSVERSION}{MAJOR};
my $minor = $hash->{HELPER}{SVSVERSION}{MINOR};
my $build = $hash->{HELPER}{SVSVERSION}{BUILD};
my $actvs = $major.$minor.$build;
use warnings;
if ($success)
{
my $logstr;
@ -2141,14 +2136,56 @@ sub login_nonbl ($) {
Log3($name, 4, "$name - $logstr");
# Workarounds für bestimmte SVS-Versionen
Log3($name, 4, "$name - ------- Begin of adaption section -------");
if ($actvs =~ m/^72/g) {
Log3($name, 4, "$name - adapted SVS version is: $actvs");
# aktuelle oder simulierte SVS-Version für Fallentscheidung setzen
no warnings 'uninitialized';
my $major = $hash->{HELPER}{SVSVERSION}{MAJOR};
my $minor = $hash->{HELPER}{SVSVERSION}{MINOR};
my $build = $hash->{HELPER}{SVSVERSION}{BUILD};
my $actvs = $major.$minor.$build;
Log3($name, 4, "$name - saved SVS version is: $actvs");
use warnings;
if(!$actvs and AttrVal($name, "simu_SVSversion", undef)) {
my @vl = split (/\.|-/,AttrVal($name, "simu_SVSversion", ""));
$actvs = $vl[0];
$actvs .= $vl[1];
$actvs .= $vl[2]."-simu" if($vl[2]);
}
# Simulation anderer SVS-Versionen
Log3($name, 4, "$name - ------- Begin of simulation section -------");
if (AttrVal($name, "simu_SVSversion", undef)) {
Log3($name, 4, "$name - SVS version $actvs will be simulated");
if ($actvs =~ /^71/) {
$apiauthmaxver = 4;
Log3($name, 4, "$name - MaxVersion of $apiauth adapted to: $apiauthmaxver");
$apiextrecmaxver = 2;
Log3($name, 4, "$name - MaxVersion of $apiextrec adapted to: $apiextrecmaxver");
$apiptzmaxver = 4;
Log3($name, 4, "$name - MaxVersion of $apiptz adapted to: $apiptzmaxver");
} elsif ($actvs =~ /^72/) {
$apiauthmaxver = 6;
Log3($name, 4, "$name - MaxVersion of $apiauth adapted to: $apiauthmaxver");
$apiextrecmaxver = 3;
Log3($name, 4, "$name - MaxVersion of $apiextrec adapted to: $apiextrecmaxver");
$apiptzmaxver = 5;
Log3($name, 4, "$name - MaxVersion of $apiptz adapted to: $apiptzmaxver");
}
} else {
Log3($name, 4, "$name - no simulations done !");
}
Log3($name, 4, "$name - ------- End of simulation section -------");
# Workarounds für bestimmte SVS-Versionen
Log3($name, 4, "$name - ------- Begin of adaption section -------");
if ($actvs =~ /^72/) {
Log3($name, 4, "$name - SVS version $actvs will be adapted to 71xxxx");
# $apiauthmaxver = 4;
# Log3($name, 4, "$name - MaxVersion of $apiauth adapted to: $apiauthmaxver");
# $apiextrecmaxver = 2;
# Log3($name, 4, "$name - MaxVersion of $apiextrec adapted to: $apiextrecmaxver");
$apiptzmaxver = 4;
Log3($name, 4, "$name - MaxVersion of $apiptz adapted to: $apiptzmaxver");
} else {
Log3($name, 4, "$name - no adaptions done !");
}
@ -2567,10 +2604,16 @@ sub camop_nonbl ($) {
if ($OpMode eq "Start")
{
$url = "http://$serveraddr:$serverport/webapi/$apiextrecpath?api=$apiextrec&method=Record&version=$apiextrecmaxver&cameraId=$camid&action=start&_sid=\"$sid\"";
if($apiextrecmaxver >= 3) {
$url = "http://$serveraddr:$serverport/webapi/$apiextrecpath?api=$apiextrec&method=Record&version=$apiextrecmaxver&cameraIds=$camid&action=start&_sid=\"$sid\"";
}
}
elsif ($OpMode eq "Stop")
{
$url = "http://$serveraddr:$serverport/webapi/$apiextrecpath?api=$apiextrec&method=Record&version=$apiextrecmaxver&cameraId=$camid&action=stop&_sid=\"$sid\"";
if($apiextrecmaxver >= 3) {
$url = "http://$serveraddr:$serverport/webapi/$apiextrecpath?api=$apiextrec&method=Record&version=$apiextrecmaxver&cameraIds=$camid&action=stop&_sid=\"$sid\"";
}
}
elsif ($OpMode eq "Snap")
{
@ -3188,10 +3231,11 @@ sub camret_nonbl ($) {
# simulieren einer anderen SVS-Version
if (AttrVal($name, "simu_SVSversion", undef)) {
Log3($name, 4, "$name - another SVS-version ".AttrVal($name, "simu_SVSversion", undef)." will be simulated");
my @vl = split (/\.|-/,AttrVal($name, "simu_SVSversion", ""));
$version {"MAJOR"} = $vl[0];
$version {"MINOR"} = $vl[1];
$version {"BUILD"} = $vl[2] if($vl[2]);
$version {"BUILD"} = $vl[2]."-simu" if($vl[2]);
}
# Werte in $hash zur späteren Auswertung einfügen
@ -3211,7 +3255,8 @@ sub camret_nonbl ($) {
readingsBulkUpdate($hash,"SVScustomPortHttps",$data->{'data'}{'customizedPortHttps'});
readingsBulkUpdate($hash,"SVSlicenseNumber",$data->{'data'}{'liscenseNumber'});
readingsBulkUpdate($hash,"SVSuserPriv",$userPriv);
readingsBulkUpdate($hash,"SVSversion",$data->{'data'}{'version'}{'major'}.".".$data->{'data'}{'version'}{'minor'}."-".$data->{'data'}{'version'}{'build'});
# readingsBulkUpdate($hash,"SVSversion",$data->{'data'}{'version'}{'major'}.".".$data->{'data'}{'version'}{'minor'}."-".$data->{'data'}{'version'}{'build'});
readingsBulkUpdate($hash,"SVSversion",$version {"MAJOR"}.".".$version {"MINOR"}."-".$version {"BUILD"});
readingsBulkUpdate($hash,"Errorcode","none");
readingsBulkUpdate($hash,"Error","none");
readingsEndUpdate($hash, 1);
@ -3898,7 +3943,7 @@ sub experrorauth {
my $errorcode = shift @errorcode;
my $error;
unless (exists($SSCam_errauthlist{"$errorcode"})) {$error = "Message for Errorcode \"$errorcode\" not found. Please turn to Synology Web API-Guide."; return ($error);}
unless (exists($SSCam_errauthlist{"$errorcode"})) {$error = "Message of errorcode \"$errorcode\" not found. Please turn to Synology Web API-Guide."; return ($error);}
# Fehlertext aus Hash-Tabelle %errorauthlist ermitteln
$error = $SSCam_errauthlist{"$errorcode"};
@ -3915,7 +3960,7 @@ sub experror {
my $errorcode = shift @errorcode;
my $error;
unless (exists($SSCam_errlist{"$errorcode"})) {$error = "Message for Errorcode $errorcode not found. Please turn to Synology Web API-Guide."; return ($error);}
unless (exists($SSCam_errlist{"$errorcode"})) {$error = "Message of errorcode $errorcode not found. Please turn to Synology Web API-Guide."; return ($error);}
# Fehlertext aus Hash-Tabelle %errorlist ermitteln
$error = $SSCam_errlist{"$errorcode"};
@ -4616,7 +4661,7 @@ sub experror {
<li><b>session</b> - selection of login-Session. Not set or set to "DSM" -&gt; session will be established to DSM (Sdefault). "SurveillanceStation" -&gt; session will be established to SVS </li>
<li><b>simu_SVSversion</b> - simulate another SVS version. ONLY FOR DEBUGGING, don't use it in normal operation ! </li>
<li><b>simu_SVSversion</b> - simulates another SVS version. (only a lower version than the installed one is possible !) </li>
<li><b>showStmInfoFull</b> - additional stream informations like LiveStreamUrl, StmKeyUnicst, StmKeymjpegHttp will be created </li>
@ -5347,7 +5392,7 @@ sub experror {
<li><b>session</b> - Auswahl der Login-Session. Nicht gesetzt oder "DSM" -> session wird mit DSM aufgebaut (Standard). "SurveillanceStation" -> Session-Aufbau erfolgt mit SVS </li>
<li><b>simu_SVSversion</b> - simuliert eine andere SVS-Version. NUR FÜR DEBUGGING, nicht im normalen Betrieb zu nutzen ! </li>
<li><b>simu_SVSversion</b> - simuliert eine andere SVS-Version. (es ist nur eine niedrigere als die installierte SVS Version möglich !) </li>
<li><b>showStmInfoFull</b> - zusaätzliche Streaminformationen wie LiveStreamUrl, StmKeyUnicst, StmKeymjpegHttp werden ausgegeben</li>