I see the new 4.0 documentation in Habitat Documentation but I'm learning nothing from it as far as how and where to write code lines. Where are you writing these command lines? All I see in my Rule Machine app are a bunch of drop down menus. Are you generating all these lines of code from those of is there a place you can actually type in these commands?
No. You can't create or import code for RM. What you are most likely seeing is custom created apps and drivers, which is done in Groovy using the App Code/Drivers Code sections.
Thanks for the reply. So below is an example. Was this done from the drop down menus in 4.0 or was this done in Groovy?
Ahhh, those would most likely be virtual devices. Without knowing what those devices are, it's hard to say exactly what they are, but I'd bet they are simply virtual devices. My first guess would be that they are virtual switches that are toggled via other rules.
That entire rule was written via the drop down menus in RM 4.0.
Sorry, I confused the question. All of the program lines shown here, were they generated using the drop down menus in 4. Forget the arrows. That was just on that post.
Yup. All created by the drop down menus. There is no way to import or create code for Rule Machine.
Done by UI. Well I guess I need to get deeper into that!
If you haven't figured it out already, all of the lines in the rule actions are created by adding actions, which are categorized: choose a category from the left, then choose the desired action on the right. For example, to create an "On: (switch name)" action, you'll first need to click into the Actions section, choose where to add an action (usually the regular "add" that puts it at the end), then use the two menus to choose your action: select "Control Switches, Push Buttons" from the category menu on the left, then "Turn switches on" from the actual action menu on the right before filling out the appropriate details in the UI (mostly choosing the actual switches). Yes, this may take a while for complicated rules, but I assure you it's a lot better than it used to be. (This is probably why CoRE became webCoRE--to overcome the limits of the app UI model of a certain other platform after which Hubitat's own is modeled. Some day, this may change in Hubitat...)
The Rule 4.0 docs that I usually point people to (here: [Released] Rule 4.0) assume a bit of previous Rule 3.0 knowledge, but you can probably skip those comparisons, just look at the 4.0 parts, and not lose much. I don't think there's anything quite like a "Beginner's Guide to Rule Machine," though, so it might be good for the community to try to create one (or staff, but I'd rather they spend their time making the platform even better ).
And any time is a good time to mention: if you haven't checked out Hubitat's array of other built-in apps yet, I'd encourage you to look their first before heading straight to RM. They can do quite a bit, so I'd consider RM an advanced tool to you can use to create custom automations when none of the stock apps can do what you want.
That's not Groovy, that's English. Techie English.
Thanks folks. I keep trying to make this into Basic. I'm slowly sifting through it. The link to the other tutorial is very helpful. I already have a lot of programming done with the other Apps. No problem utilizing them.
One of the first things I struggled with is having all trigger events being "OR" and no choice for "AND". Seems that by itself would simplify things from square one instead of having to work conditional events later in the sequence.
That isn't possible because triggers don't work in that way. They are momentary events (I often tell people to think of them "durationless" for that reason), and Hubitat automatically inserting "OR" is just there to show you that any of them happening counts as a trigger and will cause your actions to run. I wouldn't really think of it as boolean logic, just a plain English "or" since events do not have truth values. Conditions/states do. If you want to check for two states being true at the same time--for example, two motion sensors being active or a motion sensor being active and the time being between two times--then you can do that with conditionals in your "Actions" section.
You are correct. I need to unlearn my previous programming experience when dealing with this programming format. I played with several scenarios last night and was able to work them out in this framework. I was surprised when a couple of things didn't work as expected and had to take different tactics to get there. I believe they call that a learning curve? But the challenge is what makes it fun... I think.
Thanks for the help and for getting me at least back on the rails with this.
Would be great to change all these crazy and hard to edit rules to groovy scripts. My understanding that any "Rule machine" rule can be implemented as an "app code". Is there a boiler plate example of custom app code that I can use to start. For example: switch toggle and one or two conditions, e.g. time of day and one or two actions, e.g. send message?