# Same subflow, different happening on different machines

**URL:** https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140
**Category:** General
**Created:** [2 February 2024 06:40 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140 "2024-02-02T06:40:44Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [2 February 2024 06:40 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/1 "2024-02-02T06:40:44Z")

</div>

Sorry folks:

_..... I'm ba-ack.....!_

I've recently been working on a `subflow` and made a lot of silly mistakes.  
(I'll cop that.)

So entered the command correctly and all should be good - yeah?  
☹  
Nah.

One machine it works, the other machine, doesn't.

Details:  
NR 3.0.2  
node -v 16.20.02  
both machines.

So what's going on?

The error I get is:

```auto
{"message":"Invalid JSONata expression: Cannot read properties of undefined (reading 'startsWith')","source":{"id":"da42a7e9064de621","type":"change","name":"#1","count":1}}

```

What throws me is:  
`undefined (reading 'startsWith')`

It is a `change` node.

(code)

```auto
[
    {
        "id": "27d2dd9a875ab1a5",
        "type": "change",
        "z": "94cf2ea396e5b6f6",
        "name": "#1",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "DN",
                "tot": "env"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "topic & '/cmnd/power' & $env(power)",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1080,
        "y": 160,
        "wires": [
            []
        ]
    }
]

```

There's no _startingwith( )_ in there.

So I'm guessing it is a syntactical problem.

For the sake of sharing:  
The code - no GUI stuff or MQTT nodes.  
But the guts of the code:

```auto
[{"id":"94cf2ea396e5b6f6","type":"subflow","name":"MQTT Button Toggle","info":"# 2023 02 08\nAdded status text to icon to \nshow status of device.\n\n# 2023 01 25\nControl MQTT devices (power points)\nwith this node.\n\n`Button` node MUST have `topic` set to include\nthe device's name. eg: `A1/button`\nand the payload MUST be `X`\n\nSet the `Device Name` to (eg) `A1` to\ncontrol `A1` device.\n\n`payload` must be `X` to TOGGLE output\n\nsend `ON` to force ON state\n\nsend `OFF` to force OFF state\n\nsend `RELOAD` to force button to\ndisplay current state.\n(added 2024 01 28)\n\n","category":"","in":[{"x":100,"y":160,"wires":[{"id":"0cc9b2fa9b2af8df"}]}],"out":[{"x":1280,"y":220,"wires":[{"id":"66fb54e88f4acb8d","port":0}]},{"x":1250,"y":160,"wires":[{"id":"27d2dd9a875ab1a5","port":0}]}],"env":[{"name":"DN","type":"str","value":"","ui":{"label":{"en-US":"Device Name"},"type":"input","opts":{"types":["str"]}}},{"name":"power","type":"num","value":"","ui":{"label":{"en-US":"Output"},"type":"input","opts":{"types":["num"]}}}],"meta":{},"color":"#DDAA99","inputLabels":["MQTT (tele and LWT) and button input"],"outputLabels":["Back to `button` input","MQTT output"],"status":{"x":1200,"y":270,"wires":[{"id":"45a85f7621f5c28f","port":0}]}},{"id":"541720ad73579447","type":"switch","z":"94cf2ea396e5b6f6","name":"what message?","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"/stat/POWER","vt":"str"},{"t":"cont","v":"/tele/LWT","vt":"str"},{"t":"cont","v":"button","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":315,"y":160,"wires":[["61843ca1684f9f9d"],["4788b5265af1d45a"],["5b8cd9fe254ea8d1"]],"l":false},{"id":"61843ca1684f9f9d","type":"delay","z":"94cf2ea396e5b6f6","name":"Delay","pauseType":"delay","timeout":"200","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":460,"y":80,"wires":[["bdb2c46daf62b36f"]]},{"id":"6d4704f6fc9b98be","type":"change","z":"94cf2ea396e5b6f6","name":"RESET","rules":[{"t":"set","p":"payload","pt":"msg","to":"RESET","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":120,"wires":[["bdb2c46daf62b36f"]]},{"id":"4788b5265af1d45a","type":"switch","z":"94cf2ea396e5b6f6","name":"LWT","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Online","vt":"str"},{"t":"eq","v":"Offline","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":460,"y":160,"wires":[["6d4704f6fc9b98be","bc2aabd04561d534"],["6a82c12953657965"]]},{"id":"6a82c12953657965","type":"function","z":"94cf2ea396e5b6f6","name":"BAN","func":"msg = {icon: '<font color = \"red\"><i class=\"fa fa-ban fa-3x\"></i></font>'};\nreturn msg;","outputs":1,"noerr":0,"x":460,"y":200,"wires":[["8dc8a0dd2b669ae3","704ae850657c9724"]]},{"id":"bc2aabd04561d534","type":"change","z":"94cf2ea396e5b6f6","name":"Enable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"ARLEC-1","pt":"flow","to":"ONLINE","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":160,"wires":[["66fb54e88f4acb8d"]]},{"id":"bdb2c46daf62b36f","type":"function","z":"94cf2ea396e5b6f6","name":"Set state","func":"let device = msg.topic.split(\"/\");\nnode.warn(\"Device \" + device[0]);\nnode.warn(\"Payload \" + msg.payload);\n\nif (msg.payload == \"RESET\")\n{\n let state = context.get(device[0]);\n if (state === 0)\n {\n //\n msg= {\"icon\": '<font color = \"red\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>',\"background\":\"black\"};\n return msg;\n }\n //\n}\nif (msg.payload == \"ON\")\n{\n msg = { \"icon\": '<font color = \"lime\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"background\": \"black\" };\n context.set(\"STATE\",1);\n context.set(device[0],1);\n} else\n{\n msg = { \"icon\": '<font color = \"red\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>', \"background\": \"black\" };\n context.set(\"STATE\",0);\n context.set(device[0], 1);\n}\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":660,"y":120,"wires":[["66fb54e88f4acb8d"]]},{"id":"8dc8a0dd2b669ae3","type":"change","z":"94cf2ea396e5b6f6","name":"Disable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"ARLEC-1","pt":"flow","to":"OFFLINE","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":200,"wires":[["66fb54e88f4acb8d"]]},{"id":"5b8cd9fe254ea8d1","type":"function","z":"94cf2ea396e5b6f6","name":"Button control","func":"let msg1 = {};\n\nlet x = msg.payload;\nlet counter = context.get(\"counter\") || 0;\nif (x == \"X\")\n{\n counter = (counter + 1) % 2;\n context.set(\"counter\",counter);\n if (counter === 0)\n {\n //\n msg.payload = \"OFF\";\n msg1 = {\"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>',\"background\":\"black\"};\n } else\n {\n //\n msg.payload = \"ON\";\n msg1 = {\"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>',\"backgound\":\"black\"};\n }\n}\nif (x == \"RELOAD\")\n{\n // Reload/display status.\n if (counter == 0)\n {\n // OFF\n x = \"OFF\";\n msg.payload = \"OFF\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>', \"background\": \"black\" };\n }\n else\n if (counter == 1)\n {\n // ON\n x = \"ON\";\n msg.payload = \"ON\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"backgound\": \"black\" };\n }\n}\n\n\nif (x == \"ON\")\n{\n // Force power ON\n msg.payload = \"ON\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"backgound\": \"black\" };\n context.set(\"counter\",1);\n}\nif (x == \"OFF\")\n{\n // Force power OFF\n msg.payload = \"OFF\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"backgound\": \"black\" };\n context.set(\"counter\",0);\n}\n\nreturn [msg,msg1];","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":870,"y":120,"wires":[["4f29a481b6f0d0e3","0ae8f43ccf9a1016"],["66fb54e88f4acb8d"]]},{"id":"4f29a481b6f0d0e3","type":"delay","z":"94cf2ea396e5b6f6","name":"Delay","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1080,"y":120,"wires":[["27d2dd9a875ab1a5"]]},{"id":"27d2dd9a875ab1a5","type":"change","z":"94cf2ea396e5b6f6","name":"#1","rules":[{"t":"set","p":"topic","pt":"msg","to":"DN","tot":"env"},{"t":"set","p":"topic","pt":"msg","to":"topic & '/cmnd/power' & $env(power)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":160,"wires":[[]]},{"id":"7207fbe19cc07923","type":"switch","z":"94cf2ea396e5b6f6","name":"Only for this device","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"DN","vt":"env"},{"t":"eq","v":"MASTER","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":255,"y":160,"wires":[["541720ad73579447"],["6a82c12953657965"]],"l":false},{"id":"0ae8f43ccf9a1016","type":"function","z":"94cf2ea396e5b6f6","name":"Identify","func":"let dev = env.get(\"DN\") + \" \" + env.get(\"power\");\nlet status = msg.payload;\n\nnode.status(dev + \" \" + status);","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\nnode.status(env.get(\"DN\"));\n","finalize":"","libs":[],"x":660,"y":270,"wires":[[]]},{"id":"45a85f7621f5c28f","type":"status","z":"94cf2ea396e5b6f6","name":"","scope":["0ae8f43ccf9a1016"],"x":1070,"y":270,"wires":[[]]},{"id":"704ae850657c9724","type":"change","z":"94cf2ea396e5b6f6","name":"Wipe status when unplugged","rules":[{"t":"set","p":"payload","pt":"msg","to":" ","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":425,"y":270,"wires":[["0ae8f43ccf9a1016"]],"l":false},{"id":"0cc9b2fa9b2af8df","type":"switch","z":"94cf2ea396e5b6f6","name":"Reload?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"RELOAD","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":175,"y":160,"wires":[["5b8cd9fe254ea8d1"],["7207fbe19cc07923"]],"l":false},{"id":"66fb54e88f4acb8d","type":"junction","z":"94cf2ea396e5b6f6","x":800,"y":220,"wires":[[]]},{"id":"e72bae9952eddd60","type":"inject","z":"26262ba1.62dcbc","name":"Button","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"A5/button","payload":"X","payloadType":"str","x":1530,"y":4730,"wires":[["76117c24ef0f5cf3"]]},{"id":"76117c24ef0f5cf3","type":"link out","z":"26262ba1.62dcbc","name":"Button","mode":"link","links":["bfdb3c588016491b"],"x":1625,"y":4770,"wires":[]},{"id":"bfdb3c588016491b","type":"link in","z":"26262ba1.62dcbc","name":"Button","links":["76117c24ef0f5cf3"],"x":1035,"y":4840,"wires":[["7ebd5a2bb58fd95c"]]},{"id":"9508b1d704f5549d","type":"subflow:94cf2ea396e5b6f6","z":"26262ba1.62dcbc","name":"","env":[{"name":"DN","value":"A5","type":"str"},{"name":"power","value":"1","type":"num"},{"name":"Device name","value":"A1","type":"str"}],"x":1260,"y":4800,"wires":[["099a494a54542f2d","3b578a30c600e702"],["e87f2ab9ebfdeb7f"]]}]

```

On _machine 1_ I press the `inject` and the subflow works.

On _machine 2_ I press the `inject` and get the error.

Note:  
the `node-status` changes on the _faulty_ machine though. So all is good to there.

P.P.S

If I change that `change` node to this:

```auto
[
    {
        "id": "27d2dd9a875ab1a5",
        "type": "change",
        "z": "94cf2ea396e5b6f6",
        "name": "#1",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "DN",
                "tot": "env"
            },
            {
                "t": "set",
                "p": "power",
                "pt": "msg",
                "to": "power",
                "tot": "env"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "topic & '/cmnd/power' & power",
                "tot": "jsonata"
            },
            {
                "t": "delete",
                "p": "power",
                "pt": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1080,
        "y": 160,
        "wires": [
            []
        ]
    }
]

```

No error.

P.P.P.S.  
Just checked.  
the `change` node on both machines: same version.  
3.0.2

Sorry folks, I seem to be missing something.

---

<div class="post-metadata">

### Author: ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)
#### Post date: [2 February 2024 09:23 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/2 "2024-02-02T09:23:58Z")

</div>

Just a thought, does $env(power) exist on failing machine?

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [2 February 2024 09:26 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/3 "2024-02-02T09:26:10Z")

</div>

Good question.

Alas,  
Yes.

Out of interest, does the flow work for you?

---

<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: [2 February 2024 09:46 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/4 "2024-02-02T09:46:59Z")

</div>

Your test flow appears to missing some vital elements

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/d/fdf85591d5969dcd8431f2047937e684f94d4b80.png)

I don't use JSONata much, but I think it should be $env('power')

Also you should upgrade to the latest version of node-red.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [2 February 2024 09:50 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/5 "2024-02-02T09:50:26Z")

</div>

Oh, thanks.

Interesting.

Hang on.

New code/flow.

# This is the working subflow code.

```auto
[{"id":"94cf2ea396e5b6f6","type":"subflow","name":"MQTT Button Toggle","info":"# 2023 02 08\nAdded status text to icon to \nshow status of device.\n\n# 2023 01 25\nControl MQTT devices (power points)\nwith this node.\n\n`Button` node MUST have `topic` set to include\nthe device's name. eg: `A1/button`\nand the payload MUST be `X`\n\nSet the `Device Name` to (eg) `A1` to\ncontrol `A1` device.\n\n`payload` must be `X` to TOGGLE output\n\nsend `ON` to force ON state\n\nsend `OFF` to force OFF state\n\nsend `RELOAD` to force button to\ndisplay current state.\n(added 2024 01 28)\n\n","category":"","in":[{"x":100,"y":160,"wires":[{"id":"0cc9b2fa9b2af8df"}]}],"out":[{"x":1280,"y":220,"wires":[{"id":"66fb54e88f4acb8d","port":0}]},{"x":1250,"y":160,"wires":[{"id":"27d2dd9a875ab1a5","port":0}]}],"env":[{"name":"DN","type":"str","value":"","ui":{"label":{"en-US":"Device Name"},"type":"input","opts":{"types":["str"]}}},{"name":"power","type":"num","value":"","ui":{"label":{"en-US":"Output"},"type":"input","opts":{"types":["num"]}}}],"meta":{},"color":"#DDAA99","inputLabels":["MQTT (tele and LWT) and button input"],"outputLabels":["Back to `button` input","MQTT output"],"status":{"x":1200,"y":270,"wires":[{"id":"45a85f7621f5c28f","port":0}]}},{"id":"541720ad73579447","type":"switch","z":"94cf2ea396e5b6f6","name":"what message?","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"/stat/POWER","vt":"str"},{"t":"cont","v":"/tele/LWT","vt":"str"},{"t":"cont","v":"button","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":315,"y":160,"wires":[["61843ca1684f9f9d"],["4788b5265af1d45a"],["5b8cd9fe254ea8d1"]],"l":false},{"id":"61843ca1684f9f9d","type":"delay","z":"94cf2ea396e5b6f6","name":"Delay","pauseType":"delay","timeout":"200","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":460,"y":80,"wires":[["bdb2c46daf62b36f"]]},{"id":"6d4704f6fc9b98be","type":"change","z":"94cf2ea396e5b6f6","name":"RESET","rules":[{"t":"set","p":"payload","pt":"msg","to":"RESET","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":120,"wires":[["bdb2c46daf62b36f"]]},{"id":"4788b5265af1d45a","type":"switch","z":"94cf2ea396e5b6f6","name":"LWT","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Online","vt":"str"},{"t":"eq","v":"Offline","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":460,"y":160,"wires":[["6d4704f6fc9b98be","bc2aabd04561d534"],["6a82c12953657965"]]},{"id":"6a82c12953657965","type":"function","z":"94cf2ea396e5b6f6","name":"BAN","func":"msg = {icon: '<font color = \"red\"><i class=\"fa fa-ban fa-3x\"></i></font>'};\nreturn msg;","outputs":1,"noerr":0,"x":460,"y":200,"wires":[["8dc8a0dd2b669ae3","704ae850657c9724"]]},{"id":"bc2aabd04561d534","type":"change","z":"94cf2ea396e5b6f6","name":"Enable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"ARLEC-1","pt":"flow","to":"ONLINE","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":160,"wires":[["66fb54e88f4acb8d"]]},{"id":"bdb2c46daf62b36f","type":"function","z":"94cf2ea396e5b6f6","name":"Set state","func":"let device = msg.topic.split(\"/\");\nnode.warn(\"Device \" + device[0]);\nnode.warn(\"Payload \" + msg.payload);\n\nif (msg.payload == \"RESET\")\n{\n let state = context.get(device[0]);\n if (state === 0)\n {\n //\n msg= {\"icon\": '<font color = \"red\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>',\"background\":\"black\"};\n return msg;\n }\n //\n}\nif (msg.payload == \"ON\")\n{\n msg = { \"icon\": '<font color = \"lime\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"background\": \"black\" };\n context.set(\"STATE\",1);\n context.set(device[0],1);\n} else\n{\n msg = { \"icon\": '<font color = \"red\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>', \"background\": \"black\" };\n context.set(\"STATE\",0);\n context.set(device[0], 1);\n}\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":660,"y":120,"wires":[["66fb54e88f4acb8d"]]},{"id":"8dc8a0dd2b669ae3","type":"change","z":"94cf2ea396e5b6f6","name":"Disable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"ARLEC-1","pt":"flow","to":"OFFLINE","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":200,"wires":[["66fb54e88f4acb8d"]]},{"id":"5b8cd9fe254ea8d1","type":"function","z":"94cf2ea396e5b6f6","name":"Button control","func":"let msg1 = {};\n\nlet x = msg.payload;\nlet counter = context.get(\"counter\") || 0;\nif (x == \"X\")\n{\n counter = (counter + 1) % 2;\n context.set(\"counter\",counter);\n if (counter === 0)\n {\n //\n msg.payload = \"OFF\";\n msg1 = {\"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>',\"background\":\"black\"};\n } else\n {\n //\n msg.payload = \"ON\";\n msg1 = {\"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>',\"backgound\":\"black\"};\n }\n}\nif (x == \"RELOAD\")\n{\n // Reload/display status.\n if (counter == 0)\n {\n // OFF\n x = \"OFF\";\n msg.payload = \"OFF\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>', \"background\": \"black\" };\n }\n else\n if (counter == 1)\n {\n // ON\n x = \"ON\";\n msg.payload = \"ON\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"backgound\": \"black\" };\n }\n}\n\n\nif (x == \"ON\")\n{\n // Force power ON\n msg.payload = \"ON\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"backgound\": \"black\" };\n context.set(\"counter\",1);\n}\nif (x == \"OFF\")\n{\n // Force power OFF\n msg.payload = \"OFF\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"backgound\": \"black\" };\n context.set(\"counter\",0);\n}\n\nreturn [msg,msg1];","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":870,"y":120,"wires":[["4f29a481b6f0d0e3","0ae8f43ccf9a1016"],["66fb54e88f4acb8d"]]},{"id":"4f29a481b6f0d0e3","type":"delay","z":"94cf2ea396e5b6f6","name":"Delay","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1080,"y":120,"wires":[["27d2dd9a875ab1a5"]]},{"id":"27d2dd9a875ab1a5","type":"change","z":"94cf2ea396e5b6f6","name":"#1","rules":[{"t":"set","p":"topic","pt":"msg","to":"DN","tot":"env"},{"t":"set","p":"power","pt":"msg","to":"power","tot":"env"},{"t":"set","p":"topic","pt":"msg","to":"topic & '/cmnd/power' & power","tot":"jsonata"},{"t":"delete","p":"power","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":160,"wires":[[]]},{"id":"7207fbe19cc07923","type":"switch","z":"94cf2ea396e5b6f6","name":"Only for this device","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"DN","vt":"env"},{"t":"eq","v":"MASTER","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":255,"y":160,"wires":[["541720ad73579447"],["6a82c12953657965"]],"l":false},{"id":"0ae8f43ccf9a1016","type":"function","z":"94cf2ea396e5b6f6","name":"Identify","func":"let dev = env.get(\"DN\") + \" \" + env.get(\"power\");\nlet status = msg.payload;\n\nnode.status(dev + \" \" + status);","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\nnode.status(env.get(\"DN\"));\n","finalize":"","libs":[],"x":660,"y":270,"wires":[[]]},{"id":"45a85f7621f5c28f","type":"status","z":"94cf2ea396e5b6f6","name":"","scope":["0ae8f43ccf9a1016"],"x":1070,"y":270,"wires":[[]]},{"id":"704ae850657c9724","type":"change","z":"94cf2ea396e5b6f6","name":"Wipe status when unplugged","rules":[{"t":"set","p":"payload","pt":"msg","to":" ","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":425,"y":270,"wires":[["0ae8f43ccf9a1016"]],"l":false},{"id":"0cc9b2fa9b2af8df","type":"switch","z":"94cf2ea396e5b6f6","name":"Reload?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"RELOAD","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":175,"y":160,"wires":[["5b8cd9fe254ea8d1"],["7207fbe19cc07923"]],"l":false},{"id":"66fb54e88f4acb8d","type":"junction","z":"94cf2ea396e5b6f6","x":800,"y":220,"wires":[[]]},{"id":"855284d6a5fc170b","type":"link in","z":"6dd5ca4d.d1958c","g":"9f60476ecbac25b5","name":"Button","links":["c2f5a62f6628cf5f","fbd3f3b5b44d5dbb"],"x":4065,"y":4040,"wires":[["8cf1535e17381a6a"]]},{"id":"8cf1535e17381a6a","type":"subflow:94cf2ea396e5b6f6","z":"6dd5ca4d.d1958c","g":"9f60476ecbac25b5","name":"","env":[{"name":"DN","value":"A8","type":"str"},{"name":"power","value":"1","type":"num"},{"name":"Device name","value":"A1","type":"str"}],"x":4210,"y":4000,"wires":[["ec6fb6fef082bdb3"],["d7a4eeb602615312","4acfea6a575732bb"]]},{"id":"fbd3f3b5b44d5dbb","type":"link out","z":"6dd5ca4d.d1958c","g":"9f60476ecbac25b5","name":"link out 49","mode":"link","links":["855284d6a5fc170b"],"x":4515,"y":3970,"wires":[]},{"id":"456bf6dc69b793ae","type":"inject","z":"6dd5ca4d.d1958c","g":"9f60476ecbac25b5","name":"Button","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"A8/button","payload":"X","payloadType":"str","x":4420,"y":3930,"wires":[["fbd3f3b5b44d5dbb"]]}]

```

Or, connect the `link-in` node to the input of the `subflow`.

Don't know how that connection got missed.

# Update:

This is with the code which causes errors on the other machine.  
It should work, but doesn't.

```auto
[{"id":"94cf2ea396e5b6f6","type":"subflow","name":"MQTT Button Toggle","info":"# 2023 02 08\nAdded status text to icon to \nshow status of device.\n\n# 2023 01 25\nControl MQTT devices (power points)\nwith this node.\n\n`Button` node MUST have `topic` set to include\nthe device's name. eg: `A1/button`\nand the payload MUST be `X`\n\nSet the `Device Name` to (eg) `A1` to\ncontrol `A1` device.\n\n`payload` must be `X` to TOGGLE output\n\nsend `ON` to force ON state\n\nsend `OFF` to force OFF state\n\nsend `RELOAD` to force button to\ndisplay current state.\n(added 2024 01 28)\n\n","category":"","in":[{"x":100,"y":160,"wires":[{"id":"0cc9b2fa9b2af8df"}]}],"out":[{"x":1280,"y":220,"wires":[{"id":"66fb54e88f4acb8d","port":0}]},{"x":1250,"y":160,"wires":[{"id":"27d2dd9a875ab1a5","port":0}]}],"env":[{"name":"DN","type":"str","value":"","ui":{"label":{"en-US":"Device Name"},"type":"input","opts":{"types":["str"]}}},{"name":"power","type":"num","value":"","ui":{"label":{"en-US":"Output"},"type":"input","opts":{"types":["num"]}}}],"meta":{},"color":"#DDAA99","inputLabels":["MQTT (tele and LWT) and button input"],"outputLabels":["Back to `button` input","MQTT output"],"status":{"x":1200,"y":270,"wires":[{"id":"45a85f7621f5c28f","port":0}]}},{"id":"541720ad73579447","type":"switch","z":"94cf2ea396e5b6f6","name":"what message?","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"/stat/POWER","vt":"str"},{"t":"cont","v":"/tele/LWT","vt":"str"},{"t":"cont","v":"button","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":315,"y":160,"wires":[["61843ca1684f9f9d"],["4788b5265af1d45a"],["5b8cd9fe254ea8d1"]],"l":false},{"id":"61843ca1684f9f9d","type":"delay","z":"94cf2ea396e5b6f6","name":"Delay","pauseType":"delay","timeout":"200","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":460,"y":80,"wires":[["bdb2c46daf62b36f"]]},{"id":"6d4704f6fc9b98be","type":"change","z":"94cf2ea396e5b6f6","name":"RESET","rules":[{"t":"set","p":"payload","pt":"msg","to":"RESET","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":120,"wires":[["bdb2c46daf62b36f"]]},{"id":"4788b5265af1d45a","type":"switch","z":"94cf2ea396e5b6f6","name":"LWT","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Online","vt":"str"},{"t":"eq","v":"Offline","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":460,"y":160,"wires":[["6d4704f6fc9b98be","bc2aabd04561d534"],["6a82c12953657965"]]},{"id":"6a82c12953657965","type":"function","z":"94cf2ea396e5b6f6","name":"BAN","func":"msg = {icon: '<font color = \"red\"><i class=\"fa fa-ban fa-3x\"></i></font>'};\nreturn msg;","outputs":1,"noerr":0,"x":460,"y":200,"wires":[["8dc8a0dd2b669ae3","704ae850657c9724"]]},{"id":"bc2aabd04561d534","type":"change","z":"94cf2ea396e5b6f6","name":"Enable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"ARLEC-1","pt":"flow","to":"ONLINE","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":160,"wires":[["66fb54e88f4acb8d"]]},{"id":"bdb2c46daf62b36f","type":"function","z":"94cf2ea396e5b6f6","name":"Set state","func":"let device = msg.topic.split(\"/\");\nnode.warn(\"Device \" + device[0]);\nnode.warn(\"Payload \" + msg.payload);\n\nif (msg.payload == \"RESET\")\n{\n let state = context.get(device[0]);\n if (state === 0)\n {\n //\n msg= {\"icon\": '<font color = \"red\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>',\"background\":\"black\"};\n return msg;\n }\n //\n}\nif (msg.payload == \"ON\")\n{\n msg = { \"icon\": '<font color = \"lime\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"background\": \"black\" };\n context.set(\"STATE\",1);\n context.set(device[0],1);\n} else\n{\n msg = { \"icon\": '<font color = \"red\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>', \"background\": \"black\" };\n context.set(\"STATE\",0);\n context.set(device[0], 1);\n}\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":660,"y":120,"wires":[["66fb54e88f4acb8d"]]},{"id":"8dc8a0dd2b669ae3","type":"change","z":"94cf2ea396e5b6f6","name":"Disable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"ARLEC-1","pt":"flow","to":"OFFLINE","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":200,"wires":[["66fb54e88f4acb8d"]]},{"id":"5b8cd9fe254ea8d1","type":"function","z":"94cf2ea396e5b6f6","name":"Button control","func":"let msg1 = {};\n\nlet x = msg.payload;\nlet counter = context.get(\"counter\") || 0;\nif (x == \"X\")\n{\n counter = (counter + 1) % 2;\n context.set(\"counter\",counter);\n if (counter === 0)\n {\n //\n msg.payload = \"OFF\";\n msg1 = {\"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>',\"background\":\"black\"};\n } else\n {\n //\n msg.payload = \"ON\";\n msg1 = {\"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>',\"backgound\":\"black\"};\n }\n}\nif (x == \"RELOAD\")\n{\n // Reload/display status.\n if (counter == 0)\n {\n // OFF\n x = \"OFF\";\n msg.payload = \"OFF\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>', \"background\": \"black\" };\n }\n else\n if (counter == 1)\n {\n // ON\n x = \"ON\";\n msg.payload = \"ON\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"backgound\": \"black\" };\n }\n}\n\n\nif (x == \"ON\")\n{\n // Force power ON\n msg.payload = \"ON\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"backgound\": \"black\" };\n context.set(\"counter\",1);\n}\nif (x == \"OFF\")\n{\n // Force power OFF\n msg.payload = \"OFF\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"backgound\": \"black\" };\n context.set(\"counter\",0);\n}\n\nreturn [msg,msg1];","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":870,"y":120,"wires":[["4f29a481b6f0d0e3","0ae8f43ccf9a1016"],["66fb54e88f4acb8d"]]},{"id":"4f29a481b6f0d0e3","type":"delay","z":"94cf2ea396e5b6f6","name":"Delay","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1080,"y":120,"wires":[["27d2dd9a875ab1a5"]]},{"id":"27d2dd9a875ab1a5","type":"change","z":"94cf2ea396e5b6f6","name":"#1","rules":[{"t":"set","p":"topic","pt":"msg","to":"DN","tot":"env"},{"t":"set","p":"topic","pt":"msg","to":"topic & '/cmnd/power' & $env(power)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":160,"wires":[[]]},{"id":"7207fbe19cc07923","type":"switch","z":"94cf2ea396e5b6f6","name":"Only for this device","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"DN","vt":"env"},{"t":"eq","v":"MASTER","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":255,"y":160,"wires":[["541720ad73579447"],["6a82c12953657965"]],"l":false},{"id":"0ae8f43ccf9a1016","type":"function","z":"94cf2ea396e5b6f6","name":"Identify","func":"let dev = env.get(\"DN\") + \" \" + env.get(\"power\");\nlet status = msg.payload;\n\nnode.status(dev + \" \" + status);","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\nnode.status(env.get(\"DN\"));\n","finalize":"","libs":[],"x":660,"y":270,"wires":[[]]},{"id":"45a85f7621f5c28f","type":"status","z":"94cf2ea396e5b6f6","name":"","scope":["0ae8f43ccf9a1016"],"x":1070,"y":270,"wires":[[]]},{"id":"704ae850657c9724","type":"change","z":"94cf2ea396e5b6f6","name":"Wipe status when unplugged","rules":[{"t":"set","p":"payload","pt":"msg","to":" ","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":425,"y":270,"wires":[["0ae8f43ccf9a1016"]],"l":false},{"id":"0cc9b2fa9b2af8df","type":"switch","z":"94cf2ea396e5b6f6","name":"Reload?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"RELOAD","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":175,"y":160,"wires":[["5b8cd9fe254ea8d1"],["7207fbe19cc07923"]],"l":false},{"id":"66fb54e88f4acb8d","type":"junction","z":"94cf2ea396e5b6f6","x":800,"y":220,"wires":[[]]},{"id":"bfdb3c588016491b","type":"link in","z":"26262ba1.62dcbc","name":"Button","links":["76117c24ef0f5cf3"],"x":1055,"y":4220,"wires":[["7ebd5a2bb58fd95c"]]},{"id":"7ebd5a2bb58fd95c","type":"junction","z":"26262ba1.62dcbc","x":1120,"y":4180,"wires":[["9508b1d704f5549d","5df6f3279accf23f"]]},{"id":"9508b1d704f5549d","type":"subflow:94cf2ea396e5b6f6","z":"26262ba1.62dcbc","name":"","env":[{"name":"DN","value":"A5","type":"str"},{"name":"power","value":"1","type":"num"},{"name":"Device name","value":"A1","type":"str"}],"x":1280,"y":4180,"wires":[["099a494a54542f2d","3b578a30c600e702"],["e87f2ab9ebfdeb7f"]]},{"id":"76117c24ef0f5cf3","type":"link out","z":"26262ba1.62dcbc","name":"Button","mode":"link","links":["bfdb3c588016491b"],"x":1645,"y":4150,"wires":[]},{"id":"e72bae9952eddd60","type":"inject","z":"26262ba1.62dcbc","name":"Button","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"A5/button","payload":"X","payloadType":"str","x":1550,"y":4110,"wires":[["76117c24ef0f5cf3"]]}]

```

---

<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: [2 February 2024 09:55 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/7 "2024-02-02T09:55:19Z")

</div>

> [@Trying\_to\_learn](#):
>
> This is with the code which causes errors on the other machine.  
> It should work, but doesn't.

As I said, you need $env('power')

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [2 February 2024 09:57 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/8 "2024-02-02T09:57:30Z")

</div>

Sorry, we caught each other's toes there.

Yeah, interesting.

The `subflow` was copied from the _working_ machine and on both the `'` are missing.

I'll add them and see what happens.

I am really not having much luck - am I? 😉

But good catch on that.  
Thanks.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [2 February 2024 10:00 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/9 "2024-02-02T10:00:21Z")

</div>

THANKS THANKS THANKS.

That seemed to do the trick.

---

<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: [2 February 2024 10:13 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/10 "2024-02-02T10:13:07Z")

</div>

Does it really work on the one machine without the quotes?

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [2 February 2024 10:13 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/11 "2024-02-02T10:13:55Z")

</div>

Yes, which is why I was so confused.

Quotes taken out, it works.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/0/30268e4d7e04e54c3287f0d5f40a30ff7e744e1d.png)

# BUT!

On the other machine, it throws the error.

---

<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: [2 February 2024 11:08 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/12 "2024-02-02T11:08:57Z")

</div>

Can you export that section of the flow please? From the ~~non-~~ working system.  
Edit, sorry, I meant the one that works but should not work because of the missing quotes.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [2 February 2024 19:38 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/13 "2024-02-02T19:38:56Z")

</div>

This is the node from the machine on which is works.

Note: The node HAS been changed IRL - this export is NOT what is now in the subflow/

```auto
[
    {
        "id": "27d2dd9a875ab1a5",
        "type": "change",
        "z": "94cf2ea396e5b6f6",
        "name": "#1",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "DN",
                "tot": "env"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "topic & '/cmnd/power' & $env(power)",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1080,
        "y": 160,
        "wires": [
            []
        ]
    }
]

```

Or did you mean the actual flow?  
Or subflow?

Ah, here is the section of the flow.

```auto
[
    {
        "id": "94cf2ea396e5b6f6",
        "type": "subflow",
        "name": "MQTT Button Toggle",
        "info": "# 2023 02 08\nAdded status text to icon to \nshow status of device.\n\n# 2023 01 25\nControl MQTT devices (power points)\nwith this node.\n\n`Button` node MUST have `topic` set to include\nthe device's name. eg: `A1/button`\nand the payload MUST be `X`\n\nSet the `Device Name` to (eg) `A1` to\ncontrol `A1` device.\n\n`payload` must be `X` to TOGGLE output\n\nsend `ON` to force ON state\n\nsend `OFF` to force OFF state\n\nsend `RELOAD` to force button to\ndisplay current state.\n(added 2024 01 28)\n\n",
        "category": "",
        "in": [
            {
                "x": 100,
                "y": 160,
                "wires": [
                    {
                        "id": "0cc9b2fa9b2af8df"
                    }
                ]
            }
        ],
        "out": [
            {
                "x": 1280,
                "y": 220,
                "wires": [
                    {
                        "id": "66fb54e88f4acb8d",
                        "port": 0
                    }
                ]
            },
            {
                "x": 1250,
                "y": 160,
                "wires": [
                    {
                        "id": "27d2dd9a875ab1a5",
                        "port": 0
                    }
                ]
            }
        ],
        "env": [
            {
                "name": "DN",
                "type": "str",
                "value": "",
                "ui": {
                    "label": {
                        "en-US": "Device Name"
                    },
                    "type": "input",
                    "opts": {
                        "types": [
                            "str"
                        ]
                    }
                }
            },
            {
                "name": "power",
                "type": "num",
                "value": "",
                "ui": {
                    "label": {
                        "en-US": "Output"
                    },
                    "type": "input",
                    "opts": {
                        "types": [
                            "num"
                        ]
                    }
                }
            }
        ],
        "meta": {},
        "color": "#DDAA99",
        "inputLabels": [
            "MQTT (tele and LWT) and button input"
        ],
        "outputLabels": [
            "Back to `button` input",
            "MQTT output"
        ],
        "status": {
            "x": 1200,
            "y": 270,
            "wires": [
                {
                    "id": "45a85f7621f5c28f",
                    "port": 0
                }
            ]
        }
    },
    {
        "id": "541720ad73579447",
        "type": "switch",
        "z": "94cf2ea396e5b6f6",
        "name": "what message?",
        "property": "topic",
        "propertyType": "msg",
        "rules": [
            {
                "t": "cont",
                "v": "/stat/POWER",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "/tele/LWT",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "button",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 3,
        "x": 315,
        "y": 160,
        "wires": [
            [
                "61843ca1684f9f9d"
            ],
            [
                "4788b5265af1d45a"
            ],
            [
                "5b8cd9fe254ea8d1"
            ]
        ],
        "l": false
    },
    {
        "id": "61843ca1684f9f9d",
        "type": "delay",
        "z": "94cf2ea396e5b6f6",
        "name": "Delay",
        "pauseType": "delay",
        "timeout": "200",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 460,
        "y": 80,
        "wires": [
            [
                "bdb2c46daf62b36f"
            ]
        ]
    },
    {
        "id": "6d4704f6fc9b98be",
        "type": "change",
        "z": "94cf2ea396e5b6f6",
        "name": "RESET",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "RESET",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 470,
        "y": 120,
        "wires": [
            [
                "bdb2c46daf62b36f"
            ]
        ]
    },
    {
        "id": "4788b5265af1d45a",
        "type": "switch",
        "z": "94cf2ea396e5b6f6",
        "name": "LWT",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "Online",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Offline",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 460,
        "y": 160,
        "wires": [
            [
                "6d4704f6fc9b98be",
                "bc2aabd04561d534"
            ],
            [
                "6a82c12953657965"
            ]
        ]
    },
    {
        "id": "6a82c12953657965",
        "type": "function",
        "z": "94cf2ea396e5b6f6",
        "name": "BAN",
        "func": "msg = {icon: '<font color = \"red\"><i class=\"fa fa-ban fa-3x\"></i></font>'};\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 460,
        "y": 200,
        "wires": [
            [
                "8dc8a0dd2b669ae3",
                "704ae850657c9724"
            ]
        ]
    },
    {
        "id": "bc2aabd04561d534",
        "type": "change",
        "z": "94cf2ea396e5b6f6",
        "name": "Enable",
        "rules": [
            {
                "t": "set",
                "p": "enabled",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            },
            {
                "t": "set",
                "p": "ARLEC-1",
                "pt": "flow",
                "to": "ONLINE",
                "tot": "str"
            },
            {
                "t": "delete",
                "p": "payload",
                "pt": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 660,
        "y": 160,
        "wires": [
            [
                "66fb54e88f4acb8d"
            ]
        ]
    },
    {
        "id": "bdb2c46daf62b36f",
        "type": "function",
        "z": "94cf2ea396e5b6f6",
        "name": "Set state",
        "func": "let device = msg.topic.split(\"/\");\nnode.warn(\"Device \" + device[0]);\nnode.warn(\"Payload \" + msg.payload);\n\nif (msg.payload == \"RESET\")\n{\n let state = context.get(device[0]);\n if (state === 0)\n {\n //\n msg= {\"icon\": '<font color = \"red\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>',\"background\":\"black\"};\n return msg;\n }\n //\n}\nif (msg.payload == \"ON\")\n{\n msg = { \"icon\": '<font color = \"lime\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"background\": \"black\" };\n context.set(\"STATE\",1);\n context.set(device[0],1);\n} else\n{\n msg = { \"icon\": '<font color = \"red\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>', \"background\": \"black\" };\n context.set(\"STATE\",0);\n context.set(device[0], 1);\n}\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 660,
        "y": 120,
        "wires": [
            [
                "66fb54e88f4acb8d"
            ]
        ]
    },
    {
        "id": "8dc8a0dd2b669ae3",
        "type": "change",
        "z": "94cf2ea396e5b6f6",
        "name": "Disable",
        "rules": [
            {
                "t": "set",
                "p": "enabled",
                "pt": "msg",
                "to": "false",
                "tot": "bool"
            },
            {
                "t": "set",
                "p": "ARLEC-1",
                "pt": "flow",
                "to": "OFFLINE",
                "tot": "str"
            },
            {
                "t": "delete",
                "p": "payload",
                "pt": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 660,
        "y": 200,
        "wires": [
            [
                "66fb54e88f4acb8d"
            ]
        ]
    },
    {
        "id": "5b8cd9fe254ea8d1",
        "type": "function",
        "z": "94cf2ea396e5b6f6",
        "name": "Button control",
        "func": "let msg1 = {};\n\nlet x = msg.payload;\nlet counter = context.get(\"counter\") || 0;\nif (x == \"X\")\n{\n counter = (counter + 1) % 2;\n context.set(\"counter\",counter);\n if (counter === 0)\n {\n //\n msg.payload = \"OFF\";\n msg1 = {\"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>',\"background\":\"black\"};\n } else\n {\n //\n msg.payload = \"ON\";\n msg1 = {\"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>',\"backgound\":\"black\"};\n }\n}\nif (x == \"RELOAD\")\n{\n // Reload/display status.\n if (counter == 0)\n {\n // OFF\n x = \"OFF\";\n msg.payload = \"OFF\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>', \"background\": \"black\" };\n }\n else\n if (counter == 1)\n {\n // ON\n x = \"ON\";\n msg.payload = \"ON\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"backgound\": \"black\" };\n }\n}\n\n\nif (x == \"ON\")\n{\n // Force power ON\n msg.payload = \"ON\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"backgound\": \"black\" };\n context.set(\"counter\",1);\n}\nif (x == \"OFF\")\n{\n // Force power OFF\n msg.payload = \"OFF\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"backgound\": \"black\" };\n context.set(\"counter\",0);\n}\n\nreturn [msg,msg1];",
        "outputs": 2,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 870,
        "y": 120,
        "wires": [
            [
                "4f29a481b6f0d0e3",
                "0ae8f43ccf9a1016"
            ],
            [
                "66fb54e88f4acb8d"
            ]
        ]
    },
    {
        "id": "4f29a481b6f0d0e3",
        "type": "delay",
        "z": "94cf2ea396e5b6f6",
        "name": "Delay",
        "pauseType": "delay",
        "timeout": "100",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "outputs": 1,
        "x": 1080,
        "y": 120,
        "wires": [
            [
                "27d2dd9a875ab1a5"
            ]
        ]
    },
    {
        "id": "27d2dd9a875ab1a5",
        "type": "change",
        "z": "94cf2ea396e5b6f6",
        "name": "#1",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "DN",
                "tot": "env"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "topic & '/cmnd/power' & $env(power)",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1080,
        "y": 160,
        "wires": [
            []
        ]
    },
    {
        "id": "7207fbe19cc07923",
        "type": "switch",
        "z": "94cf2ea396e5b6f6",
        "name": "Only for this device",
        "property": "topic",
        "propertyType": "msg",
        "rules": [
            {
                "t": "cont",
                "v": "DN",
                "vt": "env"
            },
            {
                "t": "eq",
                "v": "MASTER",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 255,
        "y": 160,
        "wires": [
            [
                "541720ad73579447"
            ],
            [
                "6a82c12953657965"
            ]
        ],
        "l": false
    },
    {
        "id": "0ae8f43ccf9a1016",
        "type": "function",
        "z": "94cf2ea396e5b6f6",
        "name": "Identify",
        "func": "let dev = env.get(\"DN\") + \" \" + env.get(\"power\");\nlet status = msg.payload;\n\nnode.status(dev + \" \" + status);",
        "outputs": 1,
        "noerr": 0,
        "initialize": "// Code added here will be run once\n// whenever the node is started.\nnode.status(env.get(\"DN\"));\n",
        "finalize": "",
        "libs": [],
        "x": 660,
        "y": 270,
        "wires": [
            []
        ]
    },
    {
        "id": "45a85f7621f5c28f",
        "type": "status",
        "z": "94cf2ea396e5b6f6",
        "name": "",
        "scope": [
            "0ae8f43ccf9a1016"
        ],
        "x": 1070,
        "y": 270,
        "wires": [
            []
        ]
    },
    {
        "id": "704ae850657c9724",
        "type": "change",
        "z": "94cf2ea396e5b6f6",
        "name": "Wipe status when unplugged",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": " ",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 425,
        "y": 270,
        "wires": [
            [
                "0ae8f43ccf9a1016"
            ]
        ],
        "l": false
    },
    {
        "id": "0cc9b2fa9b2af8df",
        "type": "switch",
        "z": "94cf2ea396e5b6f6",
        "name": "Reload?",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "RELOAD",
                "vt": "str"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 175,
        "y": 160,
        "wires": [
            [
                "5b8cd9fe254ea8d1"
            ],
            [
                "7207fbe19cc07923"
            ]
        ],
        "l": false
    },
    {
        "id": "66fb54e88f4acb8d",
        "type": "junction",
        "z": "94cf2ea396e5b6f6",
        "x": 800,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "bfdb3c588016491b",
        "type": "link in",
        "z": "26262ba1.62dcbc",
        "name": "Button",
        "links": [
            "76117c24ef0f5cf3"
        ],
        "x": 1055,
        "y": 4220,
        "wires": [
            [
                "7ebd5a2bb58fd95c"
            ]
        ]
    },
    {
        "id": "9508b1d704f5549d",
        "type": "subflow:94cf2ea396e5b6f6",
        "z": "26262ba1.62dcbc",
        "name": "",
        "env": [
            {
                "name": "DN",
                "value": "A5",
                "type": "str"
            },
            {
                "name": "power",
                "value": "1",
                "type": "num"
            },
            {
                "name": "Device name",
                "value": "A1",
                "type": "str"
            }
        ],
        "x": 1280,
        "y": 4180,
        "wires": [
            [
                "099a494a54542f2d",
                "3b578a30c600e702"
            ],
            [
                "e87f2ab9ebfdeb7f"
            ]
        ]
    },
    {
        "id": "76117c24ef0f5cf3",
        "type": "link out",
        "z": "26262ba1.62dcbc",
        "name": "Button",
        "mode": "link",
        "links": [
            "bfdb3c588016491b"
        ],
        "x": 1645,
        "y": 4150,
        "wires": []
    },
    {
        "id": "e72bae9952eddd60",
        "type": "inject",
        "z": "26262ba1.62dcbc",
        "name": "Button",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "A5/button",
        "payload": "X",
        "payloadType": "str",
        "x": 1550,
        "y": 4110,
        "wires": [
            [
                "76117c24ef0f5cf3"
            ]
        ]
    }
]

```

---

<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: [2 February 2024 21:43 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/14 "2024-02-02T21:43:55Z")

</div>

I meant export of this, from the machine without the quotes, but which works.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/8/b8f1dc4d689e68e8a2c3ef01e0cb9b6015604741.png)

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [2 February 2024 21:48 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/15 "2024-02-02T21:48:38Z")

</div>

All of it?

Ok.

Um....

Sorry, confusion setting in for me.

As is, on _machine B_ it works either way. With or without the `'` around the env name.

Also the one I am posting has the `'` around it.

Not wanting to sound difficult, but you can import the code and open/edit the subflow and remove the `'` around the env name (power) and try both on your machine.

Do I really need to post both versions (from the same machine?)

```auto
[{"id":"94cf2ea396e5b6f6","type":"subflow","name":"MQTT Button Toggle","info":"# 2023 02 08\nAdded status text to icon to \nshow status of device.\n\n# 2023 01 25\nControl MQTT devices (power points)\nwith this node.\n\n`Button` node MUST have `topic` set to include\nthe device's name. eg: `A1/button`\nand the payload MUST be `X`\n\nSet the `Device Name` to (eg) `A1` to\ncontrol `A1` device.\n\n`payload` must be `X` to TOGGLE output\n\nsend `ON` to force ON state\n\nsend `OFF` to force OFF state\n\nsend `RELOAD` to force button to\ndisplay current state.\n(added 2024 01 28)\n\n","category":"","in":[{"x":100,"y":160,"wires":[{"id":"0cc9b2fa9b2af8df"}]}],"out":[{"x":1280,"y":220,"wires":[{"id":"66fb54e88f4acb8d","port":0}]},{"x":1250,"y":160,"wires":[{"id":"27d2dd9a875ab1a5","port":0}]}],"env":[{"name":"DN","type":"str","value":"","ui":{"label":{"en-US":"Device Name"},"type":"input","opts":{"types":["str"]}}},{"name":"power","type":"num","value":"","ui":{"label":{"en-US":"Output"},"type":"input","opts":{"types":["num"]}}}],"meta":{},"color":"#DDAA99","inputLabels":["MQTT (tele and LWT) and button input"],"outputLabels":["Back to `button` input","MQTT output"],"status":{"x":1200,"y":270,"wires":[{"id":"45a85f7621f5c28f","port":0}]}},{"id":"541720ad73579447","type":"switch","z":"94cf2ea396e5b6f6","name":"what message?","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"/stat/POWER","vt":"str"},{"t":"cont","v":"/tele/LWT","vt":"str"},{"t":"cont","v":"button","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":315,"y":160,"wires":[["61843ca1684f9f9d"],["4788b5265af1d45a"],["5b8cd9fe254ea8d1"]],"l":false},{"id":"61843ca1684f9f9d","type":"delay","z":"94cf2ea396e5b6f6","name":"Delay","pauseType":"delay","timeout":"200","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":460,"y":80,"wires":[["bdb2c46daf62b36f"]]},{"id":"6d4704f6fc9b98be","type":"change","z":"94cf2ea396e5b6f6","name":"RESET","rules":[{"t":"set","p":"payload","pt":"msg","to":"RESET","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":120,"wires":[["bdb2c46daf62b36f"]]},{"id":"4788b5265af1d45a","type":"switch","z":"94cf2ea396e5b6f6","name":"LWT","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Online","vt":"str"},{"t":"eq","v":"Offline","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":460,"y":160,"wires":[["6d4704f6fc9b98be","bc2aabd04561d534"],["6a82c12953657965"]]},{"id":"6a82c12953657965","type":"function","z":"94cf2ea396e5b6f6","name":"BAN","func":"msg = {icon: '<font color = \"red\"><i class=\"fa fa-ban fa-3x\"></i></font>'};\nreturn msg;","outputs":1,"noerr":0,"x":460,"y":200,"wires":[["8dc8a0dd2b669ae3","704ae850657c9724"]]},{"id":"bc2aabd04561d534","type":"change","z":"94cf2ea396e5b6f6","name":"Enable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"ARLEC-1","pt":"flow","to":"ONLINE","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":160,"wires":[["66fb54e88f4acb8d"]]},{"id":"bdb2c46daf62b36f","type":"function","z":"94cf2ea396e5b6f6","name":"Set state","func":"let device = msg.topic.split(\"/\");\nnode.warn(\"Device \" + device[0]);\nnode.warn(\"Payload \" + msg.payload);\n\nif (msg.payload == \"RESET\")\n{\n let state = context.get(device[0]);\n if (state === 0)\n {\n //\n msg= {\"icon\": '<font color = \"red\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>',\"background\":\"black\"};\n return msg;\n }\n //\n}\nif (msg.payload == \"ON\")\n{\n msg = { \"icon\": '<font color = \"lime\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"background\": \"black\" };\n context.set(\"STATE\",1);\n context.set(device[0],1);\n} else\n{\n msg = { \"icon\": '<font color = \"red\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>', \"background\": \"black\" };\n context.set(\"STATE\",0);\n context.set(device[0], 1);\n}\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":660,"y":120,"wires":[["66fb54e88f4acb8d"]]},{"id":"8dc8a0dd2b669ae3","type":"change","z":"94cf2ea396e5b6f6","name":"Disable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"ARLEC-1","pt":"flow","to":"OFFLINE","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":200,"wires":[["66fb54e88f4acb8d"]]},{"id":"5b8cd9fe254ea8d1","type":"function","z":"94cf2ea396e5b6f6","name":"Button control","func":"let msg1 = {};\n\nlet x = msg.payload;\nlet counter = context.get(\"counter\") || 0;\nif (x == \"X\")\n{\n counter = (counter + 1) % 2;\n context.set(\"counter\",counter);\n if (counter === 0)\n {\n //\n msg.payload = \"OFF\";\n msg1 = {\"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>',\"background\":\"black\"};\n } else\n {\n //\n msg.payload = \"ON\";\n msg1 = {\"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>',\"backgound\":\"black\"};\n }\n}\nif (x == \"RELOAD\")\n{\n // Reload/display status.\n if (counter == 0)\n {\n // OFF\n x = \"OFF\";\n msg.payload = \"OFF\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>', \"background\": \"black\" };\n }\n else\n if (counter == 1)\n {\n // ON\n x = \"ON\";\n msg.payload = \"ON\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"backgound\": \"black\" };\n }\n}\n\n\nif (x == \"ON\")\n{\n // Force power ON\n msg.payload = \"ON\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"backgound\": \"black\" };\n context.set(\"counter\",1);\n}\nif (x == \"OFF\")\n{\n // Force power OFF\n msg.payload = \"OFF\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"backgound\": \"black\" };\n context.set(\"counter\",0);\n}\n\nreturn [msg,msg1];","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":870,"y":120,"wires":[["4f29a481b6f0d0e3","0ae8f43ccf9a1016"],["66fb54e88f4acb8d"]]},{"id":"4f29a481b6f0d0e3","type":"delay","z":"94cf2ea396e5b6f6","name":"Delay","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1080,"y":120,"wires":[["27d2dd9a875ab1a5"]]},{"id":"27d2dd9a875ab1a5","type":"change","z":"94cf2ea396e5b6f6","name":"#1","rules":[{"t":"set","p":"topic","pt":"msg","to":"DN","tot":"env"},{"t":"set","p":"topic","pt":"msg","to":"topic & '/cmnd/power' & $env('power')","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":160,"wires":[[]]},{"id":"7207fbe19cc07923","type":"switch","z":"94cf2ea396e5b6f6","name":"Only for this device","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"DN","vt":"env"},{"t":"eq","v":"MASTER","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":255,"y":160,"wires":[["541720ad73579447"],["6a82c12953657965"]],"l":false},{"id":"0ae8f43ccf9a1016","type":"function","z":"94cf2ea396e5b6f6","name":"Identify","func":"let dev = env.get(\"DN\") + \" \" + env.get(\"power\");\nlet status = msg.payload;\n\nnode.status(dev + \" \" + status);","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\nnode.status(env.get(\"DN\"));\n","finalize":"","libs":[],"x":660,"y":270,"wires":[[]]},{"id":"45a85f7621f5c28f","type":"status","z":"94cf2ea396e5b6f6","name":"","scope":["0ae8f43ccf9a1016"],"x":1070,"y":270,"wires":[[]]},{"id":"704ae850657c9724","type":"change","z":"94cf2ea396e5b6f6","name":"Wipe status when unplugged","rules":[{"t":"set","p":"payload","pt":"msg","to":" ","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":425,"y":270,"wires":[["0ae8f43ccf9a1016"]],"l":false},{"id":"0cc9b2fa9b2af8df","type":"switch","z":"94cf2ea396e5b6f6","name":"Reload?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"RELOAD","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":175,"y":160,"wires":[["5b8cd9fe254ea8d1"],["7207fbe19cc07923"]],"l":false},{"id":"66fb54e88f4acb8d","type":"junction","z":"94cf2ea396e5b6f6","x":800,"y":220,"wires":[[]]},{"id":"9508b1d704f5549d","type":"subflow:94cf2ea396e5b6f6","z":"26262ba1.62dcbc","name":"","env":[{"name":"DN","value":"A5","type":"str"},{"name":"power","value":"1","type":"num"},{"name":"Device name","value":"A1","type":"str"}],"x":1280,"y":4180,"wires":[["099a494a54542f2d","3b578a30c600e702"],["e87f2ab9ebfdeb7f"]]},{"id":"7ebd5a2bb58fd95c","type":"junction","z":"26262ba1.62dcbc","x":1120,"y":4180,"wires":[["9508b1d704f5549d","5df6f3279accf23f"]]},{"id":"099a494a54542f2d","type":"ui_button","z":"26262ba1.62dcbc","name":"A5","group":"5dde4bf66eb38aa1","order":0,"width":"1","height":"1","passthru":false,"label":"{{msg.icon}}","tooltip":"","color":"","bgcolor":"{{msg.background}}","className":"","icon":"","payload":"X","payloadType":"str","topic":"A5/button","topicType":"str","x":1550,"y":4150,"wires":[["76117c24ef0f5cf3"]]},{"id":"3b578a30c600e702","type":"debug","z":"26262ba1.62dcbc","name":"To button","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1560,"y":4070,"wires":[]},{"id":"e87f2ab9ebfdeb7f","type":"mqtt out","z":"26262ba1.62dcbc","name":"","topic":"","qos":"0","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"378c0403.8cda04","x":1550,"y":4200,"wires":[]},{"id":"711c549e46cbf75d","type":"mqtt in","z":"26262ba1.62dcbc","name":"","topic":"A5/tele/LWT","qos":"2","datatype":"auto","broker":"378c0403.8cda04","nl":false,"rap":false,"inputs":0,"x":1000,"y":4180,"wires":[["7ebd5a2bb58fd95c"]],"info":"Needs editing if used for another device"},{"id":"39df276d4a56640f","type":"mqtt in","z":"26262ba1.62dcbc","name":"","topic":"A5/stat/POWER","qos":"2","datatype":"auto","broker":"378c0403.8cda04","nl":false,"rap":false,"inputs":0,"x":990,"y":4130,"wires":[["7ebd5a2bb58fd95c"]]},{"id":"bfdb3c588016491b","type":"link in","z":"26262ba1.62dcbc","name":"Button","links":["76117c24ef0f5cf3"],"x":1055,"y":4220,"wires":[["7ebd5a2bb58fd95c"]]},{"id":"8e225fcb5089da4c","type":"inject","z":"26262ba1.62dcbc","name":"Offline","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"A5/tele/LWT","payload":"Offline","payloadType":"str","x":1020,"y":4260,"wires":[["7ebd5a2bb58fd95c"]]},{"id":"5b0a3e68c203869e","type":"inject","z":"26262ba1.62dcbc","name":"Online","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"A5/tele/LWT","payload":"Online","payloadType":"str","x":1020,"y":4300,"wires":[["7ebd5a2bb58fd95c"]]},{"id":"5df6f3279accf23f","type":"debug","z":"26262ba1.62dcbc","name":"Going IN","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1220,"y":4080,"wires":[]},{"id":"76117c24ef0f5cf3","type":"link out","z":"26262ba1.62dcbc","name":"Button","mode":"link","links":["bfdb3c588016491b"],"x":1645,"y":4150,"wires":[]},{"id":"e72bae9952eddd60","type":"inject","z":"26262ba1.62dcbc","name":"Button","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"A5/button","payload":"X","payloadType":"str","x":1550,"y":4110,"wires":[["76117c24ef0f5cf3"]]},{"id":"5dde4bf66eb38aa1","type":"ui_group","name":"A(1-4) Sockets","tab":"aa487daa.33c1c","order":9,"disp":true,"width":"4","collapse":false,"className":""},{"id":"378c0403.8cda04","type":"mqtt-broker","name":"TIMEPI MQTT","broker":"192.168.17.39","port":"1883","clientid":"","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"true","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""},{"id":"aa487daa.33c1c","type":"ui_tab","name":"Real_World_Control","icon":"dashboard","order":3,"disabled":false,"hidden":false}]

```

Yes, it would be nice to understand what is going on.  
Why both machines are running the same NR version, same Node version and have the same `change node` version.

(One is a RasPi one is a NUC)

As it is a SUBFLOW, I can't really have BOTH versions loaded at the same time. (easily)

---

<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: [2 February 2024 21:52 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/16 "2024-02-02T21:52:37Z")

</div>

I would like you to take the quotes out, restart node-red, check it still works, and export that please. I want to know for certain that I am looking at a valid flow.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [2 February 2024 21:53 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/17 "2024-02-02T21:53:08Z")

</div>

Yeah, ok. That's do-able.

BRB.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [2 February 2024 21:58 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/18 "2024-02-02T21:58:37Z")

</div>

WITHOUT the `'` around the env name.

NR restarted and message working.

```auto
[{"id":"94cf2ea396e5b6f6","type":"subflow","name":"MQTT Button Toggle","info":"# 2023 02 08\nAdded status text to icon to \nshow status of device.\n\n# 2023 01 25\nControl MQTT devices (power points)\nwith this node.\n\n`Button` node MUST have `topic` set to include\nthe device's name. eg: `A1/button`\nand the payload MUST be `X`\n\nSet the `Device Name` to (eg) `A1` to\ncontrol `A1` device.\n\n`payload` must be `X` to TOGGLE output\n\nsend `ON` to force ON state\n\nsend `OFF` to force OFF state\n\nsend `RELOAD` to force button to\ndisplay current state.\n(added 2024 01 28)\n\n","category":"","in":[{"x":100,"y":160,"wires":[{"id":"0cc9b2fa9b2af8df"}]}],"out":[{"x":1280,"y":220,"wires":[{"id":"66fb54e88f4acb8d","port":0}]},{"x":1250,"y":160,"wires":[{"id":"27d2dd9a875ab1a5","port":0}]}],"env":[{"name":"DN","type":"str","value":"","ui":{"label":{"en-US":"Device Name"},"type":"input","opts":{"types":["str"]}}},{"name":"power","type":"num","value":"","ui":{"label":{"en-US":"Output"},"type":"input","opts":{"types":["num"]}}}],"meta":{},"color":"#DDAA99","inputLabels":["MQTT (tele and LWT) and button input"],"outputLabels":["Back to `button` input","MQTT output"],"status":{"x":1200,"y":270,"wires":[{"id":"45a85f7621f5c28f","port":0}]}},{"id":"541720ad73579447","type":"switch","z":"94cf2ea396e5b6f6","name":"what message?","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"/stat/POWER","vt":"str"},{"t":"cont","v":"/tele/LWT","vt":"str"},{"t":"cont","v":"button","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":315,"y":160,"wires":[["61843ca1684f9f9d"],["4788b5265af1d45a"],["5b8cd9fe254ea8d1"]],"l":false},{"id":"61843ca1684f9f9d","type":"delay","z":"94cf2ea396e5b6f6","name":"Delay","pauseType":"delay","timeout":"200","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":460,"y":80,"wires":[["bdb2c46daf62b36f"]]},{"id":"6d4704f6fc9b98be","type":"change","z":"94cf2ea396e5b6f6","name":"RESET","rules":[{"t":"set","p":"payload","pt":"msg","to":"RESET","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":120,"wires":[["bdb2c46daf62b36f"]]},{"id":"4788b5265af1d45a","type":"switch","z":"94cf2ea396e5b6f6","name":"LWT","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Online","vt":"str"},{"t":"eq","v":"Offline","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":460,"y":160,"wires":[["6d4704f6fc9b98be","bc2aabd04561d534"],["6a82c12953657965"]]},{"id":"6a82c12953657965","type":"function","z":"94cf2ea396e5b6f6","name":"BAN","func":"msg = {icon: '<font color = \"red\"><i class=\"fa fa-ban fa-3x\"></i></font>'};\nreturn msg;","outputs":1,"noerr":0,"x":460,"y":200,"wires":[["8dc8a0dd2b669ae3","704ae850657c9724"]]},{"id":"bc2aabd04561d534","type":"change","z":"94cf2ea396e5b6f6","name":"Enable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"ARLEC-1","pt":"flow","to":"ONLINE","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":160,"wires":[["66fb54e88f4acb8d"]]},{"id":"bdb2c46daf62b36f","type":"function","z":"94cf2ea396e5b6f6","name":"Set state","func":"let device = msg.topic.split(\"/\");\nnode.warn(\"Device \" + device[0]);\nnode.warn(\"Payload \" + msg.payload);\n\nif (msg.payload == \"RESET\")\n{\n let state = context.get(device[0]);\n if (state === 0)\n {\n //\n msg= {\"icon\": '<font color = \"red\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>',\"background\":\"black\"};\n return msg;\n }\n //\n}\nif (msg.payload == \"ON\")\n{\n msg = { \"icon\": '<font color = \"lime\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"background\": \"black\" };\n context.set(\"STATE\",1);\n context.set(device[0],1);\n} else\n{\n msg = { \"icon\": '<font color = \"red\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>', \"background\": \"black\" };\n context.set(\"STATE\",0);\n context.set(device[0], 1);\n}\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":660,"y":120,"wires":[["66fb54e88f4acb8d"]]},{"id":"8dc8a0dd2b669ae3","type":"change","z":"94cf2ea396e5b6f6","name":"Disable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"ARLEC-1","pt":"flow","to":"OFFLINE","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":200,"wires":[["66fb54e88f4acb8d"]]},{"id":"5b8cd9fe254ea8d1","type":"function","z":"94cf2ea396e5b6f6","name":"Button control","func":"let msg1 = {};\n\nlet x = msg.payload;\nlet counter = context.get(\"counter\") || 0;\nif (x == \"X\")\n{\n counter = (counter + 1) % 2;\n context.set(\"counter\",counter);\n if (counter === 0)\n {\n //\n msg.payload = \"OFF\";\n msg1 = {\"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>',\"background\":\"black\"};\n } else\n {\n //\n msg.payload = \"ON\";\n msg1 = {\"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>',\"backgound\":\"black\"};\n }\n}\nif (x == \"RELOAD\")\n{\n // Reload/display status.\n if (counter == 0)\n {\n // OFF\n x = \"OFF\";\n msg.payload = \"OFF\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-270 fa-3x\"></i></font>', \"background\": \"black\" };\n }\n else\n if (counter == 1)\n {\n // ON\n x = \"ON\";\n msg.payload = \"ON\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"backgound\": \"black\" };\n }\n}\n\n\nif (x == \"ON\")\n{\n // Force power ON\n msg.payload = \"ON\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"backgound\": \"black\" };\n context.set(\"counter\",1);\n}\nif (x == \"OFF\")\n{\n // Force power OFF\n msg.payload = \"OFF\";\n msg1 = { \"icon\": '<font color = \"orangered\"><i class=\"fa fa-toggle-on fa-rotate-90 fa-3x\"></i></font>', \"backgound\": \"black\" };\n context.set(\"counter\",0);\n}\n\nreturn [msg,msg1];","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":870,"y":120,"wires":[["4f29a481b6f0d0e3","0ae8f43ccf9a1016"],["66fb54e88f4acb8d"]]},{"id":"4f29a481b6f0d0e3","type":"delay","z":"94cf2ea396e5b6f6","name":"Delay","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1080,"y":120,"wires":[["27d2dd9a875ab1a5"]]},{"id":"27d2dd9a875ab1a5","type":"change","z":"94cf2ea396e5b6f6","name":"#1","rules":[{"t":"set","p":"topic","pt":"msg","to":"DN","tot":"env"},{"t":"set","p":"topic","pt":"msg","to":"topic & '/cmnd/power' & $env(power)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":160,"wires":[[]]},{"id":"7207fbe19cc07923","type":"switch","z":"94cf2ea396e5b6f6","name":"Only for this device","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"DN","vt":"env"},{"t":"eq","v":"MASTER","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":255,"y":160,"wires":[["541720ad73579447"],["6a82c12953657965"]],"l":false},{"id":"0ae8f43ccf9a1016","type":"function","z":"94cf2ea396e5b6f6","name":"Identify","func":"let dev = env.get(\"DN\") + \" \" + env.get(\"power\");\nlet status = msg.payload;\n\nnode.status(dev + \" \" + status);","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\nnode.status(env.get(\"DN\"));\n","finalize":"","libs":[],"x":660,"y":270,"wires":[[]]},{"id":"45a85f7621f5c28f","type":"status","z":"94cf2ea396e5b6f6","name":"","scope":["0ae8f43ccf9a1016"],"x":1070,"y":270,"wires":[[]]},{"id":"704ae850657c9724","type":"change","z":"94cf2ea396e5b6f6","name":"Wipe status when unplugged","rules":[{"t":"set","p":"payload","pt":"msg","to":" ","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":425,"y":270,"wires":[["0ae8f43ccf9a1016"]],"l":false},{"id":"0cc9b2fa9b2af8df","type":"switch","z":"94cf2ea396e5b6f6","name":"Reload?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"RELOAD","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":175,"y":160,"wires":[["5b8cd9fe254ea8d1"],["7207fbe19cc07923"]],"l":false},{"id":"66fb54e88f4acb8d","type":"junction","z":"94cf2ea396e5b6f6","x":800,"y":220,"wires":[[]]},{"id":"9508b1d704f5549d","type":"subflow:94cf2ea396e5b6f6","z":"26262ba1.62dcbc","name":"","env":[{"name":"DN","value":"A5","type":"str"},{"name":"power","value":"1","type":"num"},{"name":"Device name","value":"A1","type":"str"}],"x":1280,"y":4180,"wires":[["099a494a54542f2d","3b578a30c600e702"],["e87f2ab9ebfdeb7f"]]},{"id":"7ebd5a2bb58fd95c","type":"junction","z":"26262ba1.62dcbc","x":1120,"y":4180,"wires":[["9508b1d704f5549d","5df6f3279accf23f"]]},{"id":"099a494a54542f2d","type":"ui_button","z":"26262ba1.62dcbc","name":"A5","group":"5dde4bf66eb38aa1","order":0,"width":"1","height":"1","passthru":false,"label":"{{msg.icon}}","tooltip":"","color":"","bgcolor":"{{msg.background}}","className":"","icon":"","payload":"X","payloadType":"str","topic":"A5/button","topicType":"str","x":1550,"y":4150,"wires":[["76117c24ef0f5cf3"]]},{"id":"3b578a30c600e702","type":"debug","z":"26262ba1.62dcbc","name":"To button","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1560,"y":4070,"wires":[]},{"id":"e87f2ab9ebfdeb7f","type":"mqtt out","z":"26262ba1.62dcbc","name":"","topic":"","qos":"0","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"378c0403.8cda04","x":1550,"y":4200,"wires":[]},{"id":"711c549e46cbf75d","type":"mqtt in","z":"26262ba1.62dcbc","name":"","topic":"A5/tele/LWT","qos":"2","datatype":"auto","broker":"378c0403.8cda04","nl":false,"rap":false,"inputs":0,"x":1000,"y":4180,"wires":[["7ebd5a2bb58fd95c"]],"info":"Needs editing if used for another device"},{"id":"39df276d4a56640f","type":"mqtt in","z":"26262ba1.62dcbc","name":"","topic":"A5/stat/POWER","qos":"2","datatype":"auto","broker":"378c0403.8cda04","nl":false,"rap":false,"inputs":0,"x":990,"y":4130,"wires":[["7ebd5a2bb58fd95c"]]},{"id":"bfdb3c588016491b","type":"link in","z":"26262ba1.62dcbc","name":"Button","links":["76117c24ef0f5cf3"],"x":1055,"y":4220,"wires":[["7ebd5a2bb58fd95c"]]},{"id":"8e225fcb5089da4c","type":"inject","z":"26262ba1.62dcbc","name":"Offline","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"A5/tele/LWT","payload":"Offline","payloadType":"str","x":1020,"y":4260,"wires":[["7ebd5a2bb58fd95c"]]},{"id":"5b0a3e68c203869e","type":"inject","z":"26262ba1.62dcbc","name":"Online","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"A5/tele/LWT","payload":"Online","payloadType":"str","x":1020,"y":4300,"wires":[["7ebd5a2bb58fd95c"]]},{"id":"5df6f3279accf23f","type":"debug","z":"26262ba1.62dcbc","name":"Going IN","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1220,"y":4080,"wires":[]},{"id":"76117c24ef0f5cf3","type":"link out","z":"26262ba1.62dcbc","name":"Button","mode":"link","links":["bfdb3c588016491b"],"x":1645,"y":4150,"wires":[]},{"id":"e72bae9952eddd60","type":"inject","z":"26262ba1.62dcbc","name":"Button","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"A5/button","payload":"X","payloadType":"str","x":1550,"y":4110,"wires":[["76117c24ef0f5cf3"]]},{"id":"5dde4bf66eb38aa1","type":"ui_group","name":"A(1-4) Sockets","tab":"aa487daa.33c1c","order":9,"disp":true,"width":"4","collapse":false,"className":""},{"id":"378c0403.8cda04","type":"mqtt-broker","name":"TIMEPI MQTT","broker":"192.168.17.39","port":"1883","clientid":"","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"true","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""},{"id":"aa487daa.33c1c","type":"ui_tab","name":"Real_World_Control","icon":"dashboard","order":3,"disabled":false,"hidden":false}]

```

 ![Screenshot from 2024-02-03 08-54-41](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/3/4322f8e53a49182aa394617bd00580e38d61d298.png)

And to be clear: This machine works with or without the `'`.

(I'll go to the other machine and show you what happens without the `'` in the subflow.)  
That will be another reply giving you time to look at what is so far.

---

<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: [2 February 2024 22:02 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/19 "2024-02-02T22:02:32Z")

</div>

> [@Trying\_to\_learn](#):
>
> (I'll go to the other machine and show you what happens without the `'` in the subflow.

No need for that.

---

<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: [2 February 2024 22:03 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/20 "2024-02-02T22:03:38Z")

</div>

What happens if you click the Inject node called Button?

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [2 February 2024 22:04 UTC](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140/21 "2024-02-02T22:04:06Z")

</div>

That's what I am doing at this stage.

Keep things in/on the EDIT screen.

Sorry the pictures/screengrab didn't quite clearly show that.

# My bad.

Sorry.

[Next page](https://discourse.nodered.org/t/same-subflow-different-happening-on-different-machines/85140.md?page=2)
