Skip to content

Instantly share code, notes, and snippets.

@jonathanschneider
Created February 7, 2022 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathanschneider/9b0120d7da7cc8e365f7f712c0a0dd2e to your computer and use it in GitHub Desktop.
Save jonathanschneider/9b0120d7da7cc8e365f7f712c0a0dd2e to your computer and use it in GitHub Desktop.
This Node-RED flow allows to wake a My Cloud NAS and put it in standby (hibernate) through Alexa by emulating a WeMo smart plug and executing Wake-on-LAN and HTTP requests. The flow requires the "node-red-contrib-wemo-emulator" package and "wakeonlan" package.
[
{
"id": "4f84bfa31ca7adb9",
"type": "wemo-emulator",
"z": "42846943.2b4b38",
"name": "My Cloud",
"friendlyName": "My Cloud",
"serial": "23",
"port": "44023",
"onTopic": "My Cloud",
"onPayload": "on",
"offTopic": "My Cloud",
"offPayload": "off",
"x": 120,
"y": 900,
"wires": [
[
"6ee2d29b0c31bb4b"
]
]
},
{
"id": "96a298711fd0b42b",
"type": "exec",
"z": "42846943.2b4b38",
"command": "wakeonlan <macaddress>",
"addpay": "",
"append": "",
"useSpawn": "false",
"timer": "",
"winHide": false,
"oldrc": false,
"name": "Wake",
"x": 490,
"y": 900,
"wires": [
[
"a23c813ac7c648e3"
],
[],
[]
]
},
{
"id": "6ee2d29b0c31bb4b",
"type": "switch",
"z": "42846943.2b4b38",
"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": 310,
"y": 900,
"wires": [
[
"96a298711fd0b42b"
],
[
"8698f998c03e744d"
]
]
},
{
"id": "a23c813ac7c648e3",
"type": "debug",
"z": "42846943.2b4b38",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 730,
"y": 940,
"wires": []
},
{
"id": "8698f998c03e744d",
"type": "exec",
"z": "42846943.2b4b38",
"command": "curl -sSL -c ~/cookie.dat --header 'Content-Type:application/json' --request POST --data '{\"username\":\"<username>\",\"password\":\"<password base64 encoded>\"}' http://<ipaddress>/nas/v1/auth && curl -sSL -b ~/cookie.dat \"http://<ipaddress>/cgi-bin/system_mgr.cgi?cmd=cgi_shutdown\"",
"addpay": "",
"append": "",
"useSpawn": "false",
"timer": "",
"winHide": false,
"oldrc": false,
"name": "Hibernate",
"x": 500,
"y": 960,
"wires": [
[
"a23c813ac7c648e3"
],
[],
[]
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment