2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-04 01:53:19 +00:00

23_KOSTALPIKO.pm : feature: Support of https

git-svn-id: https://svn.fhem.de/fhem/trunk@15368 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
John 2017-10-31 19:00:55 +00:00
parent 0fb1ff4660
commit 8aceebbd97

View File

@ -39,8 +39,8 @@
# 2014-12-22 john V2.06 : checked HTML # 2014-12-22 john V2.06 : checked HTML
# 2015-01-25 john V2.07 : adjusted argument agent for http-request of proplanta (thanks to framller) # 2015-01-25 john V2.07 : adjusted argument agent for http-request of proplanta (thanks to framller)
# 2016-02-25 john V2.08 : support of Piko 7 with only 2 strings instead of 3 (thanks to erwin) # 2016-02-25 john V2.08 : support of Piko 7 with only 2 strings instead of 3 (thanks to erwin)
# 2016-02-25 john V2.09 : substitution of term given/when with if/then
# 2017-19-26 john V2.10 : support of https
#################################################################################################### ####################################################################################################
# -------------------------------------------- # --------------------------------------------
@ -292,7 +292,7 @@ use vars qw($readingFnAttributes);
use vars qw(%defs); use vars qw(%defs);
my $MODUL = "KOSTALPIKO"; my $MODUL = "KOSTALPIKO";
my $KOSTAL_VERSION = "2.08"; my $KOSTAL_VERSION = "2.10";
######################################## ########################################
sub KOSTALPIKO_Log($$$) sub KOSTALPIKO_Log($$$)
@ -373,44 +373,36 @@ sub KOSTALPIKO_Set($@)
return $usage if ( @a < 2 ); return $usage if ( @a < 2 );
my $cmd = lc( $a[1] ); my $cmd = lc( $a[1] );
given ($cmd)
if ( $cmd eq "?" )
{ {
when ("?") return $usage;
{ } elsif ( $cmd eq "capturekostaldata" )
return $usage; {
} KOSTALPIKO_Log $hash, 3, "set command: " . $a[1] . " para:" . $hash->{helper}{TimerStatus};
when ("capturekostaldata") KOSTALPIKO_StatusStart($hash);
{ } elsif ( $cmd eq "captureglobalradiation" )
KOSTALPIKO_Log $hash, 3, "set command: " . $a[1] . " para:" . $hash->{helper}{TimerStatus}; {
KOSTALPIKO_StatusStart($hash); KOSTALPIKO_Log $hash, 3, "set command: " . $a[1];
} KOSTALPIKO_GrStart($hash);
when ("captureglobalradiation") } elsif ( $cmd eq "test" )
{ {
KOSTALPIKO_Log $hash, 3, "set command: " . $a[1]; KOSTALPIKO_Log $hash, 3, "set command: " . $a[1];
KOSTALPIKO_GrStart($hash); KOSTALPIKO_GrStart($hash);
} } elsif ( $cmd eq "sleeper" )
when ("test") {
{ return "Set sleeper needs a <value> parameter"
KOSTALPIKO_Log $hash, 3, "set command: " . $a[1]; if ( @a != 3 );
KOSTALPIKO_GrStart($hash); my $value = $a[2];
} $value = ( $value =~ m/$reUINT/ ) ? $1 : undef;
return "value " . $a[2] . " is not a number"
if ( !defined($value) );
when ("sleeper") KOSTALPIKO_Log $hash, 3, "set command: " . $a[1] . " value:" . $a[2];
{ $hash->{helper}{Sleeper} = $a[2];
return "Set sleeper needs a <value> parameter" } else
if ( @a != 3 ); {
my $value = $a[2]; return $usage;
$value = ( $value =~ m/$reUINT/ ) ? $1 : undef;
return "value " . $a[2] . " is not a number"
if ( !defined($value) );
KOSTALPIKO_Log $hash, 3, "set command: " . $a[1] . " value:" . $a[2];
$hash->{helper}{Sleeper} = $a[2];
}
default
{
return $usage;
}
} }
return; return;
} }
@ -890,7 +882,7 @@ sub KOSTALPIKO_GrHtmlAcquire($)
my $agent = LWP::UserAgent->new( my $agent = LWP::UserAgent->new(
env_proxy => 1, env_proxy => 1,
keep_alive => 1, keep_alive => 1,
protocols_allowed => ['http'], protocols_allowed => ['http','https'],
timeout => 10, timeout => 10,
agent => "Mozilla/5.0 (Windows NT 5.1) [de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4]" agent => "Mozilla/5.0 (Windows NT 5.1) [de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4]"
); );
@ -1077,6 +1069,7 @@ sub KOSTALPIKO_GrTimer($)
1; 1;
=pod =pod
=item summary Module for Kostal Piko Inverter
=begin html =begin html