From 51d017bb754f1d6f892c92e960b5351655dfc3a6 Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Tue, 14 Apr 2020 20:02:29 +0000 Subject: [PATCH] 49_SSCam: fix autocreate bug with https git-svn-id: https://svn.fhem.de/fhem/trunk@21684 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/49_SSCam.pm | 43 ++++++++++++++++++++++++------------------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 8e86e9158..773b6e8aa 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # 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. + - bugfix: 49_SSCam: fix autocreate bug with https - change: 37_echodevice.pm more loginformations set "NPM_login new" - bugfix: 88_HMCCU: corrected var command - bugfix: 73_AutoShuttersControl: fix roommate absent diff --git a/fhem/FHEM/49_SSCam.pm b/fhem/FHEM/49_SSCam.pm index e4e4342ab..8a6c82d3d 100644 --- a/fhem/FHEM/49_SSCam.pm +++ b/fhem/FHEM/49_SSCam.pm @@ -54,6 +54,7 @@ eval "use Cache::Cache;1;" or my $SScamMMCacheCache = "Cache::Cache"; # Versions History intern our %SSCam_vNotesIntern = ( + "9.2.2" => "14.04.2020 increase read timeout of Redis server cache, fix autocreate bug with https ", "9.2.1" => "24.02.2020 set compatibility to SVS version 8.2.7 ", "9.2.0" => "10.12.2019 attribute \"recChatTxt\" for sending recordings by SSChatBot ", "9.1.0" => "08.12.2019 attribute \"snapChatTxt\" for sending snapshots by SSChatBot ", @@ -5887,8 +5888,7 @@ sub SSCam_camop_parse ($) { } } } else { - for my $kn ($ss..($sgn-1)) { - # next if $kn >= $hash->{HELPER}{SNAPLIMIT}; + for my $kn ($ss..($sgn-1)) { $g = SSCam_cache($name, "c_read", "{SNAPOLDHASH}{$sn}{snapid}"); SSCam_cache($name, "c_write", "{SNAPHASH}{$kn}{snapid}", $g) if(defined $g); SSCam_cache($name, "c_remove", "{SNAPOLDHASH}{$sn}{snapid}"); @@ -6963,23 +6963,23 @@ sub SSCam_Autocreate ($$) { if(!$camhash) { $camname = "SSCam.".makeDeviceName($sn); # erlaubten Kameranamen für FHEM erzeugen - my $arg = $hash->{SERVERADDR}." ".$hash->{SERVERPORT}; - $cmd = "$camname $type $sn $arg"; + my $arg = $hash->{SERVERADDR}." ".$hash->{SERVERPORT}." ".$hash->{PROTOCOL}; + $cmd = "$camname $type $sn $arg"; Log3($name, 2, "$name - Autocreate camera: define $cmd"); - $err = CommandDefine(undef, $cmd); + $err = CommandDefine(undef, $cmd); if($err) { Log3($name, 1, "ERROR: $err"); } else { - my $room = AttrVal($name, "room", "SSCam"); - my $session = AttrVal($name, "session", "DSM"); - CommandAttr(undef,"$camname room $room"); - CommandAttr(undef,"$camname session $session"); - CommandAttr(undef,"$camname icon it_camera"); - CommandAttr(undef,"$camname devStateIcon .*isable.*:set_off .*nap:li_wht_on"); - CommandAttr(undef,"$camname pollcaminfoall 210"); - CommandAttr(undef,"$camname pollnologging 1"); - CommandAttr(undef,"$camname httptimeout 20"); + my $room = AttrVal($name, "room", "SSCam"); + my $session = AttrVal($name, "session", "DSM"); + CommandAttr (undef,"$camname room $room"); + CommandAttr (undef,"$camname session $session"); + CommandAttr (undef,"$camname icon it_camera"); + CommandAttr (undef,"$camname devStateIcon .*isable.*:set_off .*nap:li_wht_on"); + CommandAttr (undef,"$camname pollcaminfoall 210"); + CommandAttr (undef,"$camname pollnologging 1"); + CommandAttr (undef,"$camname httptimeout 20"); # Credentials abrufen und setzen my ($success, $username, $password) = SSCam_getcredentials($hash,0,"svs"); @@ -10149,8 +10149,8 @@ sub SSCam_cache ($$;$$) { return 0; } my $cto = 0.5; - my $rto = 0.5; - my $wto = 0.5; + my $rto = 2.0; + my $wto = 1.0; my %Redispars = ( cnx_timeout => $cto, read_timeout => $rto, write_timeout => $wto @@ -10176,6 +10176,7 @@ sub SSCam_cache ($$;$$) { $cache = CHI->new( driver => 'Redis', namespace => $fuuid, server => "$server:$port", + reconnect => 1, on_set_error => 'warn', on_get_error => 'warn', redis_options => \%Redispars, @@ -10277,9 +10278,13 @@ sub SSCam_cache ($$;$$) { # aus Cache lesen if($op eq "c_read") { my $g = $cache->get($key); - $brt = tv_interval($bst); - Log3($name, 1, "$name - Cache time read key \"$key\": ".$brt) if(AttrVal($name,"debugCachetime",0)); - return $g; + $brt = tv_interval($bst); + Log3($name, 1, "$name - Cache time read key \"$key\": ".$brt) if(AttrVal($name,"debugCachetime",0)); + if(!$g) { + return ""; + } else { + return $g; + } } # einen Key entfernen