mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
after sending "on" to the wol_host, now the sending of magic packet follows at once.
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@4150 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
9c58a190b1
commit
c62a13a03b
@ -23,7 +23,7 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use IO::Socket;
|
use IO::Socket;
|
||||||
use Time::HiRes qw(gettimeofday);
|
use Time::HiRes qw(gettimeofday);
|
||||||
|
################################################################################
|
||||||
sub WOL_Initialize($)
|
sub WOL_Initialize($)
|
||||||
{
|
{
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
@ -34,9 +34,7 @@ sub WOL_Initialize($)
|
|||||||
$hash->{AttrList} = "interval shutdownCmd sysCmd ".
|
$hash->{AttrList} = "interval shutdownCmd sysCmd ".
|
||||||
$readingFnAttributes;
|
$readingFnAttributes;
|
||||||
}
|
}
|
||||||
#
|
################################################################################
|
||||||
#
|
|
||||||
#
|
|
||||||
sub WOL_Set($@)
|
sub WOL_Set($@)
|
||||||
{
|
{
|
||||||
my ($hash, @a) = @_;
|
my ($hash, @a) = @_;
|
||||||
@ -68,13 +66,11 @@ sub WOL_Set($@)
|
|||||||
InternalTimer(gettimeofday()+5, "WOL_UpdateReadings", $hash, 0);
|
InternalTimer(gettimeofday()+5, "WOL_UpdateReadings", $hash, 0);
|
||||||
|
|
||||||
if ($hash->{STATE} eq "on") {
|
if ($hash->{STATE} eq "on") {
|
||||||
InternalTimer(gettimeofday()+1, "WOL_GetUpdate", $hash, 0);
|
InternalTimer(gettimeofday(), "WOL_GetUpdate", $hash, 0);
|
||||||
}
|
}
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
#
|
################################################################################
|
||||||
#
|
|
||||||
#
|
|
||||||
sub WOL_Define($$)
|
sub WOL_Define($$)
|
||||||
{
|
{
|
||||||
my ($hash, $def) = @_;
|
my ($hash, $def) = @_;
|
||||||
@ -120,9 +116,7 @@ sub WOL_Define($$)
|
|||||||
readingsSingleUpdate($hash, "packet_via_UDP", "none",0);
|
readingsSingleUpdate($hash, "packet_via_UDP", "none",0);
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
#
|
################################################################################
|
||||||
#
|
|
||||||
#
|
|
||||||
sub WOL_Undef($$) {
|
sub WOL_Undef($$) {
|
||||||
|
|
||||||
my ($hash, $arg) = @_;
|
my ($hash, $arg) = @_;
|
||||||
@ -130,9 +124,7 @@ sub WOL_Undef($$) {
|
|||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
#
|
################################################################################
|
||||||
#
|
|
||||||
#
|
|
||||||
sub WOL_UpdateReadings($)
|
sub WOL_UpdateReadings($)
|
||||||
{
|
{
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
@ -151,9 +143,7 @@ sub WOL_UpdateReadings($)
|
|||||||
readingsEndUpdate($hash, defined($hash->{LOCAL} ? 0 : 1));
|
readingsEndUpdate($hash, defined($hash->{LOCAL} ? 0 : 1));
|
||||||
InternalTimer(gettimeofday()+$hash->{INTERVAL}, "WOL_UpdateReadings", $hash, 0);
|
InternalTimer(gettimeofday()+$hash->{INTERVAL}, "WOL_UpdateReadings", $hash, 0);
|
||||||
}
|
}
|
||||||
#
|
################################################################################
|
||||||
#
|
|
||||||
#
|
|
||||||
sub WOL_GetUpdate($)
|
sub WOL_GetUpdate($)
|
||||||
{
|
{
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
@ -166,9 +156,7 @@ sub WOL_GetUpdate($)
|
|||||||
InternalTimer(gettimeofday()+$hash->{REPEAT}, "WOL_GetUpdate", $hash, 0);
|
InternalTimer(gettimeofday()+$hash->{REPEAT}, "WOL_GetUpdate", $hash, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#
|
################################################################################
|
||||||
#
|
|
||||||
#
|
|
||||||
sub wake($)
|
sub wake($)
|
||||||
{
|
{
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
@ -190,9 +178,7 @@ sub wake($)
|
|||||||
}
|
}
|
||||||
readingsEndUpdate($hash, defined($hash->{LOCAL} ? 0 : 1));
|
readingsEndUpdate($hash, defined($hash->{LOCAL} ? 0 : 1));
|
||||||
}
|
}
|
||||||
|
################################################################################
|
||||||
#
|
|
||||||
#
|
|
||||||
# method to wakevia lan, taken from Net::Wake package
|
# method to wakevia lan, taken from Net::Wake package
|
||||||
sub wol_by_udp {
|
sub wol_by_udp {
|
||||||
my ($hash, $mac_addr, $host, $port) = @_;
|
my ($hash, $mac_addr, $host, $port) = @_;
|
||||||
@ -218,8 +204,7 @@ sub wol_by_udp {
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#
|
################################################################################
|
||||||
#
|
|
||||||
# method to wake via system command
|
# method to wake via system command
|
||||||
sub wol_by_ew($$) {
|
sub wol_by_ew($$) {
|
||||||
my ($hash, $mac) = @_;
|
my ($hash, $mac) = @_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user