Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State not persisted on deployment #13

Open
Stadicus opened this issue Aug 16, 2023 · 1 comment
Open

State not persisted on deployment #13

Stadicus opened this issue Aug 16, 2023 · 1 comment

Comments

@Stadicus
Copy link

Stadicus commented Aug 16, 2023

I use Node Red as part of Home Assistant. The node-red-contrib-persistent-fsm is amazing! It helps control many things like blinds and lights with very few buttons, as it keeps track of the state and can act intelligently with the next press on the same button.

This worked great until about two weeks ago. Suddenly, things started to act weird. For example, blinds started going into the open position in the morning. There was no change in the Node-Red flows at that time. I updated a few things (Home Assistant and Node Red itself), but I'm not sure how closely related that is.

I attach a quick screencast to demonstrate:

  • The state machine has two states: open / closed
  • The states are toggled on input
  • The option "Persist state on re-deploy" is enabled
  • On deploy, the state machine always returns to the initial "closed" state
state-machine-screencast.mp4

This is the flow export from this example:

[{"id":"bb4fd94092510052","type":"tab","label":"State Machine not persistent","disabled":false,"info":"","env":[]},{"id":"cbb840864cfb0a79","type":"inject","z":"bb4fd94092510052","name":"m","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"toggle","payloadType":"str","x":130,"y":120,"wires":[["1b3e44b669aa1d14"]]},{"id":"1b3e44b669aa1d14","type":"state-machine","z":"bb4fd94092510052","name":"Blinds","triggerProperty":"payload","triggerPropertyType":"msg","stateProperty":"payload","statePropertyType":"msg","initialDelay":"","persistOnReload":true,"outputStateChangeOnly":true,"throwException":false,"states":["closed","open"],"transitions":[{"name":"toggle","from":"closed","to":"open"},{"name":"toggle","from":"open","to":"closed"}],"x":290,"y":140,"wires":[["657d41f0b789875e"]]},{"id":"657d41f0b789875e","type":"switch","z":"bb4fd94092510052","name":"Action OPEN / CLOSE","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"OPEN","vt":"str"},{"t":"eq","v":"CLOSE","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":480,"y":140,"wires":[["1ffbcc68a82b3c6d"],["030ab2f9181a1911"]]},{"id":"1ffbcc68a82b3c6d","type":"api-call-service","z":"bb4fd94092510052","d":true,"name":"Blinds OPEN","server":"f915e846.bc0e18","version":5,"debugenabled":false,"domain":"cover","service":"set_cover_position","areaId":[],"deviceId":[],"entityId":["cover.markise_terrasse_alle"],"data":"{ \"position\": 25 }","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":750,"y":120,"wires":[[]]},{"id":"030ab2f9181a1911","type":"api-call-service","z":"bb4fd94092510052","d":true,"name":"Blinds CLOSE","server":"f915e846.bc0e18","version":5,"debugenabled":false,"domain":"cover","service":"set_cover_position","areaId":[],"deviceId":[],"entityId":["cover.markise_terrasse_alle"],"data":"{ \"position\": 100 }","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":760,"y":180,"wires":[[]]},{"id":"f915e846.bc0e18","type":"server","name":"Home Assistant","addon":true}]

I'm not quite sure where to start debugging. Maybe I'm doing something wrong? Maybe the Node Red update broke something? Maybe the underlying data storage is no longer working?

Any help would be greatly appreciated.

@Stadicus Stadicus changed the title State not persited on deployment State not persisted on deployment Aug 16, 2023
@ximon
Copy link

ximon commented Jan 11, 2024

I've just encountered this myself and found that persisting context to the filesystem makes this work as expected.
I added the config from the 'Saving context data to the file-system' section on this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants