diff --git a/fhem/FHEM/98_WOL.pm b/fhem/FHEM/98_WOL.pm index 88186a6ee..359f3ffad 100644 --- a/fhem/FHEM/98_WOL.pm +++ b/fhem/FHEM/98_WOL.pm @@ -1,4 +1,4 @@ -# $Id$ +# $Id # erweitert um die Funktion nas_control Dietmar Ortmann $ # # This file is part of fhem. @@ -31,7 +31,7 @@ sub WOL_Initialize($) $hash->{SetFn} = "WOL_Set"; $hash->{DefFn} = "WOL_Define"; $hash->{UndefFn} = "WOL_Undef"; - $hash->{AttrList} = "interval shutdownCmd ". + $hash->{AttrList} = "interval shutdownCmd sysCmd ". $readingFnAttributes; } # @@ -181,7 +181,7 @@ sub wake($) Log3 $hash, 3, "WOL keeping $name with MAC $mac IP $host busy"; if ($hash->{MODE} eq "BOTH" || $hash->{MODE} eq "EW" ) { - wol_by_ew ($mac); + wol_by_ew ($hash, $mac); readingsBulkUpdate ($hash, "packet_via_EW", $mac); } if ($hash->{MODE} eq "BOTH" || $hash->{MODE} eq "UDP" ) { @@ -220,11 +220,16 @@ sub wol_by_udp { } # # -# method to wakevia ether-wake -sub wol_by_ew { - my ($mac) = @_; +# method to wake via system command +sub wol_by_ew($$) { + my ($hash, $mac) = @_; - my $response = `/usr/bin/ether-wake $mac`; + my $sysCmd = AttrVal($hash->{NAME}, "sysCmd", "/usr/bin/ether-wake"); + if (-e $sysCmd) { + my $response = `$sysCmd $mac`; + } else { + Log3 $hash, 1, "[$hash->{NAME}] system command '$sysCmd' not found"; + } return 1; } @@ -300,6 +305,8 @@ So, for example a Buffalo NAS can be kept awake.
attr <name> sysCmd <string>
+ /usr/bin/ether-wake or /usr/bin/wakeonlanattr <name> shutdownCmd <string>
sh /path/to/some/shell/script.shattr <name> interval <seconds>