Value of Private Boolean

Perhaps I’m missing something, but I don’t see a direct means to observe the value of a Rule’s “Private Boolean”.

I believe, after some research in the forum and Documentation, that I understand the history of “Private Boolean”. I also use it on occasion in the canonical idiom to prevent concurrent execution of a Rule bu a recurring trigger:

image

From the “FALSE” evaluation shown of the IF statement, I can infer that the Private Boolean is presently true.

Local and Global Variables show, in tabular format, their current value in the Rule Machine display and a way to edit their value, and also, in parentheses, their current value within each Boolean expression in which Local and Global Variables are used.

However, there doesn’t seem to be any equivalent way to observe the current value of a Private Boolean in an action, nor to see or change the current value of Private Boolean in a Rule (other than by executing a “Set Private Boolean” action).

Am I missing something obvious, or is a Feature Enhancement needed?

Looks like you're right that it doesn't display this value in the "regular" UI anywhere like it does for most device attribute and variable values. I can't speak to why, but it's likely due to its different history compared to "real" variables.

There is a less friendly way to view it: go to the "App Status" page (gear icon on the rule page), then scroll down to "Application State" and find the row for "private," whose value will display as "true" or "false." Not sure if it's something they'll want to add elsewhere, but that's a way around it otherwise!

3 Likes

you could create a connection and use the variable value in the dashboard or as another device, so you can check the value there

image

image

You can only create connectors for local or global variables, not Private Boolean.

2 Likes

The screenshots i provided are a private local boolean in one of my rules though, so you can

That looks like a local boolean variable. Private Boolean is not that--it's a "free" built-in variable you get in every rule that has been with RM since before the dawn of global or local variables. That being said, you could certainly create your own local variable to work around the issue noted if viewing the state is important to you, so that is still something worth noting as a possibility.

3 Likes

First create a virtual switch and call it "Boolean State for {rule}". In your rule you want to track the boolean state, set up a trigger for the PB state "changed". in actions have the rule turn the virtual switch on or off depending on the state the PB is in; i.e., if PB is true then on virtual switch, else off virtual switch.

All these complex work arounds! The OP has a good point I think, I often have no clue what state the PB is in. It would make sense to add it somewhere in the interface I think. Like in the opening page of the app, somewhere near the local variable maybe?

@bravenel would it be possible to expose the current state of a rule's PB somehow/somewhere? Oh and maybe to set it? (eg. just add a button/link to turn it true for example).

1 Like

Thanks, all, for your responses. Robert Morris (@bertabcd1234) understood my original post when he answered in post #2, above. My question was whether there was a direct way to observe (and set) the state of Private Boolean other than Private Boolean actions. Apparently there is not, other than searching for the “private” entry in the pages and pages (for this rule) of application state entries, as Robert noted. I knew of the suggested workarounds.

I guess this will just have to be a feature request to Bruce (@bravenel) in his ample spare time.

ahhh, you are correct. my apologies

+1 for this, at least to more easily see the status of the rule’s PB.

I think @bertabcd1234 is prob right, since the private Boolean in RM predates even the Hubitat platform, it may not have received more recent UI updates, which have helped in general to demystify RM. Although I’m not sure how common PB use is vs. the other variables.

It’s still a useful method for getting a rule to disable and re-enable itself without having to create a local Boolean variable first, IMO.

1 Like

In the next release, Stopping a rule and then restarting it will reset Private Boolean to true. As for displaying its value more explicitly, I will look into it.

4 Likes

5 Likes

So fine! Thanks. Do we have to edit/save the old rules? Or, does this magic just appear after the update arrives?

Download the Hubitat app