# State machine changes from "I/O to I" upon pressing "done"

**URL:** https://discourse.nodered.org/t/state-machine-changes-from-i-o-to-i-upon-pressing-done/86426
**Category:** Dashboard
**Created:** [14 March 2024 12:39 UTC](https://discourse.nodered.org/t/state-machine-changes-from-i-o-to-i-upon-pressing-done/86426 "2024-03-14T12:39:20Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![SupportStation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/supportstation/32/89280_2.png) [@SupportStation](https://discourse.nodered.org/u/SupportStation)
#### Post date: [14 March 2024 12:39 UTC](https://discourse.nodered.org/t/state-machine-changes-from-i-o-to-i-upon-pressing-done/86426/1 "2024-03-14T12:39:20Z")

</div>

Hey all, I am having some trouble with the state machines. I am curious if this is something that I am doing, or if it is a bug. Here is the state machine node. I have modified the node red settings to allow for persistent variable storage. That is a crucial part of my flows, because I cannot lose the state upon redeploy.

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

Anyways, the rest of the flow is trivial. It's a switch that changes the variable used within the state machine. So getting to the issue at hand, when I click on the state machine node and go into the "edit" mode. Upon pressing "done", the state machine node changes. The output square goes away upon pressing this and will persist through redeploys. However, once I refresh the page it comes back, which has me very confused on what is going on with this node.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/6/3697b509908edaf130939dce46b62a52c20e1c2e.png)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [14 March 2024 13:35 UTC](https://discourse.nodered.org/t/state-machine-changes-from-i-o-to-i-upon-pressing-done/86426/2 "2024-03-14T13:35:04Z")

</div>

Welcome to the forum @SupportStation

Which state machine node are you using? Possibly node-red-contrib-something.

> [@SupportStation](#):
>
> . Upon pressing "done", the state machine node changes. The output square goes away upon pressing this and will persist through redeploys. However, once I refresh the page it comes back

What do you mean by 'output square'?  
Can you create a simple flow just using inject nodes and state machine node to show the problem? If so then export that and paste it here.

See this post for how to post a flow - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<div class="post-metadata">

### Author: ![SupportStation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/supportstation/32/89280_2.png) [@SupportStation](https://discourse.nodered.org/u/SupportStation)
#### Post date: [18 March 2024 12:32 UTC](https://discourse.nodered.org/t/state-machine-changes-from-i-o-to-i-upon-pressing-done/86426/3 "2024-03-18T12:32:56Z")

</div>

Colin,

By output square I mean the box in which you can link to other nodes. Upon pressing "done" it is no longer outputting. Here is a copy of a mockup flow.

[{"id":"e9ddac5a2b2b3066","type":"tab","label":"Flow 1","disabled":false,"info":"","env":},{"id":"01d271721edd47f2","type":"ha-switch","z":"e9ddac5a2b2b3066","name":"","version":0,"debugenabled":false,"inputs":0,"outputs":2,"entityConfig":"","enableInput":false,"outputOnStateChange":false,"outputProperties":[{"property":"outputType","propertyType":"msg","value":"state change","valueType":"str"},{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"x":290,"y":320,"wires":[["f5da37bb74cbf3e4"],["43f3fd06928fd495"]]},{"id":"f5da37bb74cbf3e4","type":"change","z":"e9ddac5a2b2b3066","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":260,"wires":[["40851d3422ca7013"]]},{"id":"43f3fd06928fd495","type":"change","z":"e9ddac5a2b2b3066","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":360,"wires":[["40851d3422ca7013"]]},{"id":"40851d3422ca7013","type":"state-machine","z":"e9ddac5a2b2b3066","name":"","triggerProperty":"status","triggerPropertyType":"flow","stateProperty":"status","statePropertyType":"flow","initialDelay":"0","persistOnReload":true,"outputStateChangeOnly":false,"throwException":false,"states":["start"],"transitions":,"x":740,"y":300,"wires":}]

---

<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: [18 March 2024 12:57 UTC](https://discourse.nodered.org/t/state-machine-changes-from-i-o-to-i-upon-pressing-done/86426/4 "2024-03-18T12:57:40Z")

</div>

You didn't do this:

> [@Colin](#):
>
> See this post for how to post a flow - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

Consequently some of your code gets rendered as squares  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/2/b2d327f98e073239a4cdbd5920f92bc12b183526.png)  
People trying to help could laboriously search for these places in your code, or you could make it easier by putting a line containing three back ticks before and after your block of code. Like this  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/e/8e4b94ff92448bfdf1863c2b533162aec0c7a88d.png)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [18 March 2024 16:09 UTC](https://discourse.nodered.org/t/state-machine-changes-from-i-o-to-i-upon-pressing-done/86426/5 "2024-03-18T16:09:27Z")

</div>

You did not answer this question

> [@Colin](#):
>
> Which state machine node are you using? Possibly node-red-contrib-something

---

<div class="post-metadata">

### Author: ![SupportStation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/supportstation/32/89280_2.png) [@SupportStation](https://discourse.nodered.org/u/SupportStation)
#### Post date: [18 March 2024 19:23 UTC](https://discourse.nodered.org/t/state-machine-changes-from-i-o-to-i-upon-pressing-done/86426/6 "2024-03-18T19:23:45Z")

</div>

Apologies,

The state machine is from node-red-contrib-persistent-fsm.

I have downloaded the code and will try to format it this time.

```auto
[
    {
        "id": "e9ddac5a2b2b3066",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "01d271721edd47f2",
        "type": "ha-switch",
        "z": "e9ddac5a2b2b3066",
        "name": "",
        "version": 0,
        "debugenabled": false,
        "inputs": 0,
        "outputs": 2,
        "entityConfig": "",
        "enableInput": false,
        "outputOnStateChange": false,
        "outputProperties": [
            {
                "property": "outputType",
                "propertyType": "msg",
                "value": "state change",
                "valueType": "str"
            },
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            }
        ],
        "x": 290,
        "y": 320,
        "wires": [
            [
                "f5da37bb74cbf3e4"
            ],
            [
                "43f3fd06928fd495"
            ]
        ]
    },
    {
        "id": "f5da37bb74cbf3e4",
        "type": "change",
        "z": "e9ddac5a2b2b3066",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 470,
        "y": 260,
        "wires": [
            [
                "40851d3422ca7013"
            ]
        ]
    },
    {
        "id": "43f3fd06928fd495",
        "type": "change",
        "z": "e9ddac5a2b2b3066",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 470,
        "y": 360,
        "wires": [
            [
                "40851d3422ca7013"
            ]
        ]
    },
    {
        "id": "40851d3422ca7013",
        "type": "state-machine",
        "z": "e9ddac5a2b2b3066",
        "name": "",
        "triggerProperty": "status",
        "triggerPropertyType": "flow",
        "stateProperty": "status",
        "statePropertyType": "flow",
        "initialDelay": "0",
        "persistOnReload": true,
        "outputStateChangeOnly": false,
        "throwException": false,
        "states": [
            "start"
        ],
        "transitions": [],
        "x": 740,
        "y": 300,
        "wires": [
            []
        ]
    }
]

```

---

<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: [17 April 2024 19:24 UTC](https://discourse.nodered.org/t/state-machine-changes-from-i-o-to-i-upon-pressing-done/86426/7 "2024-04-17T19:24:33Z")

</div>

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