Dashboard button + Wake-On-LAN

Hey gang,
I realise this is a kinda rudimentary question, but I'm hoping to learn how to understand this.

The notes for the Wake-On-LAN module say you can use msg.mac to pass the MAC address. How would I set a dashboard button to transmit this, please?

My end-goal is to have several buttons all able to trigger the WOL module. (I know I could use multiple WOL modules (I currently am), but I really want to understand more about this.)

Thank you!
Dax.

In the button properties you can enter the mac address in the payload box.
After that you need a change node that sets the msg.mac to msg.payload.
And your done.
Example (not tested):

[{"id":"2d4566747e14bec3","type":"wake on lan","z":"8b114306.e05788","mac":"","host":"","udpport":9,"name":"","x":640,"y":260,"wires":[]},{"id":"0547dd749ccb5cef","type":"ui_button","z":"8b114306.e05788","name":"","group":"c010f2313b5ccc9a","order":2,"width":0,"height":0,"passthru":false,"label":"button","tooltip":"","color":"","bgcolor":"","icon":"","payload":"00:12:23:45:67:89:0A:BC","payloadType":"str","topic":"topic","topicType":"msg","x":220,"y":260,"wires":[["d6bccdde09a7447c"]]},{"id":"d6bccdde09a7447c","type":"change","z":"8b114306.e05788","name":"","rules":[{"t":"set","p":"mac","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":260,"wires":[["2d4566747e14bec3"]]},{"id":"c010f2313b5ccc9a","type":"ui_group","name":"Buttons","tab":"52ab180bee78bc5a","order":2,"disp":false,"width":"4","collapse":false},{"id":"52ab180bee78bc5a","type":"ui_tab","name":"Tuin","icon":"icofont-map","order":25,"disabled":false,"hidden":false}]

Capture

Ahh, I see. Thank you @edje11.

set the msg.mac to msg.payload

That is really great to know. I've run into similar problems in the past and had to figure out a different way around them. This is excellent.
In this case I was trying to do something like setting the dashboard button's payload setting to .msg.mac, which I guess is payload.msg.mac, hence the malformed output.

Thanks again for taking the time to help me with this, I really appreciate it.

All the best!
Dax.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.