%device%

I seem tot be having an issue with my triggers.
Doesn't %device% contain the value of the name of the device which made the trigger?
For example, here is my triggers:

As you can see the device which triggered is the 2nd Floor.
Yet only the first device is put into %device%

Say what? I don't see how you can tell that from what you showed.

How about some logs?

2 Likes

Sorry, should have included that:

actions:

This is not what is shown in the logs you provided; those all look consistent with what is shown.

This would be a bit clearer with trigger and action logs included, however.

1 Like

Here is the triggers:

Here is the Actions:

While the whole rule is good to see, what is really missing are the logs I asked for above. Trigger and action logging for an actual execution of the rule will show you what is going on. What you should see is that %device% is set to the display name of the device that triggered that last triggered the rule. The event-only logging you provided above is not inconsistent with the other screenshot, though not a complete picture of what might have happened; and this information cannot be seen from from a static screenshot of a rule itself as provided above.

So, without this additional information, there isn't anything that can be said about the behavior (other than that I have not seen any other reports of problems with this feature).

1 Like

Logs:

(events, triggers, and actions turned on)

If that is the case, your rule is not actually triggering -- which makes sense from the event noted since it is one you have specifically excluded in your trigger for this particular device. Again, %device% would be set to the display name of the device that last triggered the rule, which may or may not be this one -- so still no problem apparent based on the limited data above.

Let me try and explain what I'm trying to accomplish.

  1. If there is a LastResponse on any device that is not equal to "Success", then continue on to the actions.
  2. In the actions, shouldn't %device% be automatically be set to the device which caused the trigers to be triggered? (the 2nd floor device)

You rule looks like it should do that for "YoLink Hub 1st Floor." Your rule will do the exact opposite for "YoLink Hub 2nd Floor."

Maybe this isn't clear, so in case not: your rule will trigger on either of your specified events happening. Based on your logs, there are no events matching either of your specified trigger events; hence, no triggering of the rule. Additionally, trigger events are independent from one another and look at events, not states (unless we get conditional triggers involved, which you are not using)--so if you're expecting a change in one device to trigger based on a trigger event specified for the other device just because that device happens to currently be in that state, that is not how it works. It will trigger only with an actual event.

Why the focus on this particular device? The %device% variable will be set to the display name of the device that triggered the rule, which could be either of your devices -- so, yes, it could be the "2nd floor" device, but nothing above suggests that this should be the case. In fact, there are no logs above that show an event from either device that matches your trigger events -- though the fact that this variable is set to the "1st floor" device means that this must have been the last event that actually did happen that matched one of your trigger events.

1 Like

I'm a little confused.
Here is a partial screenshot of 1 floor Hub:
image
Here is a partial screenshot of 2 floor Hub:


Therefore my trigger is trying to detect if the custom attribute: lastResponse has a state that is not equal to "Success". The device that triggers that rule is only the one on the 2nd floor, yet %device% is set to the one on the 1st floor.

I'm also confused. :slight_smile: I'm not sure what you mean with this:

  • You have two devices that could trigger your rules (per your screenshot of your rule and its trigger events), "YoLink Hub 1st Floor" or "YouLink Hub 2nd Floor." Why can it only be the "2nd floor" device?
  • There are no logs provided so far that show either device actually triggering the rule. However, the "1st floor" device must have been the one that triggered it last time (based on the value of %device%; there are no logs that show this or any actual trigger event happening).

This shows current states, but it's not useful for troubleshooting rule triggers because they need events (which may result in a change visible here, but a snapshot of things as they are now doesn't help you see when any event actually happened). The "Events" tab at the top of the page might be a better choice.

Additionally, while your "YouLink Hub 2nd Floor" device is currently in a state that is not "Success," that is exactly what you are not triggering on. Note that your second trigger event says "equals Success", not "not equals Success."

2 Likes

Robert: Thanks very much for all your help in explaining this to me.
(I gave myself a timeout, and when I came back, it was as clear as day.)
Thank you.

I have another question, if you don't mind.
I have a virtual omni sensor, which has a setVariable as a string.
In Rule Machine how do I set that field "setVariable"? from a local variable?

That is a custom command for that device. It has the effect or setting the value of the variable attribute. You run run this command from a rule using the "Custom Action" feature/action and providing the single required parameter, the new value for this attribute.

(That being said, if you aren't using this device for anything else and just want a variable, an actual variable is easier to work with...)

1 Like

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