So how do you prevent an inject on redeploy? Also a broader question when should you "initialize" devices - I am doing it to populate the dashboard but am wondering if I should refresh certain devices like buttons that seem to be not respond to certain events like "held" from time to time - happened this morning with our bedroom sconces. Pushed worked though.
Does any one have a simple example of how they are using the set mode node?
Basically this is what im trying to acheive - and for the life of me i cant seem to figure it out
If switch A & B is on - Set Mode A
If Switch A is on & B is off (or vice-versa) - set mode B
If Switch A & B is off - set mode C
I can get Mode A & C to work, but the either/either condition in B is tripping me up!!
Just uncheck this box in the Inject Node edit box;
You should only need to inject once for that sample flow to Get All Devices then Events takes over. You don't need to Get All Devices after every time you Deploy anywhere in your flows which is what it was doing on mine.
That almost sounds like a job for the Finite State Machine node!
- of course... hangs head in shame.. thx
OK - Off to do some googling!!
Sorry - got it from @bill.d. Check out the Reddit post.
It is a little brain melting at first but really straightforward.
I did see that, but didn't really read through the links - Will now!
I'm looking to possibly rewrite my motion lighting sequence using his example.
Of course I also read this..
Make it better!
Here's a Home Assistant module called Entity Controller that is a state machine. It might be a better way to do lights, I don't know. It's structured differently than what I did. I'm not a programmer, so I didn't really want to deconstruct the code.
Maybe your Hubitat hub is slowing down... Have you tried rebooting Hubitat and then try it to see what the completion time is?
That said, on a freshly reboot hub my devices/all calls take ~22s. So maybe 30s isn't out of line if you have more devices than me?
I never automatically do devices/all calls for that reason. It pounds the crap out of the hub, I used to do it periodically for an integration I was working on, and during the call time I would see RM rules miss triggers, response times on motion lighting increase dramatically, etc.
It just isn't good for the hub, in general. Probably not bad as a one time initialization, but certainly not something you want to do repeatedly.
I agree with that article. I use state machines at work, and constantly wish I could remove them in favor of traditional logic. That said, they can work, and can be useful in certain situations.
For something pretty finite like motion lighting (or almost any home automation) I think they are unnecessary - the 'too simple' case in the article - in favor of more natural flow based conditional logic. But this isn't a black/white right/wrong thing. If you find you like SM, then use it!
Often it is just down to how you think / how you process logic in your own head. I work with some guys that think SM 24/7 (and it shows, they're weirdos lol), and use it for EVERYTHING.
Yeah still playing around with things.. not sure it couldn't be handled by simple logic but I find the concept interesting and a cool distraction. I am a programmer (mostly/sometimes) but have never used this construct before. Following the concept for the "states" in the lighting it's really only "off" or "on".. the transitions based on multiple inputs is where things start to get a little wacky in my mind. Again thanks for mentioning this!!! Always fun to stretch the brain a little.
I did a reboot and immediately clicked on Get All Devices with Full Details in Maker API and it took 66 seconds to generate list for over 200 devices
What I believe was happening is that I was moving nodes around w/out opening any to edit then hitting deploy, then moving some other nodes then hitting deploy, then moving a 3rd set of nodes in a short period of time so my hub was getting triple hammered; or possibly even more. I didn't even use that sample flow from Github so I deleted it last night and stopped then started NR. Hopefully, that solved problem. Fingers crossed.
Yeah, that sounds about right. I have 108 devices on the hub that takes 22-25s to do the call.
This is WAY beyond anything that I could figure out but is there a way in NR that it could query all of the Device & Command Nodes and generate a list of devices being used so that we could pare down what devices I have checked to include in Maker API? If it could only generate that list of unique devices, that would be even better.
So I've just changed my initialization routine to only trigger when one of the hubs is rebooted - I have a virtual button on each called "_startup" that I use for this.
Figure that is really the only time I would need to run such a beast besides manually via an inject node.
Pretty sure if you reboot the hubitat hub, the node-red hubitat config node will auto-repopulate once connection is re-established. No need to do it manually.
EDIT: That is wrong, per the response below.
Could be wrong, though. @fblackburn?
But syncing the dashboard items etc? That would be very nice..