49_SSCam: commandref revised, more v4 logging in special case
git-svn-id: https://svn.fhem.de/fhem/trunk@11975 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -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.
|
||||||
|
- changed: 49_SSCam: commandref revised, more v4 logging in special case
|
||||||
- updated: 74_AMAD: New Version 2.6.1 support for more Mediaplayer Readings
|
- updated: 74_AMAD: New Version 2.6.1 support for more Mediaplayer Readings
|
||||||
new error handling for "send data to AMADCommBridge Flow"
|
new error handling for "send data to AMADCommBridge Flow"
|
||||||
- change: 38_netatmo: status "no data"
|
- change: 38_netatmo: status "no data"
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
##########################################################################################################
|
##########################################################################################################
|
||||||
# Versions History:
|
# Versions History:
|
||||||
#
|
#
|
||||||
|
# 1.30 15.08.2016 commandref revised, more v4 logging in special case
|
||||||
# 1.29 02.07.2016 add regex for adaption SVS version, url call for "snap" changed
|
# 1.29 02.07.2016 add regex for adaption SVS version, url call for "snap" changed
|
||||||
# 1.28 30.06.2016 Attr "showPassInLog" added, per default no password will be shown in log
|
# 1.28 30.06.2016 Attr "showPassInLog" added, per default no password will be shown in log
|
||||||
# 1.27 29.06.2016 Attr "simu_SVSversion" added, sub login_nonbl changed,
|
# 1.27 29.06.2016 Attr "simu_SVSversion" added, sub login_nonbl changed,
|
||||||
@@ -132,7 +133,7 @@
|
|||||||
|
|
||||||
package main;
|
package main;
|
||||||
|
|
||||||
use JSON qw( decode_json ); # from CPAN, Debian: apt-get install libperl-JSON
|
use JSON qw( decode_json ); # from CPAN, Debian: apt-get install libjson-perl
|
||||||
use Data::Dumper; # Perl Core module
|
use Data::Dumper; # Perl Core module
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
@@ -2177,18 +2178,21 @@ sub login_nonbl ($) {
|
|||||||
Log3($name, 5, "$name - HTTP-Call will be done with httptimeout-Value: $httptimeout s");
|
Log3($name, 5, "$name - HTTP-Call will be done with httptimeout-Value: $httptimeout s");
|
||||||
|
|
||||||
my $url;
|
my $url;
|
||||||
|
my $urlwopw; # nur zur Anzeige bei verbose >=4 und "showPassInLog" == 0
|
||||||
my $apiauthpath = $hash->{HELPER}{APIAUTHPATH};
|
my $apiauthpath = $hash->{HELPER}{APIAUTHPATH};
|
||||||
my $apiauthmaxver = $hash->{HELPER}{APIAUTHMAXVER};
|
my $apiauthmaxver = $hash->{HELPER}{APIAUTHMAXVER};
|
||||||
|
|
||||||
if (defined($attr{$name}{session}) and $attr{$name}{session} eq "SurveillanceStation") {
|
if (defined($attr{$name}{session}) and $attr{$name}{session} eq "SurveillanceStation") {
|
||||||
$url = "http://$serveraddr:$serverport/webapi/$apiauthpath?api=$apiauth&version=$apiauthmaxver&method=Login&account=$username&passwd=$password&session=SurveillanceStation&format=\"sid\"";
|
$url = "http://$serveraddr:$serverport/webapi/$apiauthpath?api=$apiauth&version=$apiauthmaxver&method=Login&account=$username&passwd=$password&session=SurveillanceStation&format=\"sid\"";
|
||||||
|
$urlwopw = "http://$serveraddr:$serverport/webapi/$apiauthpath?api=$apiauth&version=$apiauthmaxver&method=Login&account=$username&passwd=*****&session=SurveillanceStation&format=\"sid\"";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$url = "http://$serveraddr:$serverport/webapi/$apiauthpath?api=$apiauth&version=$apiauthmaxver&method=Login&account=$username&passwd=$password&format=\"sid\"";
|
$url = "http://$serveraddr:$serverport/webapi/$apiauthpath?api=$apiauth&version=$apiauthmaxver&method=Login&account=$username&passwd=$password&format=\"sid\"";
|
||||||
|
$urlwopw = "http://$serveraddr:$serverport/webapi/$apiauthpath?api=$apiauth&version=$apiauthmaxver&method=Login&account=$username&passwd=*****&format=\"sid\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
Log3($name, 4, "$name - Call-Out now: $url");
|
AttrVal($name, "showPassInLog", "0") == 1 ? Log3($name, 4, "$name - Call-Out now: $url") : Log3($name, 4, "$name - Call-Out now: $urlwopw");
|
||||||
|
|
||||||
$param = {
|
$param = {
|
||||||
url => $url,
|
url => $url,
|
||||||
@@ -2198,8 +2202,6 @@ sub login_nonbl ($) {
|
|||||||
header => "Accept: application/json",
|
header => "Accept: application/json",
|
||||||
callback => \&getcamid_nonbl
|
callback => \&getcamid_nonbl
|
||||||
};
|
};
|
||||||
|
|
||||||
# login wird ausgeführt, $sid ermittelt und mit Routine "getcamid_nonbl" verarbeitet
|
|
||||||
HttpUtils_NonblockingGet ($param);
|
HttpUtils_NonblockingGet ($param);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2260,16 +2262,18 @@ sub getcamid_nonbl ($) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log3($name, 5, "$name - Data returned: ".$myjson);
|
||||||
|
|
||||||
$data = decode_json($myjson);
|
$data = decode_json($myjson);
|
||||||
|
|
||||||
|
# Logausgabe decodierte JSON Daten
|
||||||
|
Log3($name, 4, "$name - JSON decoded: ". Dumper $data);
|
||||||
|
|
||||||
$success = $data->{'success'};
|
$success = $data->{'success'};
|
||||||
|
|
||||||
# login war erfolgreich
|
# login war erfolgreich
|
||||||
if ($success)
|
if ($success)
|
||||||
{
|
{
|
||||||
# Logausgabe decodierte JSON Daten
|
|
||||||
Log3($name, 4, "$name - JSON returned: ". Dumper $data);
|
|
||||||
|
|
||||||
$sid = $data->{'data'}->{'sid'};
|
$sid = $data->{'data'}->{'sid'};
|
||||||
|
|
||||||
# Session ID in hash eintragen
|
# Session ID in hash eintragen
|
||||||
@@ -2286,7 +2290,7 @@ sub getcamid_nonbl ($) {
|
|||||||
Log3($name, 4, "$name - --- End Function serverlogin nonblocking ---");
|
Log3($name, 4, "$name - --- End Function serverlogin nonblocking ---");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
# Errorcode aus JSON ermitteln
|
# Errorcode aus JSON ermitteln
|
||||||
$errorcode = $data->{'error'}->{'code'};
|
$errorcode = $data->{'error'}->{'code'};
|
||||||
|
|
||||||
@@ -3850,12 +3854,20 @@ sub experror {
|
|||||||
|
|
||||||
<b> Prerequisites </b> <br><br>
|
<b> Prerequisites </b> <br><br>
|
||||||
This module uses the CPAN-module JSON. Please consider to install this package (Debian: libjson-perl).<br>
|
This module uses the CPAN-module JSON. Please consider to install this package (Debian: libjson-perl).<br>
|
||||||
You don't need to install LWP anymore, because of SSCam is completely using the nonblocking functions of HttpUtils respectively HttpUtils_NonblockingGet now. <br>
|
SSCam is completely using the nonblocking functions of HttpUtils respectively HttpUtils_NonblockingGet. <br>
|
||||||
In DSM respectively in Synology Surveillance Station an User has to be created. The login credentials are needed later when using a set-command to assign the login-data to a device. <br>
|
In DSM respectively in Synology Surveillance Station an User has to be created. The login credentials are needed later when using a set-command to assign the login-data to a device. <br>
|
||||||
Further informations could be find among <a href="#Credentials">Credentials</a>. <br><br>
|
Further informations could be find among <a href="#SSCam_Credentials">Credentials</a>. <br><br>
|
||||||
|
|
||||||
|
Overview which Perl-modules SSCam is using: <br><br>
|
||||||
|
|
||||||
|
JSON <br>
|
||||||
|
Data::Dumper <br>
|
||||||
|
MIME::Base64 <br>
|
||||||
|
Time::HiRes <br>
|
||||||
|
HttpUtils (FHEM-module) <br><br>
|
||||||
|
|
||||||
|
|
||||||
<a name="SCamdefine"></a>
|
<a name="SSCamdefine"></a>
|
||||||
<b>Define</b>
|
<b>Define</b>
|
||||||
<ul>
|
<ul>
|
||||||
<br>
|
<br>
|
||||||
@@ -4534,9 +4546,17 @@ sub experror {
|
|||||||
|
|
||||||
<b>Vorbereitung </b> <br><br>
|
<b>Vorbereitung </b> <br><br>
|
||||||
Dieses Modul nutzt das CPAN Module JSON. Bitte darauf achten dieses Paket zu installieren. (Debian: libjson-perl). <br>
|
Dieses Modul nutzt das CPAN Module JSON. Bitte darauf achten dieses Paket zu installieren. (Debian: libjson-perl). <br>
|
||||||
Das CPAN-Modul LWP wird für SSCam nicht mehr benötigt. Das Modul verwendet für HTTP-Calls die nichtblockierenden Funktionen von HttpUtils bzw. HttpUtils_NonblockingGet. <br>
|
Das Modul verwendet für HTTP-Calls die nichtblockierenden Funktionen von HttpUtils bzw. HttpUtils_NonblockingGet. <br>
|
||||||
Im DSM bzw. der Synology Surveillance Station muß ein Nutzer angelegt sein. Die Zugangsdaten werden später über ein Set-Kommando dem angelegten Gerät zugewiesen. <br>
|
Im DSM bzw. der Synology Surveillance Station muß ein Nutzer angelegt sein. Die Zugangsdaten werden später über ein Set-Kommando dem angelegten Gerät zugewiesen. <br>
|
||||||
Nähere Informationen dazu unter <a href="#Credentials">Credentials</a><br><br>
|
Nähere Informationen dazu unter <a href="#SSCam_Credentials">Credentials</a><br><br>
|
||||||
|
|
||||||
|
Überblick über die Perl-Module welche von SSCam genutzt werden: <br><br>
|
||||||
|
|
||||||
|
JSON <br>
|
||||||
|
Data::Dumper <br>
|
||||||
|
MIME::Base64 <br>
|
||||||
|
Time::HiRes <br>
|
||||||
|
HttpUtils (FHEM-Modul) <br><br>
|
||||||
|
|
||||||
<a name="SSCamdefine"></a>
|
<a name="SSCamdefine"></a>
|
||||||
<b>Definition</b>
|
<b>Definition</b>
|
||||||
|
|||||||
Reference in New Issue
Block a user