30_MilightBridge: Add tcpPing mode (MarkusM)

git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@9070 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
mattwire
2015-08-14 22:28:51 +00:00
parent cc9ee541e8
commit af6ca0548f
2 changed files with 10 additions and 1 deletions

View File

@@ -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: 30_MilightBridge: Add tcpPing mode (MarkusM)
- change: 98_pilight: all protocols, rewrite
- feature: 70_PHTV: added support for WoWifi/WoLAN to wake device up
- change: 98_GEOFANCY: improved/tightened input validation. 3rd party mobile

View File

@@ -47,7 +47,7 @@ sub MilightBridge_Initialize($)
$hash->{UndefFn} = "MilightBridge_Undefine";
$hash->{NotifyFn} = "MilightBridge_Notify";
$hash->{AttrFn} = "MilightBridge_Attr";
$hash->{AttrList} = "port sendInterval disable:0,1 checkInterval ".$readingFnAttributes;
$hash->{AttrList} = "port sendInterval disable:0,1 tcpPing:1 checkInterval ".$readingFnAttributes;
return undef;
}
@@ -205,6 +205,10 @@ sub MilightBridge_State(@)
# check via ping
my $pingstatus = "unreachable";
my $p = Net::Ping->new('udp');
if(defined($attr{$hash->{NAME}}{tcpPing}))
{
$p = Net::Ping->new('tcp');
}
my $alive = $p->ping($hash->{HOST}, 2);
$p->close();
$pingstatus = "ok" if $alive;
@@ -396,6 +400,10 @@ sub MilightBridge_CmdQueue_Send(@)
<b>port</b><br/>
Default: 8899. Older bridges (V2) used port 50000 so change this value if you have an old bridge.
</li>
<li>
<b>tcpPing</b><br/>
If this attribute is defined, ping will use TCP instead of UDP.
</li>
</ul>
</ul>