From 965ef257fc579049f3bb6ce8290d299f7c899a9a Mon Sep 17 00:00:00 2001 From: zap <> Date: Fri, 28 Dec 2018 08:39:14 +0000 Subject: [PATCH] FULLY: Added HTTPS support git-svn-id: https://svn.fhem.de/fhem/trunk@18074 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/89_FULLY.pm | 42 +++++++++++++++++++++++++++++++----------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index eb3fc5239..282b321cc 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. + - feature: 89_FULLY: Support for HTTPS added - change: DOIFtools: add DOIF's weekday 9 to next timer - feature: 34_ESPEasy: improved deepsleep support - feature: 73_AutoShuttersControl: add maxBrightness for morning open diff --git a/fhem/FHEM/89_FULLY.pm b/fhem/FHEM/89_FULLY.pm index 8500439f7..bb22d0ca9 100755 --- a/fhem/FHEM/89_FULLY.pm +++ b/fhem/FHEM/89_FULLY.pm @@ -1,6 +1,6 @@ ############################################################################## # -# 89_FULLY.pm 0.9.001 +# 89_FULLY.pm 0.9.002 # # $Id$ # @@ -35,11 +35,22 @@ sub FULLY_Abort ($); sub FULLY_UpdateReadings ($$); sub FULLY_Ping ($$); -my $FULLY_VERSION = "0.9.001"; +my $FULLY_VERSION = "0.9.002"; + +# Timeout for Fully requests my $FULLY_TIMEOUT = 4; + +# Polling interval my $FULLY_POLL_INTERVAL = 3600; +my @FULLY_POLL_RANGE = (10, 86400); + +# Minimum version of Fully app my $FULLY_REQUIRED_VERSION = 1.27; +# Default protocol and port for Fully requests +my $FULLY_DEFAULT_PROT = 'http'; +my $FULLY_DEFAULT_PORT = '2323'; + my $FULLY_FHEM_COMMAND = qq( function SendRequest(FHEM_Address, Devicename, Command) { var Port = "8085" @@ -76,9 +87,9 @@ sub FULLY_Initialize ($) $readingFnAttributes; } -################################################## +###################################################################### # Define device -################################################## +###################################################################### sub FULLY_Define ($$) { @@ -86,12 +97,21 @@ sub FULLY_Define ($$) my $name = $hash->{NAME}; my $rc = 0; - return "Usage: define devname FULLY IP_or_Hostname password [poll-interval]" + return "Usage: define devname [http|https]://IP_or_Hostname password [poll-interval]" if (@$a < 4); return "FULLY: polling interval must be in range 10 - 86400" - if (@$a == 5 && ($$a[4] !~ /^[1-9][0-9]+$/ || $$a[4] < 10 || $$a[4] > 86400)); + if (@$a == 5 && + ($$a[4] !~ /^[1-9][0-9]+$/ || $$a[4] < $FULLY_POLL_RANGE[0] || $$a[4] > $FULLY_POLL_RANGE[1])); - $hash->{host} = $$a[2]; + if ($$a[2] =~ /^(https?):\/\/(.+)/) { + $hash->{prot} = $1; + $hash->{host} = $2; + } + else { + $hash->{prot} = $FULLY_DEFAULT_PROT; + $hash->{host} = $$a[2]; + } + $hash->{port} = $FULLY_DEFAULT_PORT; $hash->{version} = $FULLY_VERSION; $hash->{onForTimer} = 'off'; $hash->{fully}{password} = $$a[3]; @@ -116,9 +136,9 @@ sub FULLY_Define ($$) return undef; } -##################################### +###################################################################### # Set or delete attribute -##################################### +###################################################################### sub FULLY_Attr ($@) { @@ -200,7 +220,7 @@ sub FULLY_Detail ($@)