# Can't turn a switch on by message

**URL:** <https://discourse.nodered.org/t/cant-turn-a-switch-on-by-message/100596>\
**Category:** Dashboard\
**Created:** [18 March 2026 22:09 UTC](https://discourse.nodered.org/t/cant-turn-a-switch-on-by-message/100596 "2026-03-18T22:09:14Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![GiovanniG](https://avatars.discourse-cdn.com/v4/letter/g/ecd19e/32.png) [@GiovanniG](https://discourse.nodered.org/u/GiovanniG)\
**Post date:** [18 March 2026 22:09 UTC](https://discourse.nodered.org/t/cant-turn-a-switch-on-by-message/100596/1 "2026-03-18T22:09:14Z")

</div>

Hi, I've a switch that returns JSON {"state": "ON"} when active, If I send this message on its node input I can't turn it on, it keeps off, why? I've tried a payload:true, payload "ON", but nothing works, please help. Thank you

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [18 March 2026 22:16 UTC](https://discourse.nodered.org/t/cant-turn-a-switch-on-by-message/100596/2 "2026-03-18T22:16:07Z")

</div>

If you post an example of the Node-RED flow that is not working - I'm sure people will help you.

---

<div class="post-metadata">

**Author:** ![GiovanniG](https://avatars.discourse-cdn.com/v4/letter/g/ecd19e/32.png) [@GiovanniG](https://discourse.nodered.org/u/GiovanniG)\
**Post date:** [18 March 2026 22:17 UTC](https://discourse.nodered.org/t/cant-turn-a-switch-on-by-message/100596/3 "2026-03-18T22:17:31Z")

</div>

Ok, it looks easy

```auto
[
    {
        "id": "fc38708902725699",
        "type": "inject",
        "z": "9a20ba26aaa6cc82",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"state\": \"ON\"}",
        "payloadType": "json",
        "x": 150,
        "y": 220,
        "wires": [
            [
                "9fbd330bf7ac27ef",
                "a49b771c3db35b27"
            ]
        ]
    },
    {
        "id": "9fbd330bf7ac27ef",
        "type": "ui_switch",
        "z": "9a20ba26aaa6cc82",
        "name": "Ingresso",
        "label": "",
        "tooltip": "",
        "group": "f5a2eb4722028f6f",
        "order": 2,
        "width": 1,
        "height": 1,
        "passthru": false,
        "decouple": "false",
        "topic": "topic",
        "topicType": "msg",
        "style": "",
        "onvalue": "{\"state\": \"ON\"}",
        "onvalueType": "json",
        "onicon": "",
        "oncolor": "",
        "offvalue": "{\"state\": \"OFF\"}",
        "offvalueType": "json",
        "officon": "",
        "offcolor": "",
        "animate": false,
        "className": "",
        "x": 420,
        "y": 460,
        "wires": [
            [
                "70d17856e5c9b7cd"
            ]
        ]
    },
    {
        "id": "f5a2eb4722028f6f",
        "type": "ui_group",
        "name": "Luci",
        "tab": "edb3c3e093ab565f",
        "order": 1,
        "disp": true,
        "width": 9,
        "collapse": false,
        "className": ""
    },
    {
        "id": "edb3c3e093ab565f",
        "type": "ui_tab",
        "name": "Brunello",
        "icon": "dashboard",
        "disabled": false,
        "hidden": true
    },
    {
        "id": "f7f1f307f0943139",
        "type": "global-config",
        "env": [],
        "modules": {
            "node-red-dashboard": "3.6.6"
        }
    }
]

```

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [18 March 2026 22:42 UTC](https://discourse.nodered.org/t/cant-turn-a-switch-on-by-message/100596/4 "2026-03-18T22:42:38Z")

</div>

Since your ui-switch node is not in pass-through mode, you have to choose whether the indicator reflects the node input or output.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/e/7e41cd5a3d470f7b7b71f25fb79739ff9b5cb6a7.png)

---

<div class="post-metadata">

**Author:** ![GiovanniG](https://avatars.discourse-cdn.com/v4/letter/g/ecd19e/32.png) [@GiovanniG](https://discourse.nodered.org/u/GiovanniG)\
**Post date:** [18 March 2026 22:50 UTC](https://discourse.nodered.org/t/cant-turn-a-switch-on-by-message/100596/5 "2026-03-18T22:50:25Z")

</div>

Ok, but in this case I can't more control the switch by the dashboard, t works only on input mode.  
So I need to control the state by dashboard and message, giving output only by dashboard, possibile?

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [18 March 2026 22:58 UTC](https://discourse.nodered.org/t/cant-turn-a-switch-on-by-message/100596/6 "2026-03-18T22:58:56Z")

</div>

Use pass-through mode and feed the output back to the input via a filter node

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/6/161becb0c5877c9680795996a23b014f96c0567f.png)

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [18 March 2026 23:09 UTC](https://discourse.nodered.org/t/cant-turn-a-switch-on-by-message/100596/7 "2026-03-18T23:09:13Z")

</div>

If you select the **Pass Through** option you can control the switch via an input message and also by using the switch on the Dashboard (Note: I'm using D1).

 ![slider_switch](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/a/eab7643d4fc3e962fdcb1252d7afee56d294e2b5.png)

 ![slider_switch_B](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/1/910d5722f73374eae62dbfce044fb5d66436bf60.png)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [18 March 2026 23:30 UTC](https://discourse.nodered.org/t/cant-turn-a-switch-on-by-message/100596/8 "2026-03-18T23:30:25Z")

</div>

Dave is right. You don't need the feedback loop that I suggested.

---

<div class="post-metadata">

**Author:** ![GiovanniG](https://avatars.discourse-cdn.com/v4/letter/g/ecd19e/32.png) [@GiovanniG](https://discourse.nodered.org/u/GiovanniG)\
**Post date:** [19 March 2026 01:33 UTC](https://discourse.nodered.org/t/cant-turn-a-switch-on-by-message/100596/9 "2026-03-19T01:33:07Z")

</div>

Thank you all for your ind support,  
my goal is to produce effect only by dashboard (output) which changes the status of the switch, but the input message can modify the status of the switch without output it. I don't think this is possibile, so I may try the bypass option adding extra properties on the input message, if they pass I can kill the message output by the switch node

---

<div class="post-metadata">

**Author:** ![GiovanniG](https://avatars.discourse-cdn.com/v4/letter/g/ecd19e/32.png) [@GiovanniG](https://discourse.nodered.org/u/GiovanniG)\
**Post date:** [19 March 2026 10:53 UTC](https://discourse.nodered.org/t/cant-turn-a-switch-on-by-message/100596/10 "2026-03-19T10:53:01Z")

</div>

There is no possibile to pass through switch extra properties, but I've noticed that when it comes from dashboard the message includes property socketid, it's enough for me to check it to now it comes from Dashboard. So somehow I solved 🙂

---

<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:** [2 April 2026 10:53 UTC](https://discourse.nodered.org/t/cant-turn-a-switch-on-by-message/100596/11 "2026-04-02T10:53:26Z")

</div>

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