mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-12 13:52:00 +00:00
WOL now accepts a different systemCommand by attribute sysCmd to wakeup a host in wakeup mode EW.
git-svn-id: https://svn.fhem.de/fhem/trunk@4097 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c9c5559ef6
commit
522ba262a5
@ -1,4 +1,4 @@
|
|||||||
# $Id$
|
# $Id
|
||||||
# erweitert um die Funktion nas_control Dietmar Ortmann $
|
# erweitert um die Funktion nas_control Dietmar Ortmann $
|
||||||
#
|
#
|
||||||
# This file is part of fhem.
|
# This file is part of fhem.
|
||||||
@ -31,7 +31,7 @@ sub WOL_Initialize($)
|
|||||||
$hash->{SetFn} = "WOL_Set";
|
$hash->{SetFn} = "WOL_Set";
|
||||||
$hash->{DefFn} = "WOL_Define";
|
$hash->{DefFn} = "WOL_Define";
|
||||||
$hash->{UndefFn} = "WOL_Undef";
|
$hash->{UndefFn} = "WOL_Undef";
|
||||||
$hash->{AttrList} = "interval shutdownCmd ".
|
$hash->{AttrList} = "interval shutdownCmd sysCmd ".
|
||||||
$readingFnAttributes;
|
$readingFnAttributes;
|
||||||
}
|
}
|
||||||
#
|
#
|
||||||
@ -181,7 +181,7 @@ sub wake($)
|
|||||||
Log3 $hash, 3, "WOL keeping $name with MAC $mac IP $host busy";
|
Log3 $hash, 3, "WOL keeping $name with MAC $mac IP $host busy";
|
||||||
|
|
||||||
if ($hash->{MODE} eq "BOTH" || $hash->{MODE} eq "EW" ) {
|
if ($hash->{MODE} eq "BOTH" || $hash->{MODE} eq "EW" ) {
|
||||||
wol_by_ew ($mac);
|
wol_by_ew ($hash, $mac);
|
||||||
readingsBulkUpdate ($hash, "packet_via_EW", $mac);
|
readingsBulkUpdate ($hash, "packet_via_EW", $mac);
|
||||||
}
|
}
|
||||||
if ($hash->{MODE} eq "BOTH" || $hash->{MODE} eq "UDP" ) {
|
if ($hash->{MODE} eq "BOTH" || $hash->{MODE} eq "UDP" ) {
|
||||||
@ -220,11 +220,16 @@ sub wol_by_udp {
|
|||||||
}
|
}
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# method to wakevia ether-wake
|
# method to wake via system command
|
||||||
sub wol_by_ew {
|
sub wol_by_ew($$) {
|
||||||
my ($mac) = @_;
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -300,6 +305,8 @@ So, for example a Buffalo NAS can be kept awake.
|
|||||||
<a name="WOLattr"></a>
|
<a name="WOLattr"></a>
|
||||||
<h4>Attributes</h4>
|
<h4>Attributes</h4>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li><code>attr <name> sysCmd <string></code>
|
||||||
|
<br>Custom command executed to wakeup a remote machine, i.e. <code>/usr/bin/ether-wake or /usr/bin/wakeonlan</code></li>
|
||||||
<li><code>attr <name> shutdownCmd <string></code>
|
<li><code>attr <name> shutdownCmd <string></code>
|
||||||
<br>Custom command executed to shutdown a remote machine, i.e. <code>sh /path/to/some/shell/script.sh</code></li>
|
<br>Custom command executed to shutdown a remote machine, i.e. <code>sh /path/to/some/shell/script.sh</code></li>
|
||||||
<li><code>attr <name> interval <seconds></code></a>
|
<li><code>attr <name> interval <seconds></code></a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user