I'd like your thoughts on this. In the flow below, opening my closet door (C-CD) or detecting motion in the closet (M-C) sets the dimmer (CL) to a specified value.
C-CD and M-C are paired to my Xiaomi Hubitat (connected to a wireless mesh-point). This is also the Hubitat that I'm running Maker API (for Node-RED) on.
CL is a z-wave+ dimmer paired to my other Hubitat.
The Odroid XU4 is on my main switch (so wireless connection to Maker API).
Here are the Hubitat logs:
C-CD shows as open at 12:52:02.725
CL was set to 100 at 12:52:04.369 (so ~1.6 seconds later; that's a noticeable delay).
The load average on the Odroid is around 0.2 - 0.4.
I have two thoughts:
The wireless portion of the network is making this slow.
That load avg is higher than I would like it to be - so the Odroid is bogged down by doing all that it is.
Your experience in such matter exceeds mine considerably - what would you suggest?
I want to thank you for this! I've been unsuccessfully fighting for over a week on trying to figure out a "cancel (stop) delay on truth change" to actually work.
Zigbee motion to a zwave light, on/off logic in Node-Red.
Motion: 12:10:46.747
Light ON: 12:10:47.079
So 0.332s. On that device driver I know that I log the ON event via the report back from the device (not issuance of the ON command), so it actually turned on faster than 0.332s.
Now, the logic is very simple in node-red on that one (motion, check mode, turn light on at x% based on mode), but still gives you another data point. My node-red server is running on docker on my AMD EPYC 3251 based server.
Similar to yours EXCEPT I am not asking the hub for the current mode in that part of my logic.
I store the mode as a flow.variable any time the mode updates and then use that variable in a switch node. That is MUCH faster than going out to the hub to check mode every time.
To store mode in a variable: Hubitat mode node -> change node that does a 'set flow.currentMode = msg.payload.value'
I just stick that at the top of my lighting flow sheet (side note: I do all lighting for my entire house in a single Node-Red flow), then I can use flow.currentFlow anywhere I want to in that flow. I guess you could make it global.currentFlow instead, and then use it in all flows. I haven't tried that to see what the speed penalty is by doing that (if any).
To check the stored mode variable in a flow: switch node that checks flow.currentMode == 'desired mode'
Whether you check the flow.currentMode in a function node or a switch node is up to you (more of a style preference versus technical decision). But either way it is a really handy way to do mode checking basically for 'free' (well, close enough to 'free' versus polling the hub, anyway).
It is handy to have that inject there. Even handier if you make it a 1-time 'on startup' execution (run after 0.1s, repeat=none). Then the variable gets set on startup without waiting for the next mode change.
I can't get this work. So clearly doing something wrong. The debug node indicates that I am able to save the current mode, but I cannot retrieve it using a switch node.