I raised this question in another topic, but so far have not gotten a response, probably because it got lost among the chatter related to that original topic. So I thought I'd start a new topic specifically for this question.
Here is a screen shot of my Goodbye rule that will turn the lights off and change mode to Away when everyone leaves:
"Guest Mode" is a virtual switch. I implemented the condition so that I can turn on this switch if we have guests over and the lights won't all shut off if we leave the house but the guests are still there.
"Front Porch Light" is a scene capable HomeSeer switch. I use double tap down to trigger this rule manually if I ever want to.
Problem: I want guests to be able to trigger the rule with the button if they leave the house. The way things are now, as long as the Guest Mode virtual switch is on, the actions will not run. How can I make the switch condition apply only to the presence trigger while always allowing the button trigger?
AFAIK once triggered the trigger source is not considered by RM4
So you will have to expand your IF statements to do what you want.
i.e.
IF (All Phones leaves is true AND Guest Mode is off THEN
your actions.....
else-IF
your alternate actions here
endif
There may be more parens added by RM4 editor but above is the basic approach.
UPDATE:
Below is an example of this approach. Please note there is a logic error in this Rule I've not had the time or inclination to fix. But I think it will help with what you wish to do.
I write ALL my RM4 rules in a text editor then simply transcribe to RM4. My mind is not capable of going directly into RM4 as the construction selections are not so intuitive to me that I can go directly to RM4. I usually end up deleting the partial rule more than a few times before I get it right.
3 Likes
I see where you are coming from. In my case, there are no alternate actions. I want all actions to run or not run based on the condition. If the Guest Mode virtual switch is off, all actions run when all phones leave. If the switch is on, actions do not run when phones leave. But any time Front Porch Light button 2 is double pressed, regardless of the state of the Guest Mode virtual switch, all actions run.
I thought about duplicating the entire rule and removing the phone presence trigger and the virtual switch condition. This would give me a second rule that would always run all actions when the Front Porch button is double tapped. But this seems sloppy. Any way to do it all with one rule?
Even though I'm not sure your exact goal I'm positive it can be done in one rule.
First step, forget RM. Write down exactly the logic you want to create. Without this you go nowhere. Try to use the If this then that format.
Post what you get.
1 Like
I thought I explained my exact goal very clearly. What are you uncertain of?
The easy way would be to take out the guest mode check and phone leaves trigger from this 'Goodbye' rule, basically making it always run if the button is doubleTapped.
create a 2nd rule with your phones leave trigger, and in the actions have a check for guest mode and then run the actions from the first rule.. something like this:
Trigger:
All phones leave
Actions:
If guest mode is on then end rule
Run actions from Goodbye rule
This way its easy to get the logic right, it should always work the way you expect, and is easy to change later. All the goodbye actions are in 1 rule, so no need to worry about duplicating changes later and the triggers are separated and easy to manage for future needs as well.
The harder way would be to add logic to your single rule to manage the desired scenarios. If going this way, I would see if you can get a %device% == Front Porch Light button comparison and use that to skip the guest check in actions. I'm not sure if %device% will get set from this rule reliably without testing it.
Nice! I did not know it was possible to run actions from another rule. I was thinking that two separate rules would not be ideal, but this does seem simple enough. And calling the actions from the first rule in the second means I won't have to duplicate the actions, as you mention.
I will test this out when I get some time and let you know how it turns out.
easiest thing would be 2 different rules: one for the presence and one for the button tap
if you wanted to use one rule, you'll need to add more to your actions. basically you'll have to use conditionals to test for each condition and have it trigger accordingly