Using Time Variables with Button Contoller with multiple picos

Hubitat Elevation® Platform Version

2.2.8.156

Hardware Version

Rev C-7

Objective: I have multiple Picos in the same room controlling lighting and Motion settings. In general my goal is to be able to press and hold either button 1 or 5 on either pico and have motion disable (with lights on or off respectively) for 3 hours (unless other events occur that I will omit here). With 1 pico I can do this through a cancel in rule in the event either button 1 or 5 is pressed. Across picos, however it becomes more complicated. I thought about using a time variable for when either button, on either pico, is pressed, but when I try to set a global variable, I cannot do it in the UI. See Below. Am I missing something obvious?

Is the issue that you can see/select the variable, but the UI isn't showing options to set it? Maybe hit "Cancel this action" and try to set it up again to see if that resolves some fluke, which it seems you've encountered. You could also try deleting this button actions section and re-adding/setting it up again, or even re-creating the entire rule if nothing else--what you're doing looks like it should work.

That being said, I'm not sure why you'd need a variable; "Cancel Timed Actions" can be run on another rule, so if that other button device is set up in a different rule, it should still be able to work (but perhaps I'm missing a nuance of your setup).

On a related note, if you are using Rule 4.1, I'd be cautious with "Cancel Timed Actions," whose behavior isn't really clearly defined (does it affect just the actions for that button event--button 1 held, in your screenshot--or actions for any button event that is part of the same button device rule?) This is one thing that Button Controller 5 makes clearer, and the "Button Device"-type rule has been removed entirely from Rule 5.0 in deference to this.

On another related note, if you're using "Cancel Timed Actions," you don't need to mark the delay cancelable; the "Cancel Timed Actions" action doesn't care and will hit all delays (and pretty much any scheduled job, as indicated in the UI when you choose this option); this only matters with "Cancel Delayed Actions," with the other difference being that "Cancel Delayed Actions" can only work within the same rule. Will not affect the outcome for you, but maybe something good to know regardless. :slight_smile:

The issue with the time is the GUI, And I did try reloading and that didn't work. I'll try deleting and re-creating.

That said, maybe I have multiple issues going on, because when I hit "cancel timed actions" only "This Rule" populates but I have many times rules, so I was wondering if I can even cancel actions on the same button device let alone another pico device????

I just thought with multiple Picos it might be easier to just set a "re-enable time". Then use a rule to evaluate that and control the motion as needed. Then all devices simply update the datetime variable accordingly.

I have come full circle now. I built some 10 button Pico (pushed and Held) rules in Button 5. However, I thought it would be much easier if I could clone these. I saw comments that RM replaced button so I started rebuilding some automations in RM5. I realized that Button Device is only in 4.

This is a long winded way of saying. While i have a significant investment in Button Controller 5 (5 Pico Remotes programmed) . I will have to manually recreate probably 10 more or so.

This thread seems very relavant too as it mentions a fix next release. As I mentioned above I think there are multiple issues on goiing INCLUDING MY LACK of EXPERIENCE :slight_smile:

Ah, yeah, I forget if that problem with BC 5 was fixed in a subsequent 2.2.8 hotfix or if you'll just have to wait for 2.2.9 at this point. Guessing it might be the latter. Cloning will also be possible in BC 5 (and any app!) in 2.2.9, according to what they've made public about the release, so hanging on until then might be easier.

But it won't help you in the meantime, so...not sure what would be best then. :slight_smile: Maybe Rule 4.1 with "Button Device," since that should work if you don't use hub variables and cloning will work there. You could also separate out the rule for "hold" (and what I assume is a virtual switch that restricts the Motion Lighting app?) into its own rule in whatever version works best for you there--and even Rule 5.0 with a "Button" trigger should work for that if BC doesn't (with only one button/event, you don't really need the ease of use BC provides with multiple events)--and then keep using whatever app/rule works best for the remainder of your automation.

Thank you! I think maybe I'll hold off until clone is enabled as I have about 13 picos anyway. The "Hold" button is actually one of two indicators already with the other being a presence detection using Raspberry Pi zeros. It is getting pretty confusing fast so I think I agree that waiting until cloning and this fix is in to continue. Any word on the timing of 2.2.9?

They've announced that it is currently in beta. In the past, I think this has taken a few weeks in the past, though it undoubtedly depends on how things go during that process.

I have started this again now that 2.2.9 is out. Everything is the same as before including the inability to assign a time value to a variable. The only new item is the fact that the new button capabilities are out as of 2.2.9 and I have upgraded to 2.2.9.146.

If you haven't tried this already, the first thing I'd do is create a new Rule rather than trying to work with your existing one. It's possible that got "stuck" in a corrupt state from a UI perspective and won't let you create this action as expected; if that's not the case, if there is anyway to complete the action and then delete it or cancel out of the existing action creation, either of those is probably all you can do. But I'd see if it happens in a new Rule; version 5.1 is new in 2.2.9, and you won't get that by editing an existing Rule from 2.2.8 or earlier, and it's possible your issue would be addressed in 5.1.

(EDIT: I guess you might be using Button Controller instead of Rule Machine, but I'd still try starting over either way.)

Thanks I'll give it a try as I did clone a button rule.


Tried a new rule and same problem exists. There is no option to set the datetime variable. I even created a new datetime variable in 2.2.9.... just in case.

You just click on the value in the table to set it.

I can set it in the table. I cannot set it based on the time pushing a button on the pico.

That's weird. I can reproduce that, but don't understand it yet. I can set one from the dev version of Button Rule (which in theory, is same as released version). I can also set one from released version of Rule 5.1. I will get this sorted out.

In the meantime, a workaround is to use Rule 5.1 for that one button.

Thx!

Any disadvantage to using a rule vs button rule (cloning etc…). I’m not even sure a time variable is the right call. Im just trying to coordinate keeping lights on in a room from multiple buttons for three hours after the last was pushed.

Mike

You don't need a variable for this. Each button should add one to the same variable (Number). Then you have a rule triggered by that variable changing. It's actions are Wait for Elapsed Time of 3 hours, followed by off for the lights. Every time it is triggered, it starts the timer over. So last to push it, yields a 3 hour wait.

Even easier, forget the variable. Just have that rule triggered by all of the buttons. Same actions.

So let's say I want to disable Motion for 3 hours, and I hit "disable" on pico 1. I use a virtual switch today that I turn off disabling motion. Then two hours later I hit "disable" on pico 2. Won't Pico 1 set the switch to enable one hour later? This is not a general issue so if you don't have time to debug my predesigned logic flaw I understand.

Maybe you didn't catch that I'm using a single separate rule to handle the timing for all of the Picos. This rule uses the "disable" button on the Picos as its trigger. And, as shown above, it uses Wait for Elapsed Time to do the timing. When the second button is pushed, that timer is canceled and a new one starts. So, no, it won't be an hour later, but rather three hours after the last Pico button is pushed.

Wait is cancelled by the rule being triggered again.