mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-26 10:34:52 +00:00
FULLY: Accepts port in device definition
git-svn-id: https://svn.fhem.de/fhem/trunk@22297 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
afff7d1df9
commit
34dd3c27f7
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# 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.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- change: 89_FULLY: Accepts port number in device definition
|
||||||
- change: 93_DbRep: improve get <> versionNotes 2
|
- change: 93_DbRep: improve get <> versionNotes 2
|
||||||
- change: 76_SMAPortal: imptove cookie/login management
|
- change: 76_SMAPortal: imptove cookie/login management
|
||||||
- feature: 49_SSCam / 49_SSCamSTRM: new capability operate PTZ Zoom cameras
|
- feature: 49_SSCam / 49_SSCamSTRM: new capability operate PTZ Zoom cameras
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
# 89_FULLY.pm 1.40
|
# 89_FULLY.pm 1.41
|
||||||
#
|
#
|
||||||
# $Id$
|
# $Id$
|
||||||
#
|
#
|
||||||
# Control Fully browser on Android tablets from FHEM.
|
# Control Fully browser on Android tablets from FHEM.
|
||||||
# Requires Fully App Plus license!
|
# Requires Fully App Plus license!
|
||||||
#
|
#
|
||||||
# (c) 2019 by zap (zap01 <at> t-online <dot> de)
|
# (c) 2020 by zap (zap01 <at> t-online <dot> de)
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ sub FULLY_ProcessDeviceInfo ($$);
|
|||||||
sub FULLY_UpdateReadings ($$);
|
sub FULLY_UpdateReadings ($$);
|
||||||
sub FULLY_Ping ($$);
|
sub FULLY_Ping ($$);
|
||||||
|
|
||||||
my $FULLY_VERSION = "1.40";
|
my $FULLY_VERSION = '1.41';
|
||||||
|
|
||||||
# Timeout for Fully requests
|
# Timeout for Fully requests
|
||||||
my $FULLY_TIMEOUT = 5;
|
my $FULLY_TIMEOUT = 5;
|
||||||
@ -99,6 +99,7 @@ sub FULLY_Define ($$)
|
|||||||
my ($hash, $a, $h) = @_;
|
my ($hash, $a, $h) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $rc = 0;
|
my $rc = 0;
|
||||||
|
my $host = '';
|
||||||
|
|
||||||
return "Usage: define devname [http|https]://IP_or_Hostname password [poll-interval]"
|
return "Usage: define devname [http|https]://IP_or_Hostname password [poll-interval]"
|
||||||
if (@$a < 4);
|
if (@$a < 4);
|
||||||
@ -108,14 +109,22 @@ sub FULLY_Define ($$)
|
|||||||
|
|
||||||
if ($$a[2] =~ /^(https?):\/\/(.+)/) {
|
if ($$a[2] =~ /^(https?):\/\/(.+)/) {
|
||||||
$hash->{prot} = $1;
|
$hash->{prot} = $1;
|
||||||
$hash->{host} = $2;
|
$host = $2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$hash->{prot} = $FULLY_DEFAULT_PROT;
|
$hash->{prot} = $FULLY_DEFAULT_PROT;
|
||||||
$hash->{host} = $$a[2];
|
$host = $$a[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($host =~ /^([^:]+):([0-9]+)$/) {
|
||||||
|
$hash->{host} = $1;
|
||||||
|
$hash->{port} = $2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$hash->{host} = $host;
|
||||||
|
$hash->{port} = $FULLY_DEFAULT_PORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hash->{port} = $FULLY_DEFAULT_PORT;
|
|
||||||
$hash->{version} = $FULLY_VERSION;
|
$hash->{version} = $FULLY_VERSION;
|
||||||
$hash->{onForTimer} = 'off';
|
$hash->{onForTimer} = 'off';
|
||||||
$hash->{fully}{password} = $$a[3];
|
$hash->{fully}{password} = $$a[3];
|
||||||
@ -266,8 +275,7 @@ sub FULLY_Set ($@)
|
|||||||
push (@c, $cmds{$opt});
|
push (@c, $cmds{$opt});
|
||||||
}
|
}
|
||||||
elsif ($opt eq 'on-for-timer') {
|
elsif ($opt eq 'on-for-timer') {
|
||||||
my $par = shift @$a;
|
my $par = shift @$a // "forever";
|
||||||
$par = "forever" if (!defined ($par));
|
|
||||||
|
|
||||||
if ($par eq 'forever') {
|
if ($par eq 'forever') {
|
||||||
push (@c, "setBooleanSetting", "screenOn");
|
push (@c, "setBooleanSetting", "screenOn");
|
||||||
@ -292,8 +300,7 @@ sub FULLY_Set ($@)
|
|||||||
$hash->{onForTimer} = $par;
|
$hash->{onForTimer} = $par;
|
||||||
}
|
}
|
||||||
elsif ($opt eq 'screenOffTimer') {
|
elsif ($opt eq 'screenOffTimer') {
|
||||||
my $value = shift @$a;
|
my $value = shift @$a // return "Usage: set $name $opt {seconds}";
|
||||||
return "Usage: set $name $opt {seconds}" if (!defined ($value));
|
|
||||||
push (@c, "setStringSetting");
|
push (@c, "setStringSetting");
|
||||||
push (@p, { "key" => "timeToScreenOffV2", "value" => "$value" });
|
push (@p, { "key" => "timeToScreenOffV2", "value" => "$value" });
|
||||||
}
|
}
|
||||||
@ -303,40 +310,34 @@ sub FULLY_Set ($@)
|
|||||||
push (@c, ($state eq 'start') ? "startScreensaver" : "stopScreensaver");
|
push (@c, ($state eq 'start') ? "startScreensaver" : "stopScreensaver");
|
||||||
}
|
}
|
||||||
elsif ($opt eq 'screenSaverTimer') {
|
elsif ($opt eq 'screenSaverTimer') {
|
||||||
my $value = shift @$a;
|
my $value = shift @$a // return "Usage: set $name $opt {seconds}";
|
||||||
return "Usage: set $name $opt {seconds}" if (!defined ($value));
|
|
||||||
push (@c, "setStringSetting");
|
push (@c, "setStringSetting");
|
||||||
push (@p, { "key" => "timeToScreensaverV2", "value" => "$value" });
|
push (@p, { "key" => "timeToScreensaverV2", "value" => "$value" });
|
||||||
}
|
}
|
||||||
elsif ($opt eq 'screenSaverURL') {
|
elsif ($opt eq 'screenSaverURL') {
|
||||||
my $value = shift @$a;
|
my $value = shift @$a // return "Usage: set $name $opt {URL}";
|
||||||
return "Usage: set $name $opt {URL}" if (!defined ($value));
|
|
||||||
push (@c, "setStringSetting");
|
push (@c, "setStringSetting");
|
||||||
push (@p, { "key" => "screensaverURL", "value" => "$value" });
|
push (@p, { "key" => "screensaverURL", "value" => "$value" });
|
||||||
}
|
}
|
||||||
elsif ($opt eq 'startURL') {
|
elsif ($opt eq 'startURL') {
|
||||||
my $value = shift @$a;
|
my $value = shift @$a // return "Usage: set $name $opt {URL}";
|
||||||
return "Usage: set $name $opt {URL}" if (!defined ($value));
|
|
||||||
push (@c, "setStringSetting");
|
push (@c, "setStringSetting");
|
||||||
push (@p, { "key" => "startURL", "value" => "$value" });
|
push (@p, { "key" => "startURL", "value" => "$value" });
|
||||||
}
|
}
|
||||||
elsif ($opt eq 'brightness') {
|
elsif ($opt eq 'brightness') {
|
||||||
my $value = shift @$a;
|
my $value = shift @$a // return "Usage: set $name brightness 0-255";
|
||||||
return "Usage: set $name brightness 0-255" if (!defined ($value));
|
|
||||||
$value = 255 if ($value > 255);
|
$value = 255 if ($value > 255);
|
||||||
push (@c, "setStringSetting");
|
push (@c, "setStringSetting");
|
||||||
push (@p, { "key" => "screenBrightness", "value" => "$value" });
|
push (@p, { "key" => "screenBrightness", "value" => "$value" });
|
||||||
}
|
}
|
||||||
elsif ($opt eq 'motionDetection') {
|
elsif ($opt eq 'motionDetection') {
|
||||||
my $state = shift @$a;
|
my $state = shift @$a // return "Usage: set $name motionDetection { on | off }";
|
||||||
return "Usage: set $name motionDetection { on | off }" if (!defined ($state));
|
|
||||||
my $value = $state eq 'on' ? 'true' : 'false';
|
my $value = $state eq 'on' ? 'true' : 'false';
|
||||||
push (@c, "setBooleanSetting");
|
push (@c, "setBooleanSetting");
|
||||||
push (@p, { "key" => "motionDetection", "value" => "$value" });
|
push (@p, { "key" => "motionDetection", "value" => "$value" });
|
||||||
}
|
}
|
||||||
elsif ($opt eq 'speak') {
|
elsif ($opt eq 'speak') {
|
||||||
my $text = shift @$a;
|
my $text = shift @$a // return 'Usage: set $name speak "{Text}"';
|
||||||
return 'Usage: set $name speak "{Text}"' if (!defined ($text));
|
|
||||||
while ($text =~ /\[(.+):(.+)\]/) {
|
while ($text =~ /\[(.+):(.+)\]/) {
|
||||||
my ($device, $reading) = ($1, $2);
|
my ($device, $reading) = ($1, $2);
|
||||||
my $value = ReadingsVal ($device, $reading, '');
|
my $value = ReadingsVal ($device, $reading, '');
|
||||||
@ -347,10 +348,9 @@ sub FULLY_Set ($@)
|
|||||||
push (@p, { "text" => "$enctext" });
|
push (@p, { "text" => "$enctext" });
|
||||||
}
|
}
|
||||||
elsif ($opt eq 'playSound') {
|
elsif ($opt eq 'playSound') {
|
||||||
my $url = shift @$a;
|
my $url = shift @$a // return "Usage: set $name playSound {url} [loop]";
|
||||||
my $loop = shift @$a;
|
my $loop = shift @$a;
|
||||||
$loop = defined ($loop) ? 'true' : 'false';
|
$loop = defined ($loop) ? 'true' : 'false';
|
||||||
return "Usage: set $name playSound {url} [loop]" if (!defined ($url));
|
|
||||||
push (@c, "playSound");
|
push (@c, "playSound");
|
||||||
push (@p, { "url" => "$url", "loop" => "$loop"});
|
push (@p, { "url" => "$url", "loop" => "$loop"});
|
||||||
}
|
}
|
||||||
@ -455,8 +455,8 @@ sub FULLY_Execute ($$$$)
|
|||||||
|
|
||||||
# Get attributes
|
# Get attributes
|
||||||
my $timeout = AttrVal ($name, 'requestTimeout', $FULLY_TIMEOUT);
|
my $timeout = AttrVal ($name, 'requestTimeout', $FULLY_TIMEOUT);
|
||||||
my $repeatCommand = min (AttrVal ($name, 'repeatCommand', 0), 2);
|
my $repeatCommand = minNum (AttrVal ($name, 'repeatCommand', 0), 2);
|
||||||
my $ping = min (AttrVal ($name, 'pingBeforeCmd', 0), 2);
|
my $ping = minNum (AttrVal ($name, 'pingBeforeCmd', 0), 2);
|
||||||
|
|
||||||
my $response = '';
|
my $response = '';
|
||||||
my $url = $hash->{prot}.'://'.$hash->{host}.':'.$hash->{port}."/?cmd=$command";
|
my $url = $hash->{prot}.'://'.$hash->{host}.':'.$hash->{port}."/?cmd=$command";
|
||||||
@ -493,8 +493,8 @@ sub FULLY_ExecuteNB ($$$$)
|
|||||||
|
|
||||||
# Get attributes
|
# Get attributes
|
||||||
my $timeout = AttrVal ($name, 'requestTimeout', $FULLY_TIMEOUT);
|
my $timeout = AttrVal ($name, 'requestTimeout', $FULLY_TIMEOUT);
|
||||||
my $repeatCommand = min (AttrVal ($name, 'repeatCommand', 0), 2);
|
my $repeatCommand = minNum (AttrVal ($name, 'repeatCommand', 0), 2);
|
||||||
my $ping = min (AttrVal ($name, 'pingBeforeCmd', 0), 2);
|
my $ping = minNum (AttrVal ($name, 'pingBeforeCmd', 0), 2);
|
||||||
|
|
||||||
my @urllist;
|
my @urllist;
|
||||||
my $nc = scalar (@$command);
|
my $nc = scalar (@$command);
|
||||||
@ -767,7 +767,7 @@ sub FULLY_Ping ($$)
|
|||||||
my $host = $hash->{host};
|
my $host = $hash->{host};
|
||||||
my $temp;
|
my $temp;
|
||||||
|
|
||||||
my $waitAfterPing = min (AttrVal ($name, 'waitAfterPing', 0), 2);
|
my $waitAfterPing = minNum (AttrVal ($name, 'waitAfterPing', 0), 2);
|
||||||
|
|
||||||
my $os = $^O;
|
my $os = $^O;
|
||||||
Log3 $name, 4, "FULLY: [$name] Sending $count ping request(s) to tablet $host. OS=$os";
|
Log3 $name, 4, "FULLY: [$name] Sending $count ping request(s) to tablet $host. OS=$os";
|
||||||
@ -809,10 +809,11 @@ sub FULLY_Ping ($$)
|
|||||||
<a name="HMCCUdefine"></a>
|
<a name="HMCCUdefine"></a>
|
||||||
<b>Define</b><br/><br/>
|
<b>Define</b><br/><br/>
|
||||||
<ul>
|
<ul>
|
||||||
<code>define <name> FULLY [<Protocol>://]<HostOrIP> <password> [<poll-interval>]</code>
|
<code>define <name> FULLY [<Protocol>://]<HostOrIP>[:<Port>] <password> [<poll-interval>]</code>
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
The parameter <i>password</i> is the password set in Fully browser. Parameter <i>Protocol</i> is
|
The parameter <i>password</i> is the password set in Fully browser. Parameter <i>Protocol</i> is
|
||||||
optional. Valid protocols are 'http' and 'https'. Default protocol is 'http'.
|
optional. Valid protocols are 'http' and 'https'. Default protocol is 'http'.
|
||||||
|
Default <i>Port</i> is 2323.
|
||||||
</ul>
|
</ul>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user