mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
repair of last commit - old version active
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@6322 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
3cab2cb914
commit
c0b00b07f2
@ -36,7 +36,6 @@ sub WOL_Initialize($) {
|
|||||||
################################################################################
|
################################################################################
|
||||||
sub WOL_Set($@) {
|
sub WOL_Set($@) {
|
||||||
my ($hash, @a) = @_;
|
my ($hash, @a) = @_;
|
||||||
|
|
||||||
return "no set value specified" if(int(@a) < 2);
|
return "no set value specified" if(int(@a) < 2);
|
||||||
return "Unknown argument $a[1], choose one of on off refresh" if($a[1] eq "?");
|
return "Unknown argument $a[1], choose one of on off refresh" if($a[1] eq "?");
|
||||||
|
|
||||||
@ -69,7 +68,7 @@ sub WOL_Set($@) {
|
|||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
InternalTimer(gettimeofday()+$hash->{INTERVAL}, "WOL_UpdateReadings", $hash, 0);
|
InternalTimer(gettimeofday()+$hash->{INTERVAL}, "WOL_UpdateReadings", $hash, 0);
|
||||||
|
|
||||||
if (AttrVal($name, "state", "") eq "on") {
|
if ($hash->{STATE} eq "on") {
|
||||||
WOL_GetUpdate($hash);
|
WOL_GetUpdate($hash);
|
||||||
}
|
}
|
||||||
return undef;
|
return undef;
|
||||||
@ -133,8 +132,7 @@ sub WOL_UpdateReadings($) {
|
|||||||
$hash->{INTERVAL} = AttrVal($hash->{NAME}, "interval", 900);
|
$hash->{INTERVAL} = AttrVal($hash->{NAME}, "interval", 900);
|
||||||
|
|
||||||
my $ip = $hash->{IP};
|
my $ip = $hash->{IP};
|
||||||
my $name = $hash->{NAME};
|
|
||||||
|
|
||||||
readingsBeginUpdate ($hash);
|
readingsBeginUpdate ($hash);
|
||||||
|
|
||||||
if (`ping -c 1 -w 2 $ip` =~ m/100%/) {
|
if (`ping -c 1 -w 2 $ip` =~ m/100%/) {
|
||||||
@ -150,12 +148,11 @@ sub WOL_UpdateReadings($) {
|
|||||||
sub WOL_GetUpdate($) {
|
sub WOL_GetUpdate($) {
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
|
|
||||||
my $name = $hash->{NAME};
|
if ($hash->{STATE} eq "on") {
|
||||||
if (AttrVal($name, "state", "") eq "on") {
|
|
||||||
wake($hash);
|
wake($hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($hash->{REPEAT} > 0 && AttrVal($name, "state", "") eq "on" ) {
|
if ($hash->{REPEAT} > 0 && $hash->{STATE} eq "on" ) {
|
||||||
InternalTimer(gettimeofday()+$hash->{REPEAT}, "WOL_GetUpdate", $hash, 0);
|
InternalTimer(gettimeofday()+$hash->{REPEAT}, "WOL_GetUpdate", $hash, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user