mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-04 17:36:39 +00:00
STATE can now be used in any way you want
git-svn-id: https://svn.fhem.de/fhem/trunk@6319 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
7d1ac5e2a5
commit
fa32471616
@ -36,6 +36,7 @@ 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 "?");
|
||||||
|
|
||||||
@ -68,7 +69,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 ($hash->{STATE} eq "on") {
|
if (AttrVal($name, "state", "") eq "on") {
|
||||||
WOL_GetUpdate($hash);
|
WOL_GetUpdate($hash);
|
||||||
}
|
}
|
||||||
return undef;
|
return undef;
|
||||||
@ -132,6 +133,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);
|
||||||
|
|
||||||
@ -148,11 +150,12 @@ sub WOL_UpdateReadings($) {
|
|||||||
sub WOL_GetUpdate($) {
|
sub WOL_GetUpdate($) {
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
|
|
||||||
if ($hash->{STATE} eq "on") {
|
my $name = $hash->{NAME};
|
||||||
|
if (AttrVal($name, "state", "") eq "on") {
|
||||||
wake($hash);
|
wake($hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($hash->{REPEAT} > 0 && $hash->{STATE} eq "on" ) {
|
if ($hash->{REPEAT} > 0 && AttrVal($name, "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