hufftheweevil / node-red-contrib-persistent-fsm

A Node Red node that wraps around Javascript State Machine
Other
4 stars 7 forks source link

State machine sending message on flow deploy #6

Closed outlying closed 2 years ago

outlying commented 2 years ago

Node Red 2.1.4 node-red-contrib-persistent-fsm 1.1.0

I'm using Node-Red via Home Assistant integration (10.3.0) on Raspberry Pi 3

I did some upgrades and one of my flows started sending notifications whenever I deployed any other flow (fully or partially), after some careful investigation I realized that the state machine started sending messages, I managed to recreate a very simple variant of my flow to present problem:

image

I use the Output Only On State Change option but my initial state is sent now, this is something that did not happen before upgrading.

I consider it a regression, if the output is only allowed on state change then sending the initial state would suggest that we switched state to initial from something else which is incorrect.

For those looking for a quick and dirty fix, you can add change node before state machine and add some constant value at the random, unused, field, then you can filter all messages after state machine, those without this field are not allowed to go futher - this way you only process the messages that triggered state machine in such case.

hufftheweevil commented 2 years ago

The node help shows the following for the Initial Delay property:

The machine will output a message once on deployment. Sometimes it is necessary to delay this initial message. Use 0 to cause immediate output on deploy. Leave blank to disable immediate output on deploy.

image