mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Set WOL node to use more generic broadcast address byt default
This commit is contained in:
parent
7113598098
commit
73e4ae574c
@ -5,8 +5,8 @@
|
|||||||
<input type="text" id="node-input-mac" placeholder="e.g. DE:AD:BE:EF:FE:ED">
|
<input type="text" id="node-input-mac" placeholder="e.g. DE:AD:BE:EF:FE:ED">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-host"><i class="fa fa-globe"></i> Host Address</label>
|
<label for="node-input-host"><i class="fa fa-globe"></i> Target Address</label>
|
||||||
<input type="text" id="node-input-host" placeholder="e.g. 255.255.255.255">
|
<input type="text" id="node-input-host" placeholder="e.g. 192.168.1.255 or 10.255.255.255">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||||
@ -18,7 +18,9 @@
|
|||||||
<script type="text/x-red" data-help-name="wake on lan">
|
<script type="text/x-red" data-help-name="wake on lan">
|
||||||
<p>Sends a Wake-On-LAN magic packet to the mac address specified.</p>
|
<p>Sends a Wake-On-LAN magic packet to the mac address specified.</p>
|
||||||
<p>You may instead set <code>msg.mac</code> to dynamically set the target device mac to wake up.</p>
|
<p>You may instead set <code>msg.mac</code> to dynamically set the target device mac to wake up.</p>
|
||||||
<p>The target host address can optionally be set using <code>msg.host</code></p>
|
<p>The address of the target machine can optionally be set using <code>msg.host</code></p>
|
||||||
|
<p>Setting the target address to the broadcast address of the subnet that the target machine is attached to works best.
|
||||||
|
For a class C address this is usually just the first three parts of the ip address followed by 255. eg 192.168.1.255.</p>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -13,6 +13,10 @@ module.exports = function(RED) {
|
|||||||
this.on("input", function(msg) {
|
this.on("input", function(msg) {
|
||||||
var mac = this.mac || msg.mac || null;
|
var mac = this.mac || msg.mac || null;
|
||||||
var host = this.host || msg.host || '255.255.255.255';
|
var host = this.host || msg.host || '255.255.255.255';
|
||||||
|
var h = host.split('.');
|
||||||
|
h.pop();
|
||||||
|
h.push('255');
|
||||||
|
host = h.join('.');
|
||||||
if (mac != null) {
|
if (mac != null) {
|
||||||
if (chk.test(mac)) {
|
if (chk.test(mac)) {
|
||||||
try {
|
try {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-wol",
|
"name" : "node-red-node-wol",
|
||||||
"version" : "0.0.9",
|
"version" : "0.0.10",
|
||||||
"description" : "A Node-RED node to send Wake-On-LAN (WOL) magic packets",
|
"description" : "A Node-RED node to send Wake-On-LAN (WOL) magic packets",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"wake_on_lan" : "1.0.0"
|
"wake_on_lan" : "1.0.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user