Rule machine: two trigger with "AND"

Ok guys I am stuck a little,

I need an action to trigger if two events happen. I cant figure out how to do this. Multiple triggers only work with "or" ("any will trigger")....

I cant use conditions because conditions only include states ("is" instead of "changes to").....

Thanks a bunch!

Events cannot be "AND" because any defined event can cause a trigger to fire. Can you describe what you are trying to test for in your conditions?

Best to lay out what you want.

I’ll put it together if I can.

Its pretty complicated.....ok so I have three harmony activities that, when turn on, trigger my hue strip to turn on.

The strip turns off after a specific amount of time. Now if I switch between activites I dont want the strip to turn on again. Only if everything was off and is switched on the first time.....

Maybe the solution is quite simple....and I just dont see it....

So your rule needs to be checking on and off states of stuff to determine if it’s allowed to turn on. Plus when you turn on the first activity or a delay to turn off the strip after a certain amount of time.


Harmony activity change


If whatever is off, and whatever 2 is off THEN
Turn on strip
Turn off strip after 60 min delay
End if

I thought of that too! The problem here is, that whenever an Activity gets switched to another ( so when it is on and then another activity gets switched on) it gets turned off before the other one starts.

This means to hubitat its the same state to beginn with: an activity gets turned on while the others are off.

The only theoretical difference between switching to an activity and turning on an activity the first time is that another activity WAS/WASN'T on shortly before.

This is why I asked myself if there is another difference on a different level. And here is where my AVR comes in.

When an activity starts for the first time my AVR turns on. When it switches to another one my AVR is already on.

I created an activity with trigger: activity turns on with condition: avr is off.....

But hubitat always finds my avr to be on as it seems to check the avr state when it already got turned on.

This is why I thought I needed an activity that triggeres when an activity turns on AND my AVR gets turned on/not turned on

Sorry its all quite confusing.....Im confused too by now.

Assuming you're using my Harmony Hub integration, use the "PowerOff" activity being 'on' as a means of knowing that all other Activities are 'off'. You should be able to base your RM logic on just the "PowerOff Activity" switch and ignore all of the other Activities.

IF "PowerOff Activity" is "Off", then turn on your light for a certain amount of time.

Thanks for the hint with the power off function. That seems to make sense!!

Btw I love your harmony integration. It just works! I installed it a couple of months ago. Do I have to update it manually some way? Or just stick to "never change a running system" :slight_smile:

It should be easy to update the code. Just open the Harmony Driver code on your hub, at the top click IMPORT and there should be a URL already listed. Just click the button to grab the latest code and say yes when prompted to overwrite the existing code.

I am not a coder, but did manage to put together a bunch of flows in Stringify, and they all worked well up until it was shut down. I have since migrated from W2, and all is well - relatively speaking. In searching for a solution, I came across this thread.

Putting together rules in RM 4.0 is not quite so straight forward, and I am faced with the same problem as the OP, and the original question of "how to AND multiple trigger events" was not answered - only his specific use case was addressed. In Stringify, ANDing triggers was indeed possible.

Which brings me back to this issue. How do you trigger a rule if the rule's trigger needs to meet certain "conditions"? E.g. time of day, a specific mode, motion detected at the front door - and only if all three are "valid" will the rule be triggered?

Based on this statement, any of the three examples above can be events, but a trigger on all of them together is not possible.

If this is indeed true, then this - to my untrained coding mind - would seem to be a grave omission from RM 4.0. The ability to "AND" multiple events into one trigger.

Any thoughts on how to overcome this?

You'll have to use conditions. For example consider the following:

I want my lights to come on when I arrive home, but only if it is dark outside.

My trigger would be:
Ashok enters geofence

The actions would be:
IF (time is between sunset and sunrise) THEN
Turn lights on

In that sense, RM builds it's logic almost exactly like Stringify.

1 Like

Another user recently asked a very similar question. In addition to @aaiyar’s explanation, you may find the following information useful as well...

Rule Machine is very capable of being used to create some very complex automations.

1 Like

Getting my head wrapped around this took some thought :slight_smile: But I think I now get the picture, but time will tell

That thread was also helpful. However, the issue I have is that RM is not user friendly at all - especially to us non-coders. The above statement - whilst describing the capability of RM - sadly also is a statement on its "ease of use" - complex. Stringify had some excellent tutorials on Youtube on how to create Flows. I also found their GUI to be very intuitive - so much so that I never had to ask any question on any forum. Apart from the HE Community, there is not much else to assist non-experts in getting rules up and running. The docs are very limited, and I have not seen any tutorials. So for us mere mortals, all we can do is to read threads and post questions - but that is a slow, inefficient, time consuming, and counter-intuitive way of learning, and quite frustrating. Even if Hubitat leaves RM 4 the way it is, some tutorials and user guides aimed at the non-coders would be very helpful. I did read Bruce's post that he released when RM 4.0 launched, and it is the same content as the docs - written by a master coder for coders :frowning:

Having said that, the Wink 2 has been sold on eBay, so HE it is, and I will continue my quest . . .

Check out YouTube channel

1 Like

Yeah I have seen it - not much help for non-coders on creating Rules/Triggers/Conditions . . . .

I'm not a coder, just watch the video give it ago and ask the community how to do things if you get stuck. If you have come from another platform I suspect the other built in apps will do what you want anyway and they are simpler to use. Best bet is to start there then move to RM if you have to, but by that point your understanding will be better.


Oh I will get it to work - eventually. The point is Hubitat is severely lacking on tutorials/user guides - which the average consumer would need, without the need for extensive research and community support. These are areas where the tinkerers thrive, myself included up to a point.

Definitely not a coder here. When I started with Hubitat, I found the community to be incredibly helpful. I wish Rules could be shared (like Stringify flows); however, my experience indicates that community members will do whatever they can to get you going.

Post screenshots of rules you need help with and folks will step in with suggestions.


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