From d3e38ba7dcdf633dc24b363d65606ad159ccd06b Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Sun, 6 Mar 2016 20:42:54 +0000 Subject: [PATCH] 49_SSCAM: Reading "CamLastRec" added which contains Path/name of last recording git-svn-id: https://svn.fhem.de/fhem/trunk@11019 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/49_SSCam.pm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/fhem/FHEM/49_SSCam.pm b/fhem/FHEM/49_SSCam.pm index 0d3cc49ba..e7feba246 100644 --- a/fhem/FHEM/49_SSCam.pm +++ b/fhem/FHEM/49_SSCam.pm @@ -3036,13 +3036,17 @@ sub camret_nonbl ($) { { my $eventnum = $data->{'data'}{'total'}; my $lastrecord = $data->{'data'}{'events'}[0]{name}; - my $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 ; + my ($lastrecstarttime,$lastrecstoptime); - my $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 ; + 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 ; + + $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 ; + } # Setreading readingsBeginUpdate($hash);