Device variables in rules?

I have a ton of leak sensors. I have a rule that says if leak sensor 1 is wet, or leak sensor 2 is wet or ā€¦ leak sensor n is wet thenā€¦.

Can the rule engine expose which specific sensor reported being wet so my then condition might be something like:

There is a leak detected by sensor X in location Y (where X is the sensor name and Y is the sensor location),

Example: There is a leak detected by sensor 3 in the hall bathroom.

Thanks.

In the rule you created you should see a "Local Variables" section lower down. For the sensor name use %device%, etc. I am not sure about location however. I would suggest naming the sensors so that the location is obvious. So, if you set sensor 3 to "Hall Bathroom Sensor" or a more descriptive name. When you use the variable, "There is a leak detected by the %device%". Then it would come out as "There is a leak detected by the Hall Bathroom Sensor". Whatever device triggers the rule will populate the variable %device%.

FWIW, I avoid this sort of problem by giving each device a name like "Guess Bath leak sensor". It's in the room "Guest Bath".

I only number devices (e.g., "leak sensor 1") before I deploy them. Once deployed, they get a real name.

Thanks. Yes, I do the same, I was seeing if the device name could be exposed, looks like
It can. Location would be useful too.

Thanks. I'm using the Visual Rules Builder. I don't see a "Local Variables" drop down. Is that in a different tool?

1 Like

Yes, you would need to use Rule Machine, a separate app and the most powerful of the built-in "rule" options.

How very British of you :slight_smile:

1 Like

Very true. (I am British), but also want my automation to sound like a polite British gentleman. (Like a butler-type).

3 Likes

Thank you. So now we have the basic rule build, the visual rule builder and the rule machine. It seems like there might be an opportunity to simplify? (Perhaps a single tool that can expose capabilities if needed?)

I'll look into that one also.

Your statement is somewhat ironic. The other apps are for simplification. Some were added as Rule Machine can be a bit much for most. Definitely not the most intuitive. Anything you can do in the other apps can be done in Rule Machine. Not true the other way round. Just an FYI, you posted in the Rule Machine forum, hence my assumption.

1 Like

You might be onto something here!

I had one automation saying Hey, the fridge door is open. Close it! and its passive-aggressive tone made me chuckle every time it triggered. Key word is "had" since my wife threatened to trash the "small black box" if she hears it one more time :slight_smile:

Fair point. Although logically when I went to post, I was thinking, "hmm, where should I post this question..." then I found this forum. Are there forums then for the other rule builders?

Sorry, I immediately thought of Holly, the computer on Red Dwarf.

"Holly always speaks in a droll, slightly monotonous, and quiet voice, even when sounding alarms, ..." Holly (Red Dwarf) - Wikipedia

Have you changed your hub's default voice (used when playing TTS audio notifications via Sonos) to "Brian"? I'm curious if he sounds like the Butler you had in mind.

Rule Machine was given it's own forum given the nature of the beast, I'm guessing. There is a generic forum for built-in apps. Not a big deal as long as you get an answer. I was just pointing out my assumption.

Thanks. Originally I had developed my own system called Carson (Downton Abbey butler) and used an English voice that was very good.

I just tried Brian. Itā€™s not too bad. Iā€™ll try that one for a a bit. Thanks for the recommendation.

On a related note, how do I save the ā€œBrianā€ setting?

If I go to devices, select the speaker, change the drop down under Speak/Voice Name to Brian, then click save preferences. It keeps reverting to Mathew.

Edit: found it. ā€œ To change the default text-to-speech (TTS) voice on Hubitat, you can go to Settings > Hub Details > Default Text To Speech (TTS) Voiceā€

(Not sure why it doesnā€™t also work under device setting though).

1 Like