Matched Condition Not Actioned

I think I know what is going on. There are places in the UI where the code removes [ and ] from the display. That case I had above had hidden brackets... [digital]

So, take a look at the Events from the device page for Front Door Lights, and see what the Description Text actually is.

Meanwhile, I have to chase down the bracket suppression.

1 Like

The one good thing about all these problems I'm having is that I'm learning a bit as I go.

Yeah I think I misunderstood and thought you were using two rules rather than two expressions with an AND.

I noticed that also.

I'm somewhat clueless so this is all a steep learning curve for me. I'm not sure what the correct syntax is when using 'contains'. You have used two expressions to pick out individual words, I've tried to use two consecutive words in one expression. In the other example where it is "set to 38% physical" I tried to use contains "set to physical". I'm simply not sure of how to format it to capture what I want.

Feature request: Make Physical Switch and Physical Dimmer available within expressions rather than just triggers and I wouldn't need to go anywhere near a variable!

1 Like

But these are events, not conditions.

have you thought about using a virtual switch instead of a variable that is what i do..



Yeah I think on reflection I could probably just copy your rules in their entirety to do what I want. It just bugs me a little that I need 3 rules and one virtual switch rather than 1 rule. I'll give it a try.

Please show the Events from the device page for Dining Room Lights.

Yeah I realise that. I know that you can't tell the system to turn on a physical switch but I'm not trying to do that, just differentiate between the two triggers to affect different actions. For instance:

Triggers
Physical Switch Dining Room Changes
Physical Dimmer Dining Room Level Changes

Actions
IF Physical Switch Dining Room Changes do abc
ELSE IF Physical Dimmer Dining Room Level Changes do xyz

I appreciate Physical can't be used as an action but don't understand why it can't be used in an IF THEN as above.

Anyway I'll try another method using a virtual switch as @kahn-hubitat has detailed.

I meant that for @johnwill1 johnwill

2 Likes

Apologies I forgot to answer the previous question. Yes it does have the square brackets in the event text and yes these are removed when added to the text in the variable.

So, back to your original rule. Put the square brackets into your condition text for contains, so that it matches what is actually in the event text. Then it will test correctly, even though it won't be displayed correctly. I have found the fix for the display, for the next release.

2 Likes

In your case, it should be

contains "on [physical]"

So, it's not a compare bug at all. It's a display bug that led you to make the wrong test.

1 Like

Thanks and just in case I've missed it. I take it there isn't a method of setting a variable to True/False directly from the text within the device event stream? (rather than putting the text into a string in one variable, then using that to set another). A long shot but thought I'd ask

Simply that there is no object stashed away that keeps track of 'physical' and 'digital', which are the Type of an event (see your post above for the Type column). If there were, then you'd be stuffing that into a variable, just like you're pulling it from the %text%.

Generally, if one wants to distinguish between different triggers, one uses them in different rules. Testing of trigger events really muddies up the logic, with all sorts of extra stuff just to differentiate. Why not just use two rules if they are going to do different things depending on the trigger? To the extent they have things in common that are done, it is possible to run the actions of one rule from another.

1 Like

Rules are free. Your automations would be simpler and more efficient if you break this up instead of wanting to cram everything into one rule. Also, %text%, %device%, etc, were created for the purpose of including information in messages, not for the purpose of testing trigger events in rule logic. You're taking the long way around...

Blame @bobbles - I copied him :joy:

Oops. Sorry. :blush: :blush: :blush: :blush: :wink:

1 Like

So if I create two rules with these triggers:

Rule 1 - Physical Switch On or Physical Dimmer Level Changed
Rule 2 -Physical Switch Off.

I can either put the actions as Set Variable to True on the first rule, False on the second and then reference that variable in my RM motion lighting rule.

Alternatively I could forget the variable altogether and use Rule 1 to Pause the RM motion lighting rule and Rule 2 to resume it. Would that work? What happens if the motion lighting rule is in progress and then another rule fires that pauses it - would it pause immediately or complete it's actions?

When it finishes. Pause is checked when rules are triggered. Although, I don't know what your rule does, so can't be sure...

1 Like

Thanks that answers it - I'll use a variable. As the 2 rules are to disable the motion lighting rule when the switch is used manually, using the pause action for the rule would not work very well. The motion lighting rule has a wait time between motion lights on and lights off that is restarted with each motion trigger, so the rule would never pause until the lights had gone out and that defeats the object.