Rule Machine: Rule Functions

This is interesting. I could create a system variable called “empty”, use a rule to set it to an empty string, and then just copy that variable in a rule where I need an empty variable?

Why does the coherence rule need to run to keep the variable empty? Do empty system variables automatically get set back to something, like a space?

Right, I won't tell you why mine's named what it is since it's politically motivated, yet immensely descriptive.

It doesn't. Since you can't create a variable with a null/empty value, I had to run a 'remove self' against it somewhere and since there's a chance it could accidentally be populated (albeit unlikely), I killed two birds with one stone and shoved it in my coherence rule.

2 Likes

I was already using Hub Variables to pass values between rules. ie. To keep a button in sync with a ceiling fan wall switch. So switching between the two methods of control was seamless. Recalling functions from my comsci classes days, calling a function could be done with local variables the name didn't matter only the order and type when called. Guess I need to play with it a little to figure out what is going on. Thanks for making improvements. Adds to the exchange in abundance with Hubitat.

Sorry, not following the context here?

this was in reference to the new rule as a function. How it needed Hub Variables to pass data back and forth. I observed that already was available. Using Hub variables to pass data between rules.

Ah, got it. :+1:

It would be nice to be able to pass more than one parameter to a rule function in some future release :slight_smile:

Already possible AFAIK

2 Likes

Yeah, I'm doing it that way now. Problem is figuring out a delimiter that is never used in the param. I'm calling a function where the param can really be any string.

1 Like

Rule Mach is perfectly happy using emojis (think: )for the delimiter.

3 Likes