add attribut wakeOnLanBroadcast

This commit is contained in:
Marko Oldenburg 2017-09-18 13:30:04 +02:00
parent 336c3e39a3
commit d94690b16a

View File

@ -67,7 +67,7 @@ use Blocking;
my $version = "0.8.4"; my $version = "0.8.5";
@ -215,6 +215,7 @@ sub LGTV_WebOS_Initialize($) {
"channelGuide:1 ". "channelGuide:1 ".
"pingPresence:1 ". "pingPresence:1 ".
"wakeOnLanMAC ". "wakeOnLanMAC ".
"wakeOnLanBroadcast ".
$readingFnAttributes; $readingFnAttributes;
@ -437,8 +438,8 @@ sub LGTV_WebOS_Set($@) {
if($cmd eq 'off') { if($cmd eq 'off') {
$uri = $lgCommands{powerOff}; $uri = $lgCommands{powerOff};
} elsif ($cmd eq 'on') { } elsif ($cmd eq 'on') {
if( AttrVal($name,'wakeOnLanMAC','none') ne 'none') { if( AttrVal($name,'wakeOnLanMAC','none') ne 'none' and AttrVal($name,'wakeOnLanBroadcast','none') ne 'none') {
LGTV_WebOS_WakeUp_Udp($hash,AttrVal($name,'wakeOnLanMAC',0),$hash->{HOST}); LGTV_WebOS_WakeUp_Udp($hash,AttrVal($name,'wakeOnLanMAC',0),AttrVal($name,'wakeOnLanBroadcast',0));
return; return;
} else { } else {
$uri = $lgCommands{powerOn}; $uri = $lgCommands{powerOn};
@ -1422,8 +1423,10 @@ sub LGTV_WebOS_WakeUp_Udp($@) {
my ($hash,$mac_addr,$host,$port) = @_; my ($hash,$mac_addr,$host,$port) = @_;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
$host = '255.255.255.255' if (!defined $host);
# use the discard service if $port not passed in # use the discard service if $port not passed in
if (!defined $port || $port !~ /^\d+$/ ) { $port = 9 } $port = 9 if (!defined $port || $port !~ /^\d+$/ );
my $sock = new IO::Socket::INET(Proto=>'udp') or die "socket : $!"; my $sock = new IO::Socket::INET(Proto=>'udp') or die "socket : $!";
if(!$sock) { if(!$sock) {