Multi State switch

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

[
    {
        "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

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

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?

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.

1 Like

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.

Patience, my friend :slight_smile: a little bit of patience ...

2 Likes

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).

1 Like

To be continued here...

1 Like

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