# \[SOLVED\] Use of Reboot/Shutdown node

**URL:** <https://discourse.nodered.org/t/solved-use-of-reboot-shutdown-node/52371>\
**Category:** General\
**Tags:** node-red-dashboard\
**Created:** [18 October 2021 15:27 UTC](https://discourse.nodered.org/t/solved-use-of-reboot-shutdown-node/52371 "2021-10-18T15:27:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ebolisa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ebolisa/32/89203_2.png) [@ebolisa](https://discourse.nodered.org/u/ebolisa)\
**Post date:** [18 October 2021 15:27 UTC](https://discourse.nodered.org/t/solved-use-of-reboot-shutdown-node/52371/1 "2021-10-18T15:27:24Z")

</div>

Hi,

I use the following nodes to reboot my Rpi. I'm using a notification node to ask the user if to proceed or not. If 'OK' is chosen, then a 'true' is sent to the Reboot node and the board reboots.  
Then in theory, if a 'Cancel' is pressed, nothing should happen. However, the board reboots.  
When 'Cancel' is pressed I'm sending out a 'null' but the Reboot node accepts it as a valid cmd.

How do I fix it?  
TIA

```auto
[
    {
        "id": "56a42e6a89d16cd3",
        "type": "restart",
        "z": "9a2012d7b4e48ade",
        "name": "Reboot",
        "x": 320,
        "y": 220,
        "wires": []
    },
    {
        "id": "bc997f0a3f2f5cdf",
        "type": "ui_toast",
        "z": "9a2012d7b4e48ade",
        "position": "dialog",
        "displayTime": "3",
        "highlight": "",
        "sendall": true,
        "outputs": 1,
        "ok": "OK",
        "cancel": "Cancel",
        "raw": false,
        "topic": "",
        "name": "Alert",
        "x": 170,
        "y": 160,
        "wires": [
            [
                "818a6f8bfc732a59"
            ]
        ]
    },
    {
        "id": "35f154938724cff8",
        "type": "function",
        "z": "9a2012d7b4e48ade",
        "name": "",
        "func": "if (msg.payload === true){\n txt = \"Caution!! Will reboot.\";\n msg.payload = txt ;\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 160,
        "y": 100,
        "wires": [
            [
                "bc997f0a3f2f5cdf"
            ]
        ]
    },
    {
        "id": "818a6f8bfc732a59",
        "type": "function",
        "z": "9a2012d7b4e48ade",
        "name": "",
        "func": "if (msg.payload === \"OK\"){\n msg.payload = true;\n}\nelse{\n msg.payload = null;\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 160,
        "y": 220,
        "wires": [
            [
                "56a42e6a89d16cd3"
            ]
        ]
    },
    {
        "id": "a26c296d8a3715e0",
        "type": "ui_button",
        "z": "9a2012d7b4e48ade",
        "name": "Reboot",
        "group": "2de74aabc7cdf0ad",
        "order": 2,
        "width": "3",
        "height": "1",
        "passthru": false,
        "label": "Reiniciar domo",
        "tooltip": "",
        "color": "white",
        "bgcolor": "#da3232",
        "icon": "autorenew",
        "payload": "true",
        "payloadType": "bool",
        "topic": "topic",
        "x": 160,
        "y": 40,
        "wires": [
            [
                "35f154938724cff8"
            ]
        ]
    },
    {
        "id": "2de74aabc7cdf0ad",
        "type": "ui_group",
        "name": "Configuración",
        "tab": "fcae68a61b2b76db",
        "order": 5,
        "disp": true,
        "width": "6",
        "collapse": true
    },
    {
        "id": "fcae68a61b2b76db",
        "type": "ui_tab",
        "z": "",
        "name": "DEMO",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

```

EDIT:  
Nevermind. Returning the msg within the conditional check, fixed it.

```auto
if (msg.payload == "OK"){
    msg.payload = true;
    return msg;
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [17 December 2021 15:27 UTC](https://discourse.nodered.org/t/solved-use-of-reboot-shutdown-node/52371/2 "2021-12-17T15:27:25Z")

</div>

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