Help with creating a rule or many rules in RuleMachine

I have a google assistant, two Hue lights, two motion sensors. One of each in two different rooms.
My goal is to say a command to Google assistant and then with ifttt trigger the Virtual Switch that should turn the light to 100% in the room where motion is presence or have been presence under latest 60 sec. But only if the dimmer level is already below 71%, or lamp is off. And the same command that trigger ON, should also be a trigger for the lamp or lamps to be set in it's previously state. (off or at a certain dimmer level).

Tried various setups with alot of rules in rule machine but non work 100%. The command "Ok google Daylight" triggers the Virutal Switch and it works great. So that part is no problem. The problem begins with RM rules and all the switches.

How could a working rule or rules for this scenario look like?. Any help or theories would be very appreciated :smile:

Ok, so you have the condition of the switch being on happening. The other conditions you have listed. Just add motion active to that mix of scenarios. Actually, you should do it with a triggered rule. The trigger of which is the virtual switch being on. The conditions are the ones you have listed plus motion being active. If your motion sensor has too short of a timeout, then you would have to add another rule setting a booblean variable to use as the condition of the first rule. Set the Boolean variable the same way you would a light on/off by motion in RM.

1 Like

Many thanks! I touched it all too much with too many virtual switches and rules so I didn't know what was on and off in the end. Will try it again with above logic and see if i could make it work. :smile:

Yeah....I would stay away from adding a bunch of virtual switches unless you need something else to interact with them, like Google Home. Use a Boolean global variable in RM instead. Then you don't have to worry about anything else but RM turning it on or off unexpectedly. Plus it doesn't put another device in your list of devices. It should be fairly simple:

Rule for "Occupied":
Condition:
Motion active
Action True: Set variable True
Action False: Delay 90 seconds, cancel on Truth change Variable False

Triggered rule:
Trigger: VS Turning on
Condition:
Dimmer <70
Lamp is off
Variable is True
Rule:
(Dimmer <70
OR
Lamp is off)
And
Variable is True

Actions.....

Now, if you are using a global variable as a condition, there is a bug in RM that is being addressed that you have to set some other global variable, otherwise the rule can't access any of the global variables. So, what many of us have done is create a string variable called "placeholder" or something and just set it to whatever. It's just done so the rule can access all of the other global variables.

1 Like

Great! Will try it right away. :slightly_smiling_face: