# Multi State switch

**URL:** <https://discourse.nodered.org/t/multi-state-switch/41952>\
**Category:** Dashboard\
**Created:** [3 March 2021 13:43 UTC](https://discourse.nodered.org/t/multi-state-switch/41952 "2021-03-03T13:43:12Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![HZB](https://avatars.discourse-cdn.com/v4/letter/h/77aa72/32.png) [@HZB](https://discourse.nodered.org/u/HZB)\
**Post date:** [3 March 2021 13:43 UTC](https://discourse.nodered.org/t/multi-state-switch/41952/1 "2021-03-03T13:43:12Z")

</div>

I am using multi state switch. Here's my flow for one machine

```auto
[
    {
        "id": "1806afa.227f25",
        "type": "ui_svg_graphics",
        "z": "935db92.1ef9548",
        "group": "64754f4c.b5122",
        "order": 1,
        "width": 3,
        "height": 3,
        "svgString": "<svg width=\"100%\" height=\"100%\" enable-background=\"new 0 0 250 250\" xmlns=\"http://www.w3.org/2000/svg\">/svg> \n<image width=\"100%\" height=\"100%\" xlink:href=\"http://10.20.233.241:1880/FE03.jpg\" />\n</svg>",
        "clickableShapes": [
            {
                "targetId": "#light_living",
                "action": "click",
                "payload": "light_living",
                "payloadType": "str",
                "topic": "light_living"
            },
            {
                "targetId": "r",
                "action": "click",
                "payload": "r",
                "payloadType": "str",
                "topic": "r"
            }
        ],
        "javascriptHandlers": [],
        "smilAnimations": [],
        "bindings": [],
        "showCoordinates": false,
        "autoFormatAfterEdit": false,
        "showBrowserErrors": true,
        "showBrowserEvents": false,
        "enableJsDebugging": false,
        "sendMsgWhenLoaded": false,
        "outputField": "payload",
        "editorUrl": "//drawsvg.org/drawsvg.html",
        "directory": "",
        "panning": "disabled",
        "zooming": "disabled",
        "panOnlyWhenZoomed": false,
        "doubleClickZoomEnabled": false,
        "mouseWheelZoomEnabled": false,
        "dblClickZoomPercentage": 150,
        "name": "",
        "x": 280,
        "y": 460,
        "wires": [
            []
        ]
    },
    {
        "id": "4520c747.10f428",
        "type": "mqtt out",
        "z": "935db92.1ef9548",
        "name": "",
        "topic": "safety/inspection/forklift/status/fe03",
        "qos": "2",
        "retain": "true",
        "broker": "b90d0ecc.41907",
        "x": 700,
        "y": 460,
        "wires": []
    },
    {
        "id": "bba189c5.871d48",
        "type": "ui_date_picker",
        "z": "935db92.1ef9548",
        "name": "",
        "label": "",
        "group": "64754f4c.b5122",
        "order": 3,
        "width": 3,
        "height": 1,
        "passthru": true,
        "topic": "",
        "x": 375,
        "y": 380,
        "wires": [
            []
        ],
        "l": false
    },
    {
        "id": "b12c6e9f.a9927",
        "type": "ui_button",
        "z": "935db92.1ef9548",
        "name": "",
        "group": "64754f4c.b5122",
        "order": 4,
        "width": 3,
        "height": 1,
        "passthru": false,
        "label": "UPDATE",
        "tooltip": "",
        "color": "",
        "bgcolor": "GREY",
        "icon": "",
        "payload": "",
        "payloadType": "str",
        "topic": "",
        "x": 80,
        "y": 380,
        "wires": [
            [
                "e3fe63d3.03056"
            ]
        ]
    },
    {
        "id": "e3fe63d3.03056",
        "type": "change",
        "z": "935db92.1ef9548",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$now()",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 240,
        "y": 380,
        "wires": [
            [
                "bba189c5.871d48",
                "8f636148.a5df2"
            ]
        ]
    },
    {
        "id": "a3ecf1e2.d9bf",
        "type": "ui_text_input",
        "z": "935db92.1ef9548",
        "name": "",
        "label": "Enter Comments Here",
        "tooltip": "",
        "group": "64754f4c.b5122",
        "order": 7,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": "60000",
        "topic": "FE01",
        "x": 440,
        "y": 420,
        "wires": [
            [
                "a70047d8.950aa8"
            ]
        ]
    },
    {
        "id": "78a68b4a.112b64",
        "type": "ui_level",
        "z": "935db92.1ef9548",
        "group": "64754f4c.b5122",
        "order": 6,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "",
        "colorHi": "#f90101",
        "colorWarn": "#ff0000",
        "colorNormal": "#ffff00",
        "colorOff": "#00ff00",
        "min": "1",
        "max": "3",
        "segWarn": "",
        "segHigh": "",
        "unit": "",
        "layout": "sh",
        "channelA": "",
        "channelB": "",
        "decimals": 0,
        "animations": "soft",
        "shape": "3",
        "colorschema": "valuedriven",
        "textoptions": "default",
        "colorText": "#eeeeee",
        "fontLabel": "kklnkl",
        "fontValue": "",
        "fontSmall": "",
        "colorFromTheme": true,
        "textAnimations": false,
        "hideValue": true,
        "tickmode": "off",
        "peakmode": false,
        "property": "payload",
        "peaktime": 3000,
        "x": 610,
        "y": 500,
        "wires": []
    },
    {
        "id": "33b8ec69.ed78b4",
        "type": "mqtt in",
        "z": "935db92.1ef9548",
        "name": "",
        "topic": "safety/inspection/forklift/status/fe03",
        "qos": "2",
        "datatype": "auto",
        "broker": "b90d0ecc.41907",
        "x": 400,
        "y": 500,
        "wires": [
            [
                "78a68b4a.112b64"
            ]
        ]
    },
    {
        "id": "a70047d8.950aa8",
        "type": "mqtt out",
        "z": "935db92.1ef9548",
        "name": "",
        "topic": "safety/inspection/forklift/comments/fe03",
        "qos": "2",
        "retain": "true",
        "broker": "b90d0ecc.41907",
        "x": 720,
        "y": 420,
        "wires": []
    },
    {
        "id": "49b195a8.46e46c",
        "type": "mqtt in",
        "z": "935db92.1ef9548",
        "name": "",
        "topic": "safety/inspection/forklift/comments/fe03",
        "qos": "2",
        "datatype": "auto",
        "broker": "b90d0ecc.41907",
        "x": 170,
        "y": 420,
        "wires": [
            [
                "a3ecf1e2.d9bf"
            ]
        ]
    },
    {
        "id": "8f636148.a5df2",
        "type": "mqtt out",
        "z": "935db92.1ef9548",
        "name": "",
        "topic": "safety/inspection/forklift/date/fe03",
        "qos": "2",
        "retain": "true",
        "broker": "b90d0ecc.41907",
        "x": 460,
        "y": 340,
        "wires": []
    },
    {
        "id": "840d7886.3bd0c8",
        "type": "mqtt in",
        "z": "935db92.1ef9548",
        "name": "",
        "topic": "safety/inspection/forklift/date/fe03",
        "qos": "2",
        "datatype": "auto",
        "broker": "b90d0ecc.41907",
        "x": 530,
        "y": 380,
        "wires": [
            [
                "bba189c5.871d48"
            ]
        ]
    },
    {
        "id": "ee7c6bca.3672b8",
        "type": "ui_multistate_switch",
        "z": "935db92.1ef9548",
        "name": "3 Way Switch",
        "group": "64754f4c.b5122",
        "order": 5,
        "width": 6,
        "height": 1,
        "label": "",
        "options": [
            {
                "label": "Good",
                "value": "1",
                "valueType": "num"
            },
            {
                "label": "Need Service",
                "value": "2",
                "valueType": "num"
            },
            {
                "label": "Out of Service",
                "value": "3",
                "valueType": "num"
            }
        ],
        "x": 460,
        "y": 460,
        "wires": [
            [
                "78a68b4a.112b64",
                "4520c747.10f428"
            ]
        ]
    },
    {
        "id": "64754f4c.b5122",
        "type": "ui_group",
        "z": "",
        "name": "FE-03",
        "tab": "520d4e1.6420bb",
        "order": 3,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "b90d0ecc.41907",
        "type": "mqtt-broker",
        "z": "",
        "name": "",
        "broker": "test.mosquitto.org",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "compatmode": false,
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    },
    {
        "id": "520d4e1.6420bb",
        "type": "ui_tab",
        "z": "",
        "name": "FORKLIFTS",
        "icon": "dashboard",
        "order": 2,
        "disabled": false,
        "hidden": false
    }
]

```

The problem is the switch is not retaining it's state. It's going back to "Good" every time I access dashboard.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/8/0834dc6e17112c3a49d1a4fb870f8baf491a70f2.png)

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [3 March 2021 13:59 UTC](https://discourse.nodered.org/t/multi-state-switch/41952/2 "2021-03-03T13:59:23Z")

</div>

Yes, it is know if you are using the 1.0 version.  
The 1.1 version is about to be published.  
Read more: [[ANNOUNCE] node-red-contrib-ui-multistate-switch: v1.1.0 beta - #23 by BartButenaers](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-v1-1-0-beta/41265/23)

---

<div class="post-metadata">

**Author:** ![HZB](https://avatars.discourse-cdn.com/v4/letter/h/77aa72/32.png) [@HZB](https://discourse.nodered.org/u/HZB)\
**Post date:** [3 March 2021 15:10 UTC](https://discourse.nodered.org/t/multi-state-switch/41952/3 "2021-03-03T15:10:16Z")

</div>

> [@hotNipi](#):
>
> The 1.1 version is about to be published.

I have a question do i need to update Node red running in my R Pi for this or this will be updated automatically. secondly how to get custom colors per option?

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [3 March 2021 15:16 UTC](https://discourse.nodered.org/t/multi-state-switch/41952/4 "2021-03-03T15:16:47Z")

</div>

Well if you don't want to install the beta version directly from git, you'll need to wait until the new version will be published. It will happen most probably tomorrow. If new version is available, you can update the node via palette manager.

---

<div class="post-metadata">

**Author:** ![HZB](https://avatars.discourse-cdn.com/v4/letter/h/77aa72/32.png) [@HZB](https://discourse.nodered.org/u/HZB)\
**Post date:** [4 March 2021 14:23 UTC](https://discourse.nodered.org/t/multi-state-switch/41952/5 "2021-03-04T14:23:33Z")

</div>

Thanks a lot. I am anxiously waiting for the update. Hope after the update it can it will retain the state and also i can see different colors for different states.

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [4 March 2021 14:35 UTC](https://discourse.nodered.org/t/multi-state-switch/41952/6 "2021-03-04T14:35:45Z")

</div>

Patience, my friend 🙂 a little bit of patience ...

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [4 March 2021 16:01 UTC](https://discourse.nodered.org/t/multi-state-switch/41952/7 "2021-03-04T16:01:19Z")

</div>

> [@HZB](#):
>
> do i need to update Node red running in my R Pi for this or this will be updated automatically

Neither.  
You don't need to update node-RED, just the multi-state switch node when it has been updated.  
Nodes don't update automatically, just keep an eye in your nodes palette, and it will show a `update` button alongside the node name (when there is an update).

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [4 March 2021 17:46 UTC](https://discourse.nodered.org/t/multi-state-switch/41952/8 "2021-03-04T17:46:06Z")

</div>

To be continued [here](https://discourse.nodered.org/t/announce-node-red-contrib-ui-multistate-switch-version-1-1-0/42034)...

---

<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:** [18 March 2021 17:46 UTC](https://discourse.nodered.org/t/multi-state-switch/41952/9 "2021-03-18T17:46:10Z")

</div>

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