1
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-07 22:29:19 +00:00

49_SSCam: avoid problems when running this module on

windows systems

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@10095 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2015-12-04 22:25:12 +00:00
parent 79957bc748
commit cb54538844
2 changed files with 27 additions and 46 deletions

View File

@ -1,5 +1,7 @@
# 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.
- bugfix: 49_SSCam: avoid problems when running this module on
windows systems
- feature: 14_CUL_TCM97001: Add redirect for Eurochron to SD_WS07 modul - feature: 14_CUL_TCM97001: Add redirect for Eurochron to SD_WS07 modul
Add support for KW9010 sensor Add support for KW9010 sensor
Change autocreate names Change autocreate names

View File

@ -129,35 +129,13 @@ sub SSCam_Set {
# Aufnahme starten # Aufnahme starten
if ($opt eq "on") { if ($opt eq "on") {
# wegen Syno-105-Fehler mehrfaches durchlaufen bis kein 105-Fehler mehr oder Aufgabe nach x Durchläufen ($s = Schleifendurchlauf)
$errorcode = "105";
$s = 30;
while ($errorcode eq "105" && $s > 0) {
&camstart($hash); &camstart($hash);
$errorcode = ReadingsVal("$name","Errorcode","none");
# Logausgabe
$logstr = "Readingsval $name".":Errorcode is: $errorcode";
$logstr = "Readingsval $name".":Errorcode is still $errorcode but end of loop reached, giving up!" if ($s == 1);
&printlog($hash,$logstr,"5");
$s -=1;
}
} }
# Aufnahme stoppen # Aufnahme stoppen
if ($opt eq "off") { if ($opt eq "off") {
# wegen Syno-105-Fehler mehrfaches durchlaufen bis kein 105-Fehler mehr oder Aufgabe nach x Durchläufen ($s = Schleifendurchlauf)
$errorcode = "105";
$s = 30;
while ($errorcode eq "105" && $s > 0) {
&camstop($hash); &camstop($hash);
$errorcode = ReadingsVal("$name","Errorcode","none");
# Logausgabe
$logstr = "Readingsval $name".":Errorcode is: $errorcode";
$logstr = "Readingsval $name".":Errorcode is still $errorcode but end of loop reached, giving up!" if ($s == 1);
&printlog($hash,$logstr,"5");
$s -=1;
}
} }
} }
} }
@ -202,15 +180,15 @@ sub camstart {
# API-Pfade und MaxVersions ermitteln # API-Pfade und MaxVersions ermitteln
($hash, $success) = &getapisites($hash); ($hash, $success) = &getapisites($hash);
unless ($success eq "true") {return}; unless ($success == 1) {return};
# Login und SID ermitteln # Login und SID ermitteln
($sid, $success) = &serverlogin($hash); ($sid, $success) = &serverlogin($hash);
unless ($success eq "true") {return}; unless ($success == 1) {return};
# Kamera-ID anhand des Kamaeranamens ermitteln # Kamera-ID anhand des Kamaeranamens ermitteln
($camid, $success) = &getcamid($hash,$sid); ($camid, $success) = &getcamid($hash,$sid);
unless ($success eq "true") {&serverlogout($hash,$sid); return}; unless ($success == 1) {&serverlogout($hash,$sid); return};
# Start der Aufnahme # Start der Aufnahme
$apiextrecpath = $hash->{APIEXTRECPATH}; $apiextrecpath = $hash->{APIEXTRECPATH};
@ -221,7 +199,7 @@ sub camstart {
# Evaluiere ob Daten im JSON-Format empfangen # Evaluiere ob Daten im JSON-Format empfangen
($hash, $success) = &evaljson($hash,$myjson,$url); ($hash, $success) = &evaljson($hash,$myjson,$url);
unless ($success eq "true") {&serverlogout($hash,$sid); return}; unless ($success == 1) {&serverlogout($hash,$sid); return};
# Logausgabe # Logausgabe
$logstr = "URL call: $url"; $logstr = "URL call: $url";
@ -234,7 +212,7 @@ sub camstart {
$success = $data->{'success'}; $success = $data->{'success'};
if ($success eq "true") { if ($success == 1) {
# die URL konnte erfolgreich aufgerufen werden # die URL konnte erfolgreich aufgerufen werden
# Setreading # Setreading
@ -321,14 +299,14 @@ sub camstop {
# API-Pfade und MaxVersions ermitteln # API-Pfade und MaxVersions ermitteln
($hash, $success) = &getapisites($hash); ($hash, $success) = &getapisites($hash);
unless ($success eq "true") {return}; unless ($success == 1) {return};
# SID ermitteln nach Login # SID ermitteln nach Login
($sid, $success) = &serverlogin($hash); ($sid, $success) = &serverlogin($hash);
unless ($success eq "true") {return}; unless ($success == 1) {return};
($camid, $success) = &getcamid($hash,$sid); ($camid, $success) = &getcamid($hash,$sid);
unless ($success eq "true") {&serverlogout($hash,$sid); return}; unless ($success == 1) {&serverlogout($hash,$sid); return};
$apiextrecpath = $hash->{APIEXTRECPATH}; $apiextrecpath = $hash->{APIEXTRECPATH};
$apiextrecmaxver = $hash->{APIEXTRECMAXVER}; $apiextrecmaxver = $hash->{APIEXTRECMAXVER};
@ -339,7 +317,7 @@ sub camstop {
# Evaluiere ob Daten im JSON-Format empfangen # Evaluiere ob Daten im JSON-Format empfangen
($hash, $success) = &evaljson($hash,$myjson,$url); ($hash, $success) = &evaljson($hash,$myjson,$url);
unless ($success eq "true") {&serverlogout($hash,$sid); return}; unless ($success == 1) {&serverlogout($hash,$sid); return};
# Logausgabe # Logausgabe
$logstr = "URL call: $url"; $logstr = "URL call: $url";
@ -351,7 +329,7 @@ sub camstop {
my $data = decode_json($myjson); my $data = decode_json($myjson);
$success = $data->{'success'}; $success = $data->{'success'};
if ($success eq "true") { if ($success == 1) {
# die URL konnte erfolgreich aufgerufen werden # die URL konnte erfolgreich aufgerufen werden
# Setreading # Setreading
@ -427,7 +405,7 @@ sub serverlogin {
# Evaluiere ob Daten im JSON-Format empfangen # Evaluiere ob Daten im JSON-Format empfangen
($hash, $success) = &evaljson($hash,$myjson,$loginurl); ($hash, $success) = &evaljson($hash,$myjson,$loginurl);
unless ($success eq "true") {return($sid, $success)}; unless ($success == 1) {return($sid, $success)};
# Logausgabe # Logausgabe
$logstr = "URL call: $loginurl"; $logstr = "URL call: $loginurl";
@ -440,7 +418,7 @@ sub serverlogin {
$success = $data->{'success'}; $success = $data->{'success'};
# der login war erfolgreich # der login war erfolgreich
if ($success eq "true") { if ($success == 1) {
$sid = $data->{'data'}->{'sid'}; $sid = $data->{'data'}->{'sid'};
# Setreading # Setreading
@ -508,7 +486,7 @@ sub serverlogout {
# Evaluiere ob Daten im JSON-Format empfangen # Evaluiere ob Daten im JSON-Format empfangen
($hash, $success) = &evaljson($hash,$myjson,$logouturl); ($hash, $success) = &evaljson($hash,$myjson,$logouturl);
unless ($success eq "true") {return}; unless ($success == 1) {return};
# Logausgabe # Logausgabe
$logstr = "URL call: $logouturl"; $logstr = "URL call: $logouturl";
@ -520,7 +498,7 @@ sub serverlogout {
$data = decode_json($myjson); $data = decode_json($myjson);
$success = $data->{'success'}; $success = $data->{'success'};
if ($success eq "true") { if ($success == 1) {
# die URL konnte erfolgreich aufgerufen werden # die URL konnte erfolgreich aufgerufen werden
# Logausgabe # Logausgabe
@ -549,13 +527,13 @@ return;
sub evaljson { sub evaljson {
my ($hash,$myjson,$url)= @_; my ($hash,$myjson,$url)= @_;
my $success = "true"; my $success = 1;
my $e; my $e;
my $logstr; my $logstr;
eval {decode_json($myjson);1;} or do eval {decode_json($myjson);1;} or do
{ {
$success = "false"; $success = 0;
$e = $@; $e = $@;
# Setreading # Setreading
@ -610,7 +588,7 @@ sub getcamid {
# Evaluiere ob Daten im JSON-Format empfangen # Evaluiere ob Daten im JSON-Format empfangen
($hash, $success) = &evaljson($hash,$myjson,$url); ($hash, $success) = &evaljson($hash,$myjson,$url);
unless ($success eq "true") {return($camid,$success)}; unless ($success == 1) {return($camid,$success)};
# Logausgabe # Logausgabe
$logstr = "URL call: $url"; $logstr = "URL call: $url";
@ -623,7 +601,7 @@ sub getcamid {
$success = $data->{'success'}; $success = $data->{'success'};
if ($success eq "true") { if ($success == 1) {
# die Liste aller Kameras konnte ausgelesen werden # die Liste aller Kameras konnte ausgelesen werden
# Anzahl der definierten Kameras ist in Var "total" # Anzahl der definierten Kameras ist in Var "total"
$camcount = $data->{'data'}->{'total'}; $camcount = $data->{'data'}->{'total'};
@ -652,7 +630,7 @@ sub getcamid {
# Logausgabe # Logausgabe
$logstr = "ERROR - Cameraname $camname wasn't found in Surveillance Station. Check Cameraname and Spelling."; $logstr = "ERROR - Cameraname $camname wasn't found in Surveillance Station. Check Cameraname and Spelling.";
&printlog($hash,$logstr,"1"); &printlog($hash,$logstr,"1");
$success = "false"; $success = 0;
} }
} }
else { else {
@ -860,7 +838,7 @@ sub getapisites {
# Evaluiere ob Daten im JSON-Format empfangen # Evaluiere ob Daten im JSON-Format empfangen
($hash, $success) = &evaljson($hash,$myjson,$url); ($hash, $success) = &evaljson($hash,$myjson,$url);
unless ($success eq "true") {return($hash,$success)}; unless ($success == 1) {return($hash,$success)};
# Logausgabe # Logausgabe
$logstr = "URL call: $url"; $logstr = "URL call: $url";
@ -870,10 +848,11 @@ sub getapisites {
# Response erfolgt im JSON Format # Response erfolgt im JSON Format
$data = decode_json($myjson); $data = decode_json($myjson);
$success = $data->{'success'}; $success = $data->{'success'};
if ($success eq "true") { if ($success == 1) {
# Pfad und Maxversion von "SYNO.API.Auth" ermitteln # Pfad und Maxversion von "SYNO.API.Auth" ermitteln