diff --git a/82_LGTV_WebOS.pm b/82_LGTV_WebOS.pm index 82d0d21..4da8fcf 100644 --- a/82_LGTV_WebOS.pm +++ b/82_LGTV_WebOS.pm @@ -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 ". "pingPresence:1 ". "wakeOnLanMAC ". + "wakeOnLanBroadcast ". $readingFnAttributes; @@ -437,8 +438,8 @@ sub LGTV_WebOS_Set($@) { if($cmd eq 'off') { $uri = $lgCommands{powerOff}; } elsif ($cmd eq 'on') { - if( AttrVal($name,'wakeOnLanMAC','none') ne 'none') { - LGTV_WebOS_WakeUp_Udp($hash,AttrVal($name,'wakeOnLanMAC',0),$hash->{HOST}); + if( AttrVal($name,'wakeOnLanMAC','none') ne 'none' and AttrVal($name,'wakeOnLanBroadcast','none') ne 'none') { + LGTV_WebOS_WakeUp_Udp($hash,AttrVal($name,'wakeOnLanMAC',0),AttrVal($name,'wakeOnLanBroadcast',0)); return; } else { $uri = $lgCommands{powerOn}; @@ -1422,8 +1423,10 @@ sub LGTV_WebOS_WakeUp_Udp($@) { my ($hash,$mac_addr,$host,$port) = @_; my $name = $hash->{NAME}; + $host = '255.255.255.255' if (!defined $host); + # 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 : $!"; if(!$sock) {