lutzer / node-red-contrib-finite-statemachine

A finite state machine implementation for node red.
MIT License
16 stars 5 forks source link

FSM does not emit state data on SYNC control message #22

Closed TheOriginalMrWolf closed 2 years ago

TheOriginalMrWolf commented 3 years ago

Hi,

First, thank you so much for implementing the extra (sync & query) control capabilities -- makes this a super-useful little package!!

One small issue -- when using SYNC control, the response message contains status, but no data, whereas a state change or query control do. This is causing some uneccesary complications to deal with.

It would be absolutely fabulous if SYNC could also emit the associated state data please.

Do you think that would be possible?

Thanks again!

lutzer commented 2 years ago

Hey, Sorry for taking so long, but i was just looking into it. Could you give me an example? For me there is no problem with sending the data object.

TheOriginalMrWolf commented 2 years ago

Hey, not a problem @lutzer! Hope you had a good Christmas & Happy New Year :)

I just realised that, in the end, it was a problem with my understanding.

I wrongly expected that when SYNCing to a state, that FSM would emit data associated with achieving that state. But, of course, that's not how it works - FSM emits data on transitioning state (related to the type of transition), not reaching a state.

Once I realised that & simply attached the required data to the SYNC message payload, all was good.

Thank you.