Is this the way to setup complex rules

I am trying to do the following: - Can anyone confirm if I have made this too complex and there is a way to simply my creation - I have yet to fully test it

Motion IS = Active

  • set dimmer to 10 if mode = Evening
    OR
  • set dimmer to 20 if mode = Night
    AND
    Turn lounge light 1 and lounge light 2 on

Motion IS = Inactive

  • Turn lounge light 1 and lounge light 2 off
    UNLESS
  • TV status = On
    OR
  • Lounge Mini status = Playing
    OR
  • Lounge speakers status = Playing

I have set 3 rules up
1 - Evening


2 - Night


3 - Off


I can confirm the lights on rule does not work. It turns on with motion even though mode is day

@Shaneb - the rules have not been set up correctly.

The issue is that the conditions that you have put in the "manage or create conditions" section are not doing anything. Think of that section as a bucket from which you can use conditions in the actions section... but you have to use them!

You should be able to put the whole thing into one rule.

Something like this (but may need some tweaking depending on the exact use case you are after - there is some stuff you put in to do with your TV and mini speaker state .. and I'm not sure exactly what you were trying to do here):

Trigger events:

  • Lounge Motion sensor changes

Actions:
IF Lounge motion sensor is active AND time is between sunset & sunrise
THEN Dim Lounge lights as per what you want for evening + cancel delayed actions
ELSE IF Lounge motion sensor is active AND time is between sunrise & sunset
THEN Dim Lounge Lights as per what you want for day + cancel delayed actions
ELSE IF Lounge Motion sensor is inactive
THEN Turn off Lounge lights (with delay - of however long you want to time out after no motion.. I use around 2min but up to you + use a cancel flag (so that if motion starts again during the delay it will cancel the off command))

To use the IF / ELSE IF etc use the conditional actions option in rule machine

actually I just reread your original post and there was an explanation for what you were trying to do re: TV and speakers.. so the rule should be like this for that - all in one rule:

Trigger events:

  • Lounge Motion sensor changes

Actions:
IF Lounge motion sensor is active AND time is between sunset & sunrise
THEN Dim Lounge lights as per what you want for evening + cancel delayed actions
ELSE IF Lounge motion sensor is active AND time is between sunrise & sunset
THEN Dim Lounge Lights as per what you want for day + cancel delayed actions
ELSE IF Lounge Motion sensor is inactive AND TV is OFF AND Lounge MINI is OFF AND Lounge Speakers is OFF
THEN Turn off Lounge lights (with delay - of however long you want to time out after no motion.. I use around 2min but up to you + use a cancel flag (so that if motion starts again during the delay it will cancel the off command))

Hey @AdamV thanks very much, I figured out the Conditional rules, however I didn't consider that I can stick it all into one rule. I was thinking purely on Motion turns active and motions turns inactive, not mode changes. THANKS!

@AdamV

I'm almost getting there...couple of questions if you don't mind.

  1. What does - 'Cancel delayed actions do
  2. How do I add in Cancel flag and end

there are a few issues:

  1. It looks like you have decided to set the dimmers per mode? in that case you should remove the condition in the if statement re: sunset and sunrise.. because - as it is currently written this rule will only turn on lights in the evening.

  2. Cancel delayed actions cancels any action that is going to happen on a timer. In this instance, for the off part of your rule you have the lights turning off after a delay of 30 seconds... however, you would not want that to happen if say, during that 30 second period motion started again.. so thats why we need to set a flag so that if motion starts again within that period it cancels the timer

  3. to add the flag, go to edit the action for "Off: Lounge Light 1 ..." and you will see an on/off switch for cancel.. turn it on and save

  4. Its not necessary.. but its probably good practice to add an END IF at the very end of this script

Hey forgot to update to update the rule. I have tweaked it a little as the main lights didn’t really work for us as a rule, so went for lamps instead.

Also turned off dimming rule as if we over rode the rule using google home, it went back to the old dimming setting.

Speaking of which, is there a way to cancel rule if google home as changed the settings