Button push trigger

Is there any way to use a button press as a trigger, without specifying the button number?

Say a virtual (or real) device has 100 buttons. I was wanting to trigger a single RM Rule when the "button push" event happened for any of them.

I was wondering if there was a way, short of creating 100 triggers?

Thanks!

Yes, use "push *changed*" as the trigger. You'll need to use "Custom Attribute" to do this.

1 Like

But, what if the previous event was the same button number?

I guess I can experiment... :stuck_out_tongue:

Button drivers generally set a flag on the event that causes the platform to treat the event as a state change, even if the old and new values are the same. If it didn't, apps like Button Controller would also fail in a similar manner. :slight_smile:

2 Likes

Doesn't work with "changed". However, it DOES work with "Any Value". W00t!

@bravenel As a trigger for an RM5.1 rule:

When I select "Any Value" for the custom attribute "push", it requires a decimal number. However, I have no idea what to fill in (and it maybe doesn't matter--as long as I put something there).

Am I misunderstanding what I should be doing here?

image

Thanks!

First, I'm able to reproduce the failure with a rule like this--it only triggers if the value truly changes, not on any event that comes in (as may often be the case without a change for buttons that use isStateChange: true for the event):

Rule 5.1 with custom trigger for 'pushed' event

I thought it used to work like that, but I just downgraded to 2.3.0 to test, and it seems to work the same way there, too, so I'm not really sure (but I'm also pretty sure this exact setup has been recommended for odd cases like these in the past).

Second, it's not clear to me if the UI should allow "**Any Value**" here or not; I know this has use in the "Time Since Event" condition, and I suppose it could be useful for sticky triggers when you just care about a change but don't care what it is, but then I'm not sure why it's prompting for a specific value (or how that's different from "**changed**" if it shouldn't), so I'm probably just missing something or this is a UI oddity.

Both of these are good questions for @bravenel. (To expand, the second issue appears when using a Custom Attribute trigger, here a button and the "pushed" attribute, though with some playing around I did, it doesn't seem to matter.)

In any case, since 2.3.1 is done, you'll be waiting at least until 2.3.2 for these changes, so creating either multiple triggers or using a custom app that subscribes to whatever might be the best idea in the meantime. :smiley: (Or perhaps clone and edit an older Rule version if you can find one that works the way you want, but I just tried all the way back to 4.1 and it does the same, so my memory must be way off here...)

For now, the "Any Value" works. Guess I'll see what needs tweaking in 2.3.2.

I am using a virtual button to set a value in the range of 1-100, so a crazy number of triggers to create. :slight_smile:

@rob9

What you're showing is a UI glitch that I will track down (where the UI puts a value in parens as part of the trigger).

If you use *changed* as the attribute value, the resulting subscription is for just pushed. This would contrast to subscribing to pushed.1 to get a subscription to button 1 pushed. This is what you said you were looking for.

Oh, it's not a UI glitch at all -- 3 was the last button pushed, and hence the attribute value.

Well... What I am wanting is any "pushed". Even if it is the same button as before.

When I used "changed", it only triggered when the button number changed between pushes (e.g., "push 1" then "push 1" only triggered once). "Any Value" works for any push.

1 Like

The issue with "Any Value" is that there is that "0.0" field that needs some number (that I'm not sure what it does). ATM, I have what I want. :slight_smile:

Ah, yes, RM is enforcing *changed*. But, you're right, **Any Value** works to get the subscription. And it does work to trigger the rule as well. Nice.

Good find. I wasn't aware of this.

2 Likes

Can you explain what the "Decimal Number" that goes with Any Value is for?

image

I think that is a UI bug. It shouldn't prompt for a value. I think the trigger logic works correctly, even though the UI is looking for a value it shouldn't.

I will track that down for next release.

4 Likes

Also see: