From bbd3dc74c54a5d38d3b37d04ed45bfa41f75f2c4 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Tue, 5 Feb 2019 21:50:23 +0000 Subject: [PATCH] 49_IPCAM.pm: patch from delmar to support https (Forum #96040) git-svn-id: https://svn.fhem.de/fhem/trunk@18505 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/49_IPCAM.pm | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/fhem/FHEM/49_IPCAM.pm b/fhem/FHEM/49_IPCAM.pm index a9e6f2dc4..9d7dcba5d 100644 --- a/fhem/FHEM/49_IPCAM.pm +++ b/fhem/FHEM/49_IPCAM.pm @@ -28,6 +28,7 @@ use warnings; sub IPCAM_getSnapshot($); sub IPCAM_guessFileFormat($); +sub IPCAM_getScheme($); my %gets = ( "image" => "", @@ -59,7 +60,7 @@ IPCAM_Initialize($$) "cmdPos09 cmdPos10 cmdPos11 cmdPos12 cmdPos13 cmdPos14 cmdPos15 cmdPosHome ". "cmd01 cmd02 cmd03 cmd04 cmd05 cmd06 cmd07 cmd08 ". "cmd09 cmd10 cmd11 cmd12 cmd13 cmd14 cmd15 ". - "do_not_notify:1,0 showtime:1,0 ". + "do_not_notify:1,0 showtime:1,0 scheme:http,https ". "loglevel:0,1,2,3,4,5,6 disable:0,1 ". $readingFnAttributes; } @@ -202,10 +203,12 @@ IPCAM_Set($@) { return "Missing a path value for camURI. Please set attribute 'path', 'pathCmd' and/or 'pathPanTilt' first." if(!$camPath && $cmd ne "raw"); + my $scheme = IPCAM_getScheme($hash); + if($basicauth) { - $camURI = "http://$basicauth" . "@" . "$camAuth/$camPath"; + $camURI = "$scheme://$basicauth" . "@" . "$camAuth/$camPath"; } else { - $camURI = "http://$camAuth/$camPath"; + $camURI = "$scheme://$camAuth/$camPath"; } if($cmd eq "cmd" && defined($attr{$name}{pathCmd})) { @@ -348,10 +351,11 @@ IPCAM_getSnapshot($) { $camQuery = $attr{$name}{query} if(defined($attr{$name}{query}) && $attr{$name}{query} ne ""); + my $scheme = IPCAM_getScheme($hash); if($basicauth) { - $camURI = "http://$basicauth" . "@" . "$camAuth/$camPath"; + $camURI = "$scheme://$basicauth" . "@" . "$camAuth/$camPath"; } else { - $camURI = "http://$camAuth/$camPath"; + $camURI = "$scheme://$camAuth/$camPath"; } $camURI .= "?$camQuery" if($camQuery); @@ -439,6 +443,15 @@ IPCAM_getSnapshot($) { return undef; } +##################################### +sub +IPCAM_getScheme($) { + my ($hash) = @_; + my $name = $hash->{NAME}; + + return AttrVal($name, 'scheme', 'http'); +} + ##################################### sub IPCAM_guessFileFormat($) { @@ -472,6 +485,8 @@ IPCAM_guessFileFormat($) { 1; =pod +=item summary network camera device to trigger snapshots on events +=item summary_DE Anbindung von Netzwerkkameras um snapshots auszulösen =begin html @@ -729,6 +744,14 @@ IPCAM_guessFileFormat($) { attr ipcam3 pathPanTilt decoder_control.cgi?user={USERNAME}&pwd={PASSWORD}
  • showtime
  • +
  • + scheme
    + Defines the URI-Scheme for generating the download path.
    + If this attribute is not defined, then the default value is http. + Default: http
    + Example:
    + attr ipcam3 scheme https +
  • snapshots
    Defines the total number of snapshots to be taken with the get <name> image command.