From 9fe10fa904f244a5942b1fe1398701469686dbb8 Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Sun, 20 Jan 2019 16:07:48 +0000 Subject: [PATCH] 49_SSCam: contrib 8.6.1 git-svn-id: https://svn.fhem.de/fhem/trunk@18353 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/49_SSCam.pm | 83 +++++++++++++++++++---------- 1 file changed, 55 insertions(+), 28 deletions(-) diff --git a/fhem/contrib/DS_Starter/49_SSCam.pm b/fhem/contrib/DS_Starter/49_SSCam.pm index 35c37b76c..d157ab651 100644 --- a/fhem/contrib/DS_Starter/49_SSCam.pm +++ b/fhem/contrib/DS_Starter/49_SSCam.pm @@ -47,6 +47,7 @@ use Encode; # Versions History intern our %SSCam_vNotesIntern = ( + "8.6.1" => "20.01.2019 time format in readings and galleries depends from global language attribute ", "8.6.0" => "20.01.2019 new attribute snapReadingRotate ", "8.5.0" => "17.01.2019 SVS device has \"snapCams\" command ", "8.4.5" => "15.01.2019 fix event generation after request snapshots ", @@ -1941,6 +1942,7 @@ sub SSCam_wdpollcaminfo ($) { my $pcia = AttrVal($name,"pollcaminfoall",0); my $pnl = AttrVal($name,"pollnologging",0); my $watchdogtimer = 90; + my $lang = AttrVal("global","language","EN"); RemoveInternalTimer($hash, "SSCam_wdpollcaminfo"); @@ -1964,12 +1966,15 @@ sub SSCam_wdpollcaminfo ($) { SSCam_getcaminfoall($hash,0); } - my $lupd = ReadingsVal($name, "LastUpdateTime", 0); - if ($lupd) { - my ($year, $month, $mday, $hour, $min, $sec) = ($lupd =~ /(\d+)\.(\d+)\.(\d+) \/ (\d+):(\d+):(\d+)/); - $lupd = fhemTimeGm($sec, $min, $hour, $mday, $month, $year); + my $lupd = ReadingsVal($name, "LastUpdateTime", "1970-01-01 / 01:00:00"); + my ($year,$month,$mday,$hour,$min,$sec); + if ($lupd =~ /(\d+)\.(\d+)\.(\d+).*/) { + ($mday, $month, $year, $hour, $min, $sec) = ($lupd =~ /(\d+)\.(\d+)\.(\d+) \/ (\d+):(\d+):(\d+)/); + } else { + ($year, $month, $mday, $hour, $min, $sec) = ($lupd =~ /(\d+)-(\d+)-(\d+) \/ (\d+):(\d+):(\d+)/); } - if( gettimeofday() < ($lupd + $pcia + 20) ) { + $lupd = fhemTimeLocal($sec, $min, $hour, $mday, $month-=1, $year-=1900); + if( gettimeofday() > ($lupd + $pcia + 20) ) { SSCam_getcaminfoall($hash,0); } @@ -4638,6 +4643,8 @@ sub SSCam_camop_parse ($) { my ($percentage_camCap,$percentage_value,$percentage_ssCap); my ($objectSize_camCap,$objectSize_value,$objectSize_ssCap); + my $lang = AttrVal("global","language","EN"); + # Einstellung für Logausgabe Pollinginfos # wenn "pollnologging" = 1 -> logging nur bei Verbose=4, sonst 3 if (AttrVal($name, "pollnologging", 0) == 1) { @@ -5025,7 +5032,12 @@ sub SSCam_camop_parse ($) { } my @t = split(" ", FmtDateTime($data->{data}{data}[$k]{createdTm})); my @d = split("-", $t[0]); - my $createdTm = "$d[2].$d[1].$d[0] / $t[1]"; + my $createdTm; + if($lang eq "DE") { + $createdTm = "$d[2].$d[1].$d[0] / $t[1]"; + } else { + $createdTm = "$d[0]-$d[1]-$d[2] / $t[1]"; + } $snaps{$l}{createdTm} = $createdTm; $snaps{$l}{fileName} = $data->{data}{data}[$k]{fileName}; $snaps{$l}{snapid} = $data->{data}{data}[$k]{id}; @@ -5066,14 +5078,18 @@ sub SSCam_camop_parse ($) { next; } $snapid = $data->{data}{data}[$i]{id}; - my $createdTm = $data->{data}{data}[$i]{createdTm}; + my @t = split(" ", FmtDateTime($data->{data}{data}[$i]{createdTm})); + my @d = split("-", $t[0]); + my $createdTm; + if($lang eq "DE") { + $createdTm = "$d[2].$d[1].$d[0] / $t[1]"; + } else { + $createdTm = "$d[0]-$d[1]-$d[2] / $t[1]"; + } my $fileName = $data->{data}{data}[$i]{fileName}; my $imageData = $data->{data}{data}[$i]{imageData}; # Image data of snapshot in base64 format - $sendsnaps{$sn}{snapid} = $snapid; - my @t = split(" ", FmtDateTime($createdTm)); - my @d = split("-", $t[0]); - $createdTm = "$d[2].$d[1].$d[0] / $t[1]"; + $sendsnaps{$sn}{snapid} = $snapid; $sendsnaps{$sn}{createdTm} = $createdTm; $sendsnaps{$sn}{fileName} = $fileName; $sendsnaps{$sn}{".imageData"} = $imageData; @@ -5105,9 +5121,13 @@ sub SSCam_camop_parse ($) { my $imageData = $data->{data}{data}[$i]{imageData}; # Image data of snapshot in base64 format $allsnaps{$sn}{snapid} = $snapid; - my @t = split(" ", FmtDateTime($createdTm)); - my @d = split("-", $t[0]); - $createdTm = "$d[2].$d[1].$d[0] / $t[1]"; + my @t = split(" ", FmtDateTime($data->{data}{data}[$i]{createdTm})); + my @d = split("-", $t[0]); + if($lang eq "DE") { + $createdTm = "$d[2].$d[1].$d[0] / $t[1]"; + } else { + $createdTm = "$d[0]-$d[1]-$d[2] / $t[1]"; + } $allsnaps{$sn}{createdTm} = $createdTm; $allsnaps{$sn}{fileName} = $fileName; $allsnaps{$sn}{imageData} = $imageData; @@ -5486,7 +5506,11 @@ sub SSCam_camop_parse ($) { if ($camLiveMode eq "0") {$camLiveMode = "Liveview from DS";}elsif ($camLiveMode eq "1") {$camLiveMode = "Liveview from Camera";} ($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 ; + if($lang eq "DE") { + $update_time = sprintf "%02d.%02d.%04d / %02d:%02d:%02d" , $mday , $mon+=1 ,$year+=1900 , $hour , $min , $sec ; + } else { + $update_time = sprintf "%04d-%02d-%02d / %02d:%02d:%02d" , $year+=1900 , $mon+=1 , $mday , $hour , $min , $sec ; + } $deviceType = $data->{'data'}->{'cameras'}->[0]->{'deviceType'}; if ($deviceType eq "1") { @@ -5639,8 +5663,11 @@ sub SSCam_camop_parse ($) { if ($eventnum > 0) { $lastrecstarttime = $data->{'data'}{'events'}[0]{startTime}; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($lastrecstarttime); - $lastrecstarttime = sprintf "%02d.%02d.%04d / %02d:%02d:%02d" , $mday , $mon+=1 ,$year+=1900 , $hour , $min , $sec ; - + if($lang eq "DE") { + $lastrecstarttime = sprintf "%02d.%02d.%04d / %02d:%02d:%02d" , $mday , $mon+=1 ,$year+=1900 , $hour , $min , $sec ; + } else { + $lastrecstarttime = sprintf "%04d-%02d-%02d / %02d:%02d:%02d" , $year+=1900 , $mon+=1 , $mday , $hour , $min , $sec ; + } $lastrecstoptime = $data->{'data'}{'events'}[0]{stopTime}; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($lastrecstoptime); $lastrecstoptime = sprintf "%02d:%02d:%02d" , $hour , $min , $sec ; @@ -7119,7 +7146,7 @@ sub SSCam_composegallery ($;$$) { my $camname = $hash->{CAMNAME}; my $allsnaps = $hash->{HELPER}{".SNAPHASH"}; # = \%allsnaps my $sgc = AttrVal($name,"snapGalleryColumns",3); # Anzahl der Images in einer Tabellenzeile - my $lss = ReadingsVal($name, "LastSnapTime", " "); # Zeitpunkt neueste Aufnahme + my $lss = ReadingsVal($name, "LastSnapTime", ""); # Zeitpunkt neueste Aufnahme my $lang = AttrVal("global","language","EN"); # Systemsprache my $limit = $hash->{HELPER}{SNAPLIMIT}; # abgerufene Anzahl Snaps my $totalcnt = $hash->{HELPER}{TOTALCNT}; # totale Anzahl Snaps @@ -9498,7 +9525,7 @@ attr <name> genericStrmHtmlTag <video $HTMLATTR controls autoplay>
  • CamIP
  • - IP-Address of Camera
  • CamLastRec
  • - Path / name of last recording
  • CamLastRecId
  • - the ID of last recording -
  • CamLastRecTime
  • - date / starttime / endtime of the last recording +
  • CamLastRecTime
  • - date / starttime - endtime of the last recording (format depends of global attribute "language")
  • CamLiveFps
  • - Frames per second of Live-Stream
  • CamLiveMode
  • - Source of Live-View (DS, Camera)
  • camLiveQuality
  • - Live-Stream quality set in SVS @@ -9537,10 +9564,10 @@ attr <name> genericStrmHtmlTag <video $HTMLATTR controls autoplay>
  • Errorcode
  • - error code of last error
  • HomeModeState
  • - HomeMode-state (SVS-version 8.1.0 and above)
  • LastLogEntry
  • - the neweset entry of Surveillance Station Log (only if SVS-device and if attribute pollcaminfoall is set) -
  • LastSnapFilename
  • - the filename of the last snapshot -
  • LastSnapId
  • - the ID of the last snapshot -
  • LastSnapTime
  • - timestamp of the last snapshot -
  • LastUpdateTime
  • - date / time the last update of readings by "caminfoall" +
  • LastSnapFilename[x]
  • - the filename of the last snapshot or snapshots +
  • LastSnapId[x]
  • - the ID of the last snapshot or snapshots +
  • LastSnapTime[x]
  • - timestamp of the last snapshot or snapshots (format depends of global attribute "language") +
  • LastUpdateTime
  • - date / time the last update of readings by "caminfoall" (format depends of global attribute "language")
  • LiveStreamUrl
  • - the livestream URL if stream is started (is shown if attribute "showStmInfoFull" is set)
  • Patrols
  • - in Synology Surveillance Station predefined patrols (at PTZ-Cameras)
  • PollState
  • - shows the state of automatic polling @@ -11122,7 +11149,7 @@ attr <name> genericStrmHtmlTag <video $HTMLATTR controls autoplay>
  • CamIP
  • - IP-Adresse der Kamera
  • CamLastRec
  • - Pfad / Name der letzten Aufnahme
  • CamLastRecId
  • - die ID der letzten Aufnahme -
  • CamLastRecTime
  • - Datum / Startzeit - Stopzeit der letzten Aufnahme +
  • CamLastRecTime
  • - Datum / Startzeit - Stopzeit der letzten Aufnahme (Format abhängig vom global Attribut "language")
  • CamLiveFps
  • - Frames pro Sekunde des Live-Streams
  • CamLiveMode
  • - Quelle für Live-Ansicht (DS, Camera)
  • camLiveQuality
  • - in SVS eingestellte Live-Stream Qualität @@ -11161,10 +11188,10 @@ attr <name> genericStrmHtmlTag <video $HTMLATTR controls autoplay>
  • Errorcode
  • - Fehlercode des letzten Fehlers
  • HomeModeState
  • - HomeMode-Status (ab SVS-Version 8.1.0)
  • LastLogEntry
  • - der neueste Eintrag des Surveillance Station Logs (nur SVS-Device und wenn Attribut pollcaminfoall gesetzt) -
  • LastSnapFilename
  • - der Filename des letzten Schnapschusses -
  • LastSnapId
  • - die ID des letzten Schnapschusses -
  • LastSnapTime
  • - Zeitstempel des letzten Schnapschusses -
  • LastUpdateTime
  • - Datum / Zeit der letzten Aktualisierung durch "caminfoall" +
  • LastSnapFilename[x]
  • - der Filename des/der letzten Schnapschüsse +
  • LastSnapId[x]
  • - die ID des/der letzten Schnapschüsse +
  • LastSnapTime[x]
  • - Zeitstempel des/der letzten Schnapschüsse (Format abhängig vom global Attribut "language") +
  • LastUpdateTime
  • - Datum / Zeit der letzten Aktualisierung durch "caminfoall" (Format abhängig vom global Attribut "language")
  • LiveStreamUrl
  • - die LiveStream-Url wenn der Stream gestartet ist. (Attribut "showStmInfoFull" muss gesetzt sein)
  • Patrols
  • - in Surveillance Station voreingestellte Überwachungstouren (bei PTZ-Kameras)
  • PollState
  • - zeigt den Status des automatischen Pollings an