# Changing the pass through behaviour of a multistate switch

**URL:** https://discourse.nodered.org/t/changing-the-pass-through-behaviour-of-a-multistate-switch/84052
**Category:** Developing Nodes
**Tags:** node-red-dashboard
**Created:** [27 December 2023 11:25 UTC](https://discourse.nodered.org/t/changing-the-pass-through-behaviour-of-a-multistate-switch/84052 "2023-12-27T11:25:11Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![magnusso](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/magnusso/32/37680_2.png) [@magnusso](https://discourse.nodered.org/u/magnusso)
#### Post date: [27 December 2023 11:25 UTC](https://discourse.nodered.org/t/changing-the-pass-through-behaviour-of-a-multistate-switch/84052/1 "2023-12-27T11:25:11Z")

</div>

I'm new to developing nodes and would very much appericate a helping hand. My objective is to change the exisiting `multistate switch` module so that it would incorporate the same pass through feature as the` ui_switch` module. The desired result is as follows:

- no messages are pass through
- the user interface, i.e. the "icon", shows the state of the input message

To start with, I would need to understand the following. What part of ui\_switch.html and/or ui\_switch.js "prevents" the state icon from changing from off to on in the following example?

```auto
[
    {
        "id": "4e92b883d06ffe99",
        "type": "inject",
        "z": "822bc1ad5f56e898",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "false",
        "payloadType": "bool",
        "x": 310,
        "y": 280,
        "wires": [
            [
                "15a5658ebe1b3fa9",
                "11fa7d2da42c9ef4"
            ]
        ]
    },
    {
        "id": "11fa7d2da42c9ef4",
        "type": "ui_multistate_switch",
        "z": "822bc1ad5f56e898",
        "name": "Multistate switch",
        "group": "512e9e663b47903c",
        "order": 6,
        "width": 0,
        "height": 1,
        "label": "switch",
        "stateField": "payload",
        "enableField": "enable",
        "passthroughField": "passthrough",
        "inputMsgField": "inputmsg",
        "rounded": true,
        "useThemeColors": true,
        "hideSelectedLabel": false,
        "multilineLabel": false,
        "passThrough": "always",
        "inputMsg": "all",
        "userInput": "enabled_show",
        "options": [
            {
                "label": "FALSE",
                "value": "false",
                "valueType": "bool",
                "color": "#009933"
            },
            {
                "label": "TRUE",
                "value": "true",
                "valueType": "bool",
                "color": "#999999"
            }
        ],
        "topic": "",
        "x": 590,
        "y": 340,
        "wires": [
            [
                "eb87e38c66bae324"
            ]
        ]
    },
    {
        "id": "15a5658ebe1b3fa9",
        "type": "ui_switch",
        "z": "822bc1ad5f56e898",
        "name": "",
        "label": "simple switch (no pass through, icon shows state of input)",
        "tooltip": "",
        "group": "512e9e663b47903c",
        "order": 15,
        "width": 0,
        "height": 0,
        "passthru": false,
        "decouple": "true",
        "topic": "topic",
        "topicType": "msg",
        "style": "",
        "onvalue": "true",
        "onvalueType": "bool",
        "onicon": "",
        "oncolor": "",
        "offvalue": "false",
        "offvalueType": "bool",
        "officon": "",
        "offcolor": "",
        "animate": false,
        "className": "",
        "x": 730,
        "y": 280,
        "wires": [
            [
                "f685404e048b5243",
                "ad08d9a3189a5588"
            ]
        ]
    },
    {
        "id": "c0efebd66f52f5c3",
        "type": "inject",
        "z": "822bc1ad5f56e898",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 310,
        "y": 340,
        "wires": [
            [
                "11fa7d2da42c9ef4",
                "15a5658ebe1b3fa9"
            ]
        ]
    },
    {
        "id": "f685404e048b5243",
        "type": "debug",
        "z": "822bc1ad5f56e898",
        "name": "debug 2",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1090,
        "y": 280,
        "wires": []
    },
    {
        "id": "eb87e38c66bae324",
        "type": "debug",
        "z": "822bc1ad5f56e898",
        "name": "debug 3",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1090,
        "y": 340,
        "wires": []
    },
    {
        "id": "ad08d9a3189a5588",
        "type": "delay",
        "z": "822bc1ad5f56e898",
        "name": "Simulation of Eltako FSR14x acutuator",
        "pauseType": "delay",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1190,
        "y": 160,
        "wires": [
            [
                "15a5658ebe1b3fa9"
            ]
        ]
    },
    {
        "id": "512e9e663b47903c",
        "type": "ui_group",
        "name": "Yleisohjaus",
        "tab": "fa7d8b45bcb564c4",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": true,
        "className": ""
    },
    {
        "id": "fa7d8b45bcb564c4",
        "type": "ui_tab",
        "name": "Valot",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

### Author: ![magnusso](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/magnusso/32/37680_2.png) [@magnusso](https://discourse.nodered.org/u/magnusso)
#### Post date: [27 December 2023 11:27 UTC](https://discourse.nodered.org/t/changing-the-pass-through-behaviour-of-a-multistate-switch/84052/2 "2023-12-27T11:27:44Z")

</div>

![Skärmbild 2023-12-27 132658](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/0/907b7238589b18de2311f2826f4c29dbb1063975.png)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [28 December 2023 13:43 UTC](https://discourse.nodered.org/t/changing-the-pass-through-behaviour-of-a-multistate-switch/84052/3 "2023-12-28T13:43:24Z")

</div>

> [@magnusso](#):
>
> - no messages are pass through
> - the user interface, i.e. the "icon", shows the state of the input message

I haven't used that node, but looking at the readme is that not what this selection under User Input does?

_Enabled but don't show_ : The user input will be accepted, but the new state will not be visualized. This could be used if the switch needs to show the real state. As soon as the real state changes, it will be injected into the switch node which will visually switch to the new state

---

<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: [26 February 2024 13:44 UTC](https://discourse.nodered.org/t/changing-the-pass-through-behaviour-of-a-multistate-switch/84052/4 "2024-02-26T13:44:16Z")

</div>

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