# Feedback for a flow

**URL:** <https://discourse.nodered.org/t/feedback-for-a-flow/93653>\
**Category:** General\
**Created:** [3 December 2024 07:25 UTC](https://discourse.nodered.org/t/feedback-for-a-flow/93653 "2024-12-03T07:25:14Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![redian](https://avatars.discourse-cdn.com/v4/letter/r/919ad9/32.png) [@redian](https://discourse.nodered.org/u/redian)\
**Post date:** [3 December 2024 07:25 UTC](https://discourse.nodered.org/t/feedback-for-a-flow/93653/1 "2024-12-03T07:25:14Z")

</div>

Hello everyone,  
I am new to Node-RED and recently created a flow for controlling shellies via a dashboard.  
Since I have nobody I could get some feedback from, I thought to come here and share my flow.

I was specifically looking for a better way to add the seperate buttons, since I am currently adding a new group for each unit.

Thanks in advance  
-Jan

```auto
[
    {
        "id": "53dea74fb60818b9",
        "type": "subflow",
        "name": "Shellyinfo",
        "info": "",
        "category": "",
        "in": [
            {
                "x": 140,
                "y": 180,
                "wires": [
                    {
                        "id": "985b46457dc33d13"
                    }
                ]
            }
        ],
        "out": [
            {
                "x": 1100,
                "y": 80,
                "wires": [
                    {
                        "id": "903c245cf7208ba2",
                        "port": 1
                    },
                    {
                        "id": "466ccaf852ddbafc",
                        "port": 0
                    }
                ]
            },
            {
                "x": 920,
                "y": 200,
                "wires": [
                    {
                        "id": "29492bab8d88f197",
                        "port": 0
                    }
                ]
            },
            {
                "x": 920,
                "y": 280,
                "wires": [
                    {
                        "id": "29492bab8d88f197",
                        "port": 1
                    }
                ]
            }
        ],
        "env": [],
        "meta": {},
        "color": "#DDAA99"
    },
    {
        "id": "5a73d051bbe1ee13",
        "type": "http request",
        "z": "53dea74fb60818b9",
        "name": "Request Info",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 410,
        "y": 180,
        "wires": [
            [
                "29492bab8d88f197",
                "903c245cf7208ba2"
            ]
        ]
    },
    {
        "id": "6ce4ab78cea87fce",
        "type": "catch",
        "z": "53dea74fb60818b9",
        "name": "",
        "scope": [
            "5a73d051bbe1ee13"
        ],
        "uncaught": false,
        "x": 270,
        "y": 260,
        "wires": [
            []
        ]
    },
    {
        "id": "29492bab8d88f197",
        "type": "function",
        "z": "53dea74fb60818b9",
        "name": "connection status",
        "func": "\nif(typeof msg.payload === \"string\"){\n\nif(msg.payload.substr(23, 8) === \"TIMEDOUT\"){\n \n \n let id=\"Offline\";\n var stat=false;\n return [{ payload: stat }, {status : id},];\n\n }\n}\n\n\nvar state = (msg.payload[\"switch:0\"].output)\n\nif ((state == true) || (state == false)){\n \n \n let id=\"Online\";\n return [{payload:state},{status : id}];\n \n}\n\n\n\n",
        "outputs": 2,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 670,
        "y": 200,
        "wires": [
            [],
            []
        ]
    },
    {
        "id": "81106714a44faedc",
        "type": "http request",
        "z": "53dea74fb60818b9",
        "d": true,
        "g": "85366ee2c240511b",
        "name": "ON",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "http://10.50.8.18/relay/0?turn=on",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 1350,
        "y": 460,
        "wires": [
            []
        ]
    },
    {
        "id": "aac3c13d70d08a1a",
        "type": "http request",
        "z": "53dea74fb60818b9",
        "d": true,
        "g": "85366ee2c240511b",
        "name": "OFF",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "http://10.50.8.18/relay/0?turn=off",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 1350,
        "y": 500,
        "wires": [
            []
        ]
    },
    {
        "id": "74a931c04d6a295b",
        "type": "http request",
        "z": "53dea74fb60818b9",
        "d": true,
        "g": "85366ee2c240511b",
        "name": "Request Status",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "http://10.50.8.18/relay/0?ison",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 440,
        "y": 500,
        "wires": [
            [
                "f08f547ca839a9be",
                "c668c33ea78af815"
            ]
        ]
    },
    {
        "id": "58e1a6fceaa08c76",
        "type": "ui_gauge",
        "z": "53dea74fb60818b9",
        "d": true,
        "g": "85366ee2c240511b",
        "name": "Leistung",
        "group": "d8a93b295651180e",
        "order": 2,
        "width": 6,
        "height": 4,
        "gtype": "gage",
        "title": "Leistung",
        "label": "Watt",
        "format": "{{msg.payload[\"switch:0\"].apower}}",
        "min": 0,
        "max": "2500",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "diff": false,
        "className": "",
        "x": 560,
        "y": 660,
        "wires": []
    },
    {
        "id": "a34bd3ad0a3087f0",
        "type": "http request",
        "z": "53dea74fb60818b9",
        "d": true,
        "g": "85366ee2c240511b",
        "name": "Request Info",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "http://10.50.8.18/rpc/shelly.GetStatus",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 370,
        "y": 660,
        "wires": [
            [
                "58e1a6fceaa08c76"
            ]
        ]
    },
    {
        "id": "cccef1fa728ad75e",
        "type": "ui_text",
        "z": "53dea74fb60818b9",
        "d": true,
        "g": "85366ee2c240511b",
        "group": "d8a93b295651180e",
        "order": 2,
        "width": 0,
        "height": 0,
        "name": "status",
        "label": "",
        "format": "{{msg.status}}",
        "layout": "row-left",
        "className": "",
        "style": false,
        "font": "",
        "fontSize": 16,
        "color": "#000000",
        "x": 1170,
        "y": 620,
        "wires": []
    },
    {
        "id": "197643be4d3c4747",
        "type": "catch",
        "z": "53dea74fb60818b9",
        "d": true,
        "g": "85366ee2c240511b",
        "name": "",
        "scope": "group",
        "uncaught": false,
        "x": 790,
        "y": 620,
        "wires": [
            [
                "c668c33ea78af815"
            ]
        ]
    },
    {
        "id": "fb3a1d75da8a3fb7",
        "type": "link in",
        "z": "53dea74fb60818b9",
        "d": true,
        "g": "85366ee2c240511b",
        "name": "shelly",
        "links": [
            "6e57c3b844ee43a4"
        ],
        "x": 305,
        "y": 540,
        "wires": [
            [
                "74a931c04d6a295b",
                "a34bd3ad0a3087f0"
            ]
        ]
    },
    {
        "id": "f08f547ca839a9be",
        "type": "change",
        "z": "53dea74fb60818b9",
        "d": true,
        "g": "85366ee2c240511b",
        "name": "extract ison",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "msg.payload.ison",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 630,
        "y": 500,
        "wires": [
            [
                "5be143866fb6e5a3"
            ]
        ]
    },
    {
        "id": "2fdbb3ebc56d8ef3",
        "type": "switch",
        "z": "53dea74fb60818b9",
        "d": true,
        "g": "85366ee2c240511b",
        "name": "an/aus",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "true"
            },
            {
                "t": "false"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1190,
        "y": 480,
        "wires": [
            [
                "81106714a44faedc"
            ],
            [
                "aac3c13d70d08a1a"
            ]
        ]
    },
    {
        "id": "5be143866fb6e5a3",
        "type": "ui_switch",
        "z": "53dea74fb60818b9",
        "d": true,
        "g": "85366ee2c240511b",
        "name": "",
        "label": "AN/AUS",
        "tooltip": "",
        "group": "d8a93b295651180e",
        "order": 1,
        "width": 6,
        "height": 1,
        "passthru": true,
        "decouple": "false",
        "topic": "topic",
        "topicType": "msg",
        "style": "",
        "onvalue": "true",
        "onvalueType": "bool",
        "onicon": "offline_pin",
        "oncolor": "#25e712",
        "offvalue": "false",
        "offvalueType": "bool",
        "officon": "highlight_off",
        "offcolor": "#cb3234",
        "animate": true,
        "className": "",
        "x": 1040,
        "y": 480,
        "wires": [
            [
                "2fdbb3ebc56d8ef3"
            ]
        ]
    },
    {
        "id": "c668c33ea78af815",
        "type": "function",
        "z": "53dea74fb60818b9",
        "d": true,
        "g": "85366ee2c240511b",
        "name": "con.status",
        "func": "if (msg.payload.ison == true || msg.payload.ison == false){\n var id=\"Online\";\n return [null,{status : id}];\n}\n\nif(msg.payload.substr(23, 8) ==\"TIMEDOUT\"){\n var id=\"Offline\";\n var off=false;\n return [{ payload: off }, {status : id},];\n}\n\n",
        "outputs": 2,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1010,
        "y": 620,
        "wires": [
            [
                "5be143866fb6e5a3"
            ],
            [
                "cccef1fa728ad75e"
            ]
        ]
    },
    {
        "id": "985b46457dc33d13",
        "type": "change",
        "z": "53dea74fb60818b9",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "url",
                "pt": "msg",
                "to": "msg.shelly&'rpc/shelly.GetStatus'",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 250,
        "y": 180,
        "wires": [
            [
                "5a73d051bbe1ee13"
            ]
        ]
    },
    {
        "id": "903c245cf7208ba2",
        "type": "switch",
        "z": "53dea74fb60818b9",
        "name": "filter error",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "cont",
                "v": "RequestError",
                "vt": "str"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 660,
        "y": 160,
        "wires": [
            [
                "466ccaf852ddbafc"
            ],
            []
        ]
    },
    {
        "id": "466ccaf852ddbafc",
        "type": "change",
        "z": "53dea74fb60818b9",
        "name": "0W",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "{\"switch:0\":{\"apower\":0}}",
                "tot": "json"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 850,
        "y": 80,
        "wires": [
            []
        ]
    },
    {
        "id": "85366ee2c240511b",
        "type": "group",
        "z": "53dea74fb60818b9",
        "name": "Shelly 9",
        "style": {
            "label": true
        },
        "nodes": [
            "81106714a44faedc",
            "aac3c13d70d08a1a",
            "74a931c04d6a295b",
            "58e1a6fceaa08c76",
            "a34bd3ad0a3087f0",
            "cccef1fa728ad75e",
            "197643be4d3c4747",
            "fb3a1d75da8a3fb7",
            "f08f547ca839a9be",
            "2fdbb3ebc56d8ef3",
            "5be143866fb6e5a3",
            "c668c33ea78af815"
        ],
        "x": 264,
        "y": 419
    },
    {
        "id": "d8a93b295651180e",
        "type": "ui_group",
        "name": "Shelly 9",
        "tab": "52fcd4b2f772d383",
        "order": 3,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "52fcd4b2f772d383",
        "type": "ui_tab",
        "name": "Unverwendete shellys",
        "icon": "dashboard",
        "order": 5,
        "disabled": false,
        "hidden": true
    },
    {
        "id": "9e25da9d9e02e634",
        "type": "subflow",
        "name": "Controll Plug",
        "info": "",
        "category": "",
        "in": [
            {
                "x": 80,
                "y": 360,
                "wires": [
                    {
                        "id": "6237b75b2b51e57f"
                    }
                ]
            }
        ],
        "out": [],
        "env": [],
        "meta": {},
        "color": "#DDAA99"
    },
    {
        "id": "fcf870c7b18d4025",
        "type": "http request",
        "z": "9e25da9d9e02e634",
        "name": "Command shelly",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 770,
        "y": 360,
        "wires": [
            []
        ]
    },
    {
        "id": "6237b75b2b51e57f",
        "type": "switch",
        "z": "9e25da9d9e02e634",
        "name": "an/aus",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "true"
            },
            {
                "t": "false"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 290,
        "y": 360,
        "wires": [
            [
                "b689ceb06654a9e6"
            ],
            [
                "66a927cd6a2ab865"
            ]
        ]
    },
    {
        "id": "b689ceb06654a9e6",
        "type": "change",
        "z": "9e25da9d9e02e634",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "url",
                "pt": "msg",
                "to": "msg.shelly&'relay/0?turn=on'",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 530,
        "y": 300,
        "wires": [
            [
                "fcf870c7b18d4025"
            ]
        ]
    },
    {
        "id": "66a927cd6a2ab865",
        "type": "change",
        "z": "9e25da9d9e02e634",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "url",
                "pt": "msg",
                "to": "msg.shelly&'relay/0?turn=off'",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 530,
        "y": 420,
        "wires": [
            [
                "fcf870c7b18d4025"
            ]
        ]
    },
    {
        "id": "c55eefe4a3a0e765",
        "type": "catch",
        "z": "9e25da9d9e02e634",
        "name": "",
        "scope": [
            "fcf870c7b18d4025"
        ],
        "uncaught": false,
        "x": 730,
        "y": 420,
        "wires": [
            []
        ]
    },
    {
        "id": "9395cb1108b9311a",
        "type": "tab",
        "label": "Shelly Plug Controll ",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "c3ada784e202d1d3",
        "type": "group",
        "z": "9395cb1108b9311a",
        "name": "Refresh",
        "style": {
            "label": true
        },
        "nodes": [
            "67fade5098a57e50",
            "58d38372dd5dc289",
            "569f6180f2f6e9c9",
            "bb5b57301c40b2d2"
        ],
        "x": 14,
        "y": 19,
        "w": 402,
        "h": 122
    },
    {
        "id": "30f3ae33d9d3d89f",
        "type": "group",
        "z": "9395cb1108b9311a",
        "name": "Shelly1",
        "style": {
            "label": true
        },
        "nodes": [
            "d7632c03c8f25529",
            "a14af018da02ee4d",
            "9c1f46e2254c21ec",
            "cc8171792ed40236",
            "3ac23fb49aebaa23",
            "a6d3e35c05a073c7",
            "a30e137f7efe769c",
            "1b6bc5b9af1c17a7",
            "455976210436c5d1"
        ],
        "x": 84,
        "y": 199,
        "w": 1282,
        "h": 162
    },
    {
        "id": "67fade5098a57e50",
        "type": "link out",
        "z": "9395cb1108b9311a",
        "g": "c3ada784e202d1d3",
        "name": "Refresh",
        "mode": "link",
        "links": [
            "48509d47d797f6d9",
            "5c4a0154de1f8a82",
            "d9b27faffd855c0e",
            "1eff00d9d2c33510",
            "ead8637b2ca3251d",
            "8e80c38bd31aa2b1",
            "1b6bc5b9af1c17a7",
            "c24fd76751b8a1cd",
            "8fc6201345280e64",
            "5f9c6d7f2cb17b67",
            "5ca4093f03902c33",
            "9d8368fc0d70be11",
            "b701209c844c4e36",
            "56e2a304f1dfbcf7",
            "e3e80e87ee8a392a",
            "f72240e6e2fdd15d",
            "9817b3bdaa8ade48",
            "2bdadacc50b11fde",
            "5d65b6e35d25e969"
        ],
        "x": 375,
        "y": 60,
        "wires": []
    },
    {
        "id": "58d38372dd5dc289",
        "type": "ui_ui_control",
        "z": "9395cb1108b9311a",
        "g": "c3ada784e202d1d3",
        "name": "",
        "events": "all",
        "x": 120,
        "y": 60,
        "wires": [
            [
                "bb5b57301c40b2d2"
            ]
        ]
    },
    {
        "id": "569f6180f2f6e9c9",
        "type": "inject",
        "z": "9395cb1108b9311a",
        "d": true,
        "g": "c3ada784e202d1d3",
        "name": "Request Switch status",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "5",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 170,
        "y": 100,
        "wires": [
            [
                "67fade5098a57e50"
            ]
        ]
    },
    {
        "id": "bb5b57301c40b2d2",
        "type": "delay",
        "z": "9395cb1108b9311a",
        "g": "c3ada784e202d1d3",
        "name": "slow refresh",
        "pauseType": "rate",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "2",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 270,
        "y": 60,
        "wires": [
            [
                "67fade5098a57e50"
            ]
        ]
    },
    {
        "id": "d7632c03c8f25529",
        "type": "change",
        "z": "9395cb1108b9311a",
        "g": "30f3ae33d9d3d89f",
        "name": "http://10.50.8.10/",
        "rules": [
            {
                "t": "set",
                "p": "shelly",
                "pt": "msg",
                "to": "http://10.50.8.10/",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 250,
        "y": 280,
        "wires": [
            [
                "455976210436c5d1"
            ]
        ]
    },
    {
        "id": "a14af018da02ee4d",
        "type": "ui_gauge",
        "z": "9395cb1108b9311a",
        "g": "30f3ae33d9d3d89f",
        "name": "Leistung",
        "group": "edcf6818e8245ec7",
        "order": 2,
        "width": 6,
        "height": 4,
        "gtype": "gage",
        "title": "Leistung",
        "label": "Watt",
        "format": "{{msg.payload[\"switch:0\"].apower}}",
        "min": 0,
        "max": "2500",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "diff": false,
        "className": "",
        "x": 560,
        "y": 240,
        "wires": []
    },
    {
        "id": "9c1f46e2254c21ec",
        "type": "ui_switch",
        "z": "9395cb1108b9311a",
        "g": "30f3ae33d9d3d89f",
        "name": "",
        "label": "AN/AUS",
        "tooltip": "",
        "group": "edcf6818e8245ec7",
        "order": 1,
        "width": 6,
        "height": 1,
        "passthru": true,
        "decouple": "false",
        "topic": "topic",
        "topicType": "msg",
        "style": "",
        "onvalue": "true",
        "onvalueType": "bool",
        "onicon": "offline_pin",
        "oncolor": "#25e712",
        "offvalue": "false",
        "offvalueType": "bool",
        "officon": "highlight_off",
        "offcolor": "#cb3234",
        "animate": true,
        "className": "",
        "x": 720,
        "y": 260,
        "wires": [
            [
                "a30e137f7efe769c"
            ]
        ]
    },
    {
        "id": "cc8171792ed40236",
        "type": "ui_text",
        "z": "9395cb1108b9311a",
        "g": "30f3ae33d9d3d89f",
        "group": "edcf6818e8245ec7",
        "order": 2,
        "width": 0,
        "height": 0,
        "name": "status",
        "label": "",
        "format": "{{msg.status}}",
        "layout": "row-left",
        "className": "",
        "style": false,
        "font": "",
        "fontSize": 16,
        "color": "#000000",
        "x": 550,
        "y": 320,
        "wires": []
    },
    {
        "id": "3ac23fb49aebaa23",
        "type": "subflow:9e25da9d9e02e634",
        "z": "9395cb1108b9311a",
        "g": "30f3ae33d9d3d89f",
        "name": "Controll Plug",
        "x": 1270,
        "y": 320,
        "wires": []
    },
    {
        "id": "a6d3e35c05a073c7",
        "type": "change",
        "z": "9395cb1108b9311a",
        "g": "30f3ae33d9d3d89f",
        "name": "http://10.50.8.10/",
        "rules": [
            {
                "t": "set",
                "p": "shelly",
                "pt": "msg",
                "to": "http://10.50.8.10/",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1090,
        "y": 320,
        "wires": [
            [
                "3ac23fb49aebaa23"
            ]
        ]
    },
    {
        "id": "a30e137f7efe769c",
        "type": "switch",
        "z": "9395cb1108b9311a",
        "g": "30f3ae33d9d3d89f",
        "name": "änderungs gate",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "neq",
                "v": "",
                "vt": "prev"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 900,
        "y": 320,
        "wires": [
            [
                "a6d3e35c05a073c7"
            ]
        ]
    },
    {
        "id": "1b6bc5b9af1c17a7",
        "type": "link in",
        "z": "9395cb1108b9311a",
        "g": "30f3ae33d9d3d89f",
        "name": "shelly",
        "links": [
            "67fade5098a57e50"
        ],
        "x": 125,
        "y": 280,
        "wires": [
            [
                "d7632c03c8f25529"
            ]
        ]
    },
    {
        "id": "4f9c0c7ead51cb46",
        "type": "ui_ui_control",
        "z": "9395cb1108b9311a",
        "name": "warning",
        "events": "connect",
        "x": 500,
        "y": 60,
        "wires": [
            [
                "437fc0736359157e"
            ]
        ]
    },
    {
        "id": "7af4e585403d30a9",
        "type": "ui_toast",
        "z": "9395cb1108b9311a",
        "position": "top right",
        "displayTime": "10",
        "highlight": "red",
        "sendall": true,
        "outputs": 0,
        "ok": "OK",
        "cancel": "",
        "raw": false,
        "className": "",
        "topic": "",
        "name": "",
        "x": 1180,
        "y": 80,
        "wires": []
    },
    {
        "id": "437fc0736359157e",
        "type": "change",
        "z": "9395cb1108b9311a",
        "name": "warn text",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "Please be careful and don't make rapid changes.",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "The buttons turn on the power to the computers. ",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 640,
        "y": 60,
        "wires": [
            [
                "cd685ebb4b157083"
            ]
        ]
    },
    {
        "id": "cd685ebb4b157083",
        "type": "delay",
        "z": "9395cb1108b9311a",
        "name": "",
        "pauseType": "delay",
        "timeout": "0.5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 810,
        "y": 60,
        "wires": [
            [
                "1ab2ff1d637886a1",
                "4b3a5d2900287456"
            ]
        ]
    },
    {
        "id": "1ab2ff1d637886a1",
        "type": "delay",
        "z": "9395cb1108b9311a",
        "name": "",
        "pauseType": "delay",
        "timeout": "1",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1000,
        "y": 80,
        "wires": [
            [
                "7af4e585403d30a9"
            ]
        ]
    },
    {
        "id": "4b3a5d2900287456",
        "type": "change",
        "z": "9395cb1108b9311a",
        "name": "empty",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 970,
        "y": 40,
        "wires": [
            [
                "40e2e317f0f85d3c"
            ]
        ]
    },
    {
        "id": "40e2e317f0f85d3c",
        "type": "ui_ui_control",
        "z": "9395cb1108b9311a",
        "name": "reload page",
        "events": "all",
        "x": 1110,
        "y": 40,
        "wires": [
            []
        ]
    },
    {
        "id": "455976210436c5d1",
        "type": "subflow:53dea74fb60818b9",
        "z": "9395cb1108b9311a",
        "g": "30f3ae33d9d3d89f",
        "name": "",
        "x": 420,
        "y": 280,
        "wires": [
            [
                "a14af018da02ee4d"
            ],
            [
                "9c1f46e2254c21ec",
                "a30e137f7efe769c"
            ],
            [
                "cc8171792ed40236"
            ]
        ]
    },
    {
        "id": "edcf6818e8245ec7",
        "type": "ui_group",
        "name": "HAG Hallenmonitor",
        "tab": "a2d46a71b9db5230",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "a2d46a71b9db5230",
        "type": "ui_tab",
        "name": "Halle3",
        "icon": "dashboard",
        "order": 4,
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [3 December 2024 09:25 UTC](https://discourse.nodered.org/t/feedback-for-a-flow/93653/2 "2024-12-03T09:25:48Z")

</div>

Hi There,

Having a quick look, I would say:

- Good use of switch and change, you have avoided the use of the function node for those things. Especially since you have used jsonata which removes the need to use a function node in many cases.

- Code formatting could be improved, for example:

 ![Screenshot 2024-12-03 at 10.00.03](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/b/8be64f598b96889108bbf570b5bef87e98615e59.png)

becomes:

 ![Screenshot 2024-12-03 at 10.00.41](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/0/507e4112dc6414ead0a2b530b4245926481e6017.png)

But also jsonata expressions: `msg.shelly&'relay/0?turn=on'` could become `msg.shelly & 'relay/0?turn=on'` to improve readability.

- avoid duplication of constant values, you have two nodes that set `msg.shelly` - use a global or environment value instead.

 ![Screenshot 2024-12-03 at 10.22.57](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/8/c859ee84770dfa74280d7fd8aeb7b8fed72e2de3.png)

becomes:

 ![Screenshot 2024-12-03 at 10.23.25](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/b/ab0b72f5d9771cabba8a64c95fdb0d79471fdd7c.png)

(for example)

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [3 December 2024 11:39 UTC](https://discourse.nodered.org/t/feedback-for-a-flow/93653/3 "2024-12-03T11:39:01Z")

</div>

Couple of notes.

When sharing a flow, it can be helpful to share an image from the Editor showing the flow as this will often save people having to load the flow into a test system.

In terms of function nodes vs JSONata - just note that, for high throughput, function nodes are sometimes preferred since JSONata has quite an overhead. If using JSONata, try to ensure you minimise the number of calls to it. In addition, sometimes complex logic may be easier to follow in a function node rather than having a complex flow with many nodes. Ultimately though, there is no absolute right or wrong answer and a lot depends on your knowledge and experience.

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [3 December 2024 12:30 UTC](https://discourse.nodered.org/t/feedback-for-a-flow/93653/4 "2024-12-03T12:30:21Z")

</div>

> [@TotallyInformation](#):
>
> When sharing a flow, it can be helpful to share an image from the Editor showing the flow as this will often save people having to load the flow into a test system.

What I did was take the flow and import into the [serverless NodeRED](https://cdn.flowhub.org) and view in that. Can't execute the flow but for purposes of viewing/understanding the flow, that's fine.

I won't go into why the forum could integrate the [flowviewer](https://github.com/gorenje/node-red-flowviewer-js) so that images are generated automagically.

> [@TotallyInformation](#):
>
> In terms of function nodes vs JSONata - just note that, for high throughput, function nodes are sometimes preferred since

Good advice. For viewable and understandability, I find a change better than function since there are _less_ side-effects when using a change node (and no computation possible).

It's a pity that JSONata has this overhead since in an ideal world, there would be a node for msg/flow/global modifications and a node for functionality to do computation and both would have the same amount of overhead.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [3 December 2024 14:10 UTC](https://discourse.nodered.org/t/feedback-for-a-flow/93653/5 "2024-12-03T14:10:39Z")

</div>

> [@gregorius](#):
>
> I won't go into why the forum could integrate the [flowviewer](https://github.com/gorenje/node-red-flowviewer-js) so that images are generated automagically.

Not sure that is possible with Discourse. Though it would certainly be nice.

> [@gregorius](#):
>
> For viewable and understandability, I find a change better than function since there are _less_ side-effects when using a change node (and no computation possible).

It is very much a balancing act. Once a flow reaches a certain level of complexity, most people will want to look for creative ways to simplify it.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/e/6ef123cefd8d7df23232df7d1b11fc322c43db14.png)  
In this example, you can see several possible approaches all used depending on the flow of logic and how I was feeling the day(s) I wrote it! 🙂

> [@gregorius](#):
>
> It's a pity that JSONata has this overhead since in an ideal world, there would be a node for msg/flow/global modifications and a node for functionality to do computation and both would have the same amount of overhead.

True, though worth remembering that JSONata, like other transformation languages (XLST for example) has a _cognitive_ load as well as a processing/memory load. For most people, certain transformation tasks will be really obvious and simple with JSONata and others will leave you sweating with mental stress and a feeling of utter inadequacy for days! 🤷 JavaScript, like other procedural style languages, has a more linear mental load.

---

<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:** [3 December 2024 14:50 UTC](https://discourse.nodered.org/t/feedback-for-a-flow/93653/6 "2024-12-03T14:50:45Z")

</div>

> [@TotallyInformation](#):
>
> In this example, you can see several possible approaches

Wow it never occurred to me to try \n in the group name, that's excellent.  
I still wish we could put text both at the top and the bottom of the group.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [3 December 2024 14:57 UTC](https://discourse.nodered.org/t/feedback-for-a-flow/93653/7 "2024-12-03T14:57:01Z")

</div>

> [@jbudd](#):
>
> Wow it never occurred to me to try \n in the group name,

Yes, though you do need to remember to include spaces around it. It is a shame that it can't simply take Markdown instead, that would be a LOT nicer.

> [@jbudd](#):
>
> I still wish we could put text both at the top and the bottom of the group.

Well, I guess we have to stop somewhere. You can always add a comment node of course.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [3 December 2024 17:01 UTC](https://discourse.nodered.org/t/feedback-for-a-flow/93653/8 "2024-12-03T17:01:50Z")

</div>

> [@gregorius](#):
>
> But also jsonata expressions: `msg.shelly&'relay/0?turn=on'` could become `msg.shelly & 'relay/0?turn=on'` to improve readability.

I would suggest not using `msg.` as that forces compatibility mode. Either omit msg or use `$$.`

> [@TotallyInformation](#):
>
> In terms of function nodes vs JSONata - just note that, for high throughput, function nodes are sometimes preferred since JSONata has quite an overhead.

Version 1.6 did , but newer version 2 is comparable with javascript using the JSONata functions as exampled here [JSONATA Array Filtering - #4 by E1cid](https://discourse.nodered.org/t/jsonata-array-filtering/92640/4)

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [3 December 2024 20:10 UTC](https://discourse.nodered.org/t/feedback-for-a-flow/93653/9 "2024-12-03T20:10:21Z")

</div>

> [@E1cid](#):
>
> Version 1.6 did , but newer version 2 is comparable with javascript using the JSONata functions as exampled here

Good to know. That just leaves the cognitive load then. 😄

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [3 December 2024 20:13 UTC](https://discourse.nodered.org/t/feedback-for-a-flow/93653/10 "2024-12-03T20:13:32Z")

</div>

> [@TotallyInformation](#):
>
> That just leaves the cognitive load then. 😄

That would be subjectively relevant to each individuals cognitive functionality i suppose.

---

<div class="post-metadata">

**Author:** ![redian](https://avatars.discourse-cdn.com/v4/letter/r/919ad9/32.png) [@redian](https://discourse.nodered.org/u/redian)\
**Post date:** [4 December 2024 06:57 UTC](https://discourse.nodered.org/t/feedback-for-a-flow/93653/11 "2024-12-04T06:57:30Z")

</div>

First off thanks to TotallyInformation, I will post screenshots in the future.  
Glad to hear that JSONata doesn't add problems since I switched from functions to these  
expressions for certain things.  
But I will pay attention to it in the future.

I added an intializer for the global variables like gregorius sugguested.

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

@E1cid could you explain what you mean by  
"I would suggest not using msg. as that forces compatibility mode. Either omit msg or use $$.", please?

Lastly, is there a way to get around having multiple coppies of the group "Shelly1" for more devices?

Thanks for the great advice  
-Jan

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [4 December 2024 07:32 UTC](https://discourse.nodered.org/t/feedback-for-a-flow/93653/12 "2024-12-04T07:32:12Z")

</div>

> [@redian](#):
>
> "I would suggest not using msg. as that forces compatibility mode. Either omit msg or use $$.", please?

It is explained in the editor if you click `compatibility mode enabled`

 ![Screenshot_20241204-072857](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/6/26268ed600f63d481e0a3a043fc4b89882750ce3.png)

---

<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:** [4 March 2025 07:32 UTC](https://discourse.nodered.org/t/feedback-for-a-flow/93653/13 "2025-03-04T07:32:25Z")

</div>

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