I have been using the fibaro-devices contrib to integrate my Fibaro Home Centre 2 to Node-RED.
Until recently it has worked flawlessly, however I hit a critical point of "device" nodes where not all of the nodes are picking up the correct value on initialisation.
I know very little about this. The author of the contrib is @10der.
We and another forum member from the Fibaro forum, have been chatting about this issue and he has explained to me that when node-red initialises there is functionality that is built into Node-RED that allows you to run code for each and every node on your canvas. @10der has written his code such that each individual node requests it's value via the Fibaro API on initialisation.
Seems like a pretty neat idea and it has been working great until recently.
We have tried a few angles to figure out why devices are not updating their values past a certain count of nodes on canvases, but have failed.
Through discussions we have agreed a workaround, but it's probably not as elegant as the original solution. On initialization the home-centre node now requests the complete devices API from Fibaro. We have tested this concept tonight, and it from initial testing it works.
The workaround will use this API fetched JSON dataset to update ALL the device nodes on all canvases, however this solution does introduce an edge case where the time it takes to call the API and update an individual node may be preceded by an device update naturally passing through for a newer value, however this newer value will be overwritten by the ALL devices API call.
If this is even allowed, it is not a desirable outcome, so to the question:
Can you think of anything in the way that Node-RED is designed that would stop the initialisation code running through to completion e.g. a built-in timeout?