Definitions of "Random", "Cancelable"

Ladies and Gentlemen: I am getting more used to what I am doing with the compostion of Rules, but, there are two things I see in Rule Machine and I am a bit gun-shy about trying them.

Random I know the definition of the word itself, but in context of Rule Machine, HOW random? Say, I set a rule to turn on lights at 15 minutes past sunset, but want this to vary a few minutes either way each day to give the house a lived-in look even if I am away.

Cancelable What does this switch do?

Thank you!

The Friendly Grizzly

This will allow the pending action to be cancelled, but the cancellation has to be explicitly defined somewhere. Below is an example. The delayed "off" actions are cancelled any time motion goes back active while they are still pending.

1 Like

Assuming you are talking about the Random? option on a Delay, means the actual delay will be somewhere between 0 and the value you specify (i.e., something random within that range), as opposed to the behavior without this option selected, when the delay will always be the number you provide.

If there's something else somewhere that you're seeing, a screenshot may be helpful to describe what it is, but it's probably also something along these lines.

It is where you describe. So. I set a time of 15 minutes after sunset, it will "sway" between 15 after sunset to sunset, to 30 after?

No, it will be random between 0 and 15 minutes. The value you provide is the maximum. (EDIT: Wait, unless you mean that your trigger is already at 15 minutes after--then, yes, a "random" delay with 15 minutes specified will be an additional 0 to 15 minutes after that, so 15-30 total.)

1 Like

I understand the logic (I have some past programming experience). Now, another question: I see actual programming going on here. Is there a way to dive in and see what Rule Machine composed? If I understand it, and the other rule app, these are just front ends to build up code in the background. I used something similar on a Unisys mini decades ago to build reports. I finally found the way in to the actual programming, and all it was doing was building COBOL instructions.

It is actual programming, but the backend is closed off (sort of). From what I understand, RM just gives a pseudo-code front-end that handles the real coding on the backend on the fly. You could definitely dig in and recreate it but I don't know that there's much point. You can definitely write your own code for apps/drivers (I'm trekking down that path right now).

You see pseudo-code, just an arbitrary (but probably the most concise and descriptive) method of representing the selections you've made in the interface. It's not code per se. Rule Machine works using the same techniques other apps do--it's just a lot more complicated and powerful.

If you do want to write code, Hubitat lets you do so using the custom app and driver Groovy development environment. These are under "Developer Tools" in the UI, and there is some documentation on the Hubitat Docs site, with more coming soon. There are also many examples in Hubitat's HubitatPublic repo. If you want to truly work with code, this is the way to do it.

It was my inner geek trying to get out.

2 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.