第2步:设置安全码(可选)
我自己用密码生成器生成了一个16位的,SD8TCAfP880CPqht https://suijimimashengcheng.51240.com/
那么我的地址地址就是
192.168.0.2:5001/SD8TCAfP880CPqht/suspend 第3步:Node-RED配置 架构: a、 开机: You==>press power on button---->HA----------mqtt--------->node red----UDP WOL magic packet--->Your PC b、关机: You==>press power off button---->HA----------mqtt--------->node red----HTTP Power off packet--->Your PC c、状态 Node-RED==>ping per 20s----->Your PC & get result-------------mqtt---->HA
[{"id":"ff855cab.aacb6","type":"wake on lan","z":"ca42f309.1aab2","mac":"40-8D-8D-8D-8D-8D","host":"","name":"","x":610,"y":2720,"wires":[]},{"id":"c0bb03b8.24a11","type":"ping","z":"ca42f309.1aab2","name":"","host":"192.168.0.2","timer":"20","x":170,"y":2620,"wires":[["ba9fd219.80255"]]},{"id":"9eff1553.165018","type":"mqtt in","z":"ca42f309.1aab2","name":"","topic":"cmnd/homepc/power","qos":"0","datatype":"utf8","broker":"45093899.5c3598","x":210,"y":2740,"wires":[["ab1b33f5.2f196"]]},{"id":"30e74ae4.de6eb6","type":"mqtt out","z":"ca42f309.1aab2","name":"","topic":"stat/homepc/power","qos":"","retain":"","broker":"10e53674.e95a1a","x":650,"y":2620,"wires":[]},{"id":"71929b53.ad1d54","type":"http request","z":"ca42f309.1aab2","name":"","method":"GET","ret":"txt","paytoqs":false,"url":"http://192.168.0.2:5001/SD8TCAfP880CPqht/suspend","tls":"","proxy":"","authType":"basic","x":560,"y":2760,"wires":[[]]},{"id":"ab1b33f5.2f196","type":"switch","z":"ca42f309.1aab2","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":390,"y":2740,"wires":[["ff855cab.aacb6"],["71929b53.ad1d54"]]},{"id":"ba9fd219.80255","type":"switch","z":"ca42f309.1aab2","name":"","property":"payload","propertyType":"msg","rules":[{"t":"istype","v":"number","vt":"number"},{"t":"istype","v":"boolean","vt":"boolean"}],"checkall":"true","repair":false,"outputs":2,"x":310,"y":2620,"wires":[["f2417559.525998"],["25636f35.4223c"]]},{"id":"f2417559.525998","type":"change","z":"ca42f309.1aab2","name":"ON","rules":[{"t":"set","p":"payload","pt":"msg","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":2600,"wires":[["30e74ae4.de6eb6"]]},{"id":"25636f35.4223c","type":"change","z":"ca42f309.1aab2","name":"OFF","rules":[{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":2640,"wires":[["30e74ae4.de6eb6"]]},{"id":"a7a8012a.7cf1f","type":"comment","z":"ca42f309.1aab2","name":"获取开机状态","info":"","x":170,"y":2580,"wires":[]},{"id":"3207c419.15022c","type":"comment","z":"ca42f309.1aab2","name":"下发开关机命令","info":"","x":200,"y":2700,"wires":[]},{"id":"45093899.5c3598","type":"mqtt-broker","z":"","name":"mqtt","broker":"www.your.com","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"10e53674.e95a1a","type":"mqtt-broker","z":"","name":"","broker":"www.your.com","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]