I'm working on some 'functions' that I can us to keep the states (JSON) of various HA devices but I'd like to keep these as functions instead of a REST flow. Is there a way to create functions that can be use in other flows?
Maybe you need to look at/into subflows.
+1 for Andrew here - plus there is also the link nodes that have been created that seem to offer an alternative to subflows (i think from NR 2.2 onwards)
There is also this that someone posted about a couple of weeks ago that i mean to try and put some time towards as it looks interesting
and then finally
Which i started playng with last year and ran out of time and motivation to move anything meaningful to it
Both are interesting, the first is most interesting.
I'm still looking at the two nodes above and trying to see if sub-flow is appropriate (I generally keep my special automation in distinct tabs). But it dawned on me that I can store a json object in the global context and add protoypes there. Still needs a lot of work. And I am looking to building a REST like interface to Mongodb (I'm not using Atlas) for other reasons. So lots of thinking and experimenting to do.
Isn't the whole purpose of HA that it is a state machine ?
The "link call" node is (pretty much) designed for this purpose.
A subflow is great and all but if you dont want or need the complications of internal state & context or trying to access upper level flow context etc, then try with link call nodes first.
Think of them as subroutines where you call to a common function (sending in some parameters AKA stuff in the msg) then you get a computed response (with properties of the msg updated from your linked flow)
Actually yes, we need to know the current state to make decisions.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.