What am I doing wrong on this one?

So the intent on this and another rule is:

  • Track movement ("Backyard Moves" as variable that counts door openings, motion sensors)
  • If variable increases above threshold (4), then turn on the porch music as long as mode is desired, etc.
  • wait until all doors are closed and motion inactive for a threshold (normally 20 minutes, but set to 2 for testing)
  • Turn off the porch music since apparently no one is there.

A couple goals are that this doesn't repeatedly turn it on or off if it's already in desired state (hence the condition) and that if we leave or go to sleep it just bypasses the wait and turns it off immediately. (last else statement)

Does anything jump out? Did I not write the 'wait for expression' correctly with duration? Does the condition becoming false (once it's turned on) cancel the 'wait for expression' at the end of the trigger action?

You are missing an 2 ENDIFs at the end, but I think RM is forgiving of that so it shouldn't effect anything.

During a wait a trigger will start everything over again, so maybe that is it.

Best thing though, is to turn on logging and post the logs if that doesn't make it clear what is going wrong.

1 Like

Not sure why you have that final IF … THEN.

2 Likes

Adding log details for the app to see if anything jumps out

app:19992023-07-24 11:02:19.497infoAction: END-IF
app:19992023-07-24 11:02:19.487infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 11:02:19.480infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 11:02:19.463infoAction: IF (NOTMode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 11:02:19.453infoAction: ELSE (do actions)
app:19992023-07-24 11:02:19.450infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 11:02:19.434infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 11:02:19.431infoAction: Wait for Expression: Screen Door, Sliding Door all contact closed(F) AND Yamaha Receiver (porch)(on) is on(T) AND Back Porch Interior Motion motion inactive(F) [FALSE] --> duration: 0:02:00 (skipped)
app:19992023-07-24 11:02:19.405infoAction: On: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 11:02:19.400infoAction: IF (Yamaha Receiver (porch)(on) is off(F) AND Variable Backyard Moves(87) >= 4(T) AND Mode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 11:02:19.368infoTriggered: Variable reported Backyard Moves(87) *increased*
app:19992023-07-24 11:02:19.334infoEvent: 1511 Palmyra Avenue variable:Backyard Moves 87
app:19992023-07-24 11:02:16.482infoAction: END-IF
app:19992023-07-24 11:02:16.479infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 11:02:16.476infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 11:02:16.468infoAction: IF (NOTMode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 11:02:16.466infoAction: ELSE (do actions)
app:19992023-07-24 11:02:16.463infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 11:02:16.447infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 11:02:16.444infoAction: Wait for Expression: Screen Door, Sliding Door all contact closed(F) AND Yamaha Receiver (porch)(on) is on(T) AND Back Porch Interior Motion motion inactive(F) [FALSE] --> duration: 0:02:00 (skipped)
app:19992023-07-24 11:02:16.425infoAction: On: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 11:02:16.423infoAction: IF (Yamaha Receiver (porch)(on) is off(F) AND Variable Backyard Moves(86) >= 4(T) AND Mode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 11:02:16.399infoTriggered: Variable reported Backyard Moves(86) *increased*
app:19992023-07-24 11:02:16.378infoEvent: 1511 Palmyra Avenue variable:Backyard Moves 86
app:19992023-07-24 11:02:15.238infoAction: END-IF
app:19992023-07-24 11:02:15.235infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 11:02:15.232infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 11:02:15.221infoAction: IF (NOTMode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 11:02:15.213infoAction: ELSE (do actions)
app:19992023-07-24 11:02:15.210infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 11:02:15.201infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 11:02:15.198infoAction: Wait for Expression: Screen Door, Sliding Door all contact closed(F) AND Yamaha Receiver (porch)(on) is on(T) AND Back Porch Interior Motion motion inactive(T) [FALSE] --> duration: 0:02:00 (skipped)
app:19992023-07-24 11:02:15.178infoAction: On: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 11:02:15.175infoAction: IF (Yamaha Receiver (porch)(on) is off(F) AND Variable Backyard Moves(85) >= 4(T) AND Mode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 11:02:15.153infoTriggered: Variable reported Backyard Moves(85) *increased*
app:19992023-07-24 11:02:15.132infoEvent: 1511 Palmyra Avenue variable:Backyard Moves 85
app:19992023-07-24 11:02:14.914infoAction: END-IF
app:19992023-07-24 11:02:14.911infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 11:02:14.908infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 11:02:14.897infoAction: IF (NOTMode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 11:02:14.887infoAction: ELSE (do actions)
app:19992023-07-24 11:02:14.884infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 11:02:14.871infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 11:02:14.868infoAction: Wait for Expression: Screen Door, Sliding Door all contact closed(F) AND Yamaha Receiver (porch)(on) is on(T) AND Back Porch Interior Motion motion inactive(T) [FALSE] --> duration: 0:02:00 (skipped)
app:19992023-07-24 11:02:14.835infoAction: On: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 11:02:14.831infoAction: IF (Yamaha Receiver (porch)(on) is off(F) AND Variable Backyard Moves(84) >= 4(T) AND Mode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 11:02:14.790infoTriggered: Variable reported Backyard Moves(84) *increased*
app:19992023-07-24 11:02:14.691infoEvent: 1511 Palmyra Avenue variable:Backyard Moves 84
app:19992023-07-24 10:59:53.549infoAction: END-IF
app:19992023-07-24 10:59:53.543infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:59:53.541infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 10:59:53.530infoAction: IF (NOTMode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 10:59:53.518infoAction: ELSE (do actions)
app:19992023-07-24 10:59:53.515infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 10:59:53.504infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:59:53.501infoAction: Wait for Expression: Screen Door, Sliding Door all contact closed(F) AND Yamaha Receiver (porch)(on) is on(T) AND Back Porch Interior Motion motion inactive(F) [FALSE] --> duration: 0:02:00 (skipped)
app:19992023-07-24 10:59:53.472infoAction: On: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:59:53.469infoAction: IF (Yamaha Receiver (porch)(on) is off(F) AND Variable Backyard Moves(83) >= 4(T) AND Mode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 10:59:53.440infoTriggered: Variable reported Backyard Moves(83) *increased*
app:19992023-07-24 10:59:53.415infoEvent: 1511 Palmyra Avenue variable:Backyard Moves 83
app:19992023-07-24 10:59:51.891infoAction: END-IF
app:19992023-07-24 10:59:51.888infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:59:51.868infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 10:59:51.864infoAction: IF (NOTMode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 10:59:51.843infoAction: ELSE (do actions)
app:19992023-07-24 10:59:51.841infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 10:59:51.833infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:59:51.829infoAction: Wait for Expression: Screen Door, Sliding Door all contact closed(T) AND Yamaha Receiver (porch)(on) is on(T) AND Back Porch Interior Motion motion inactive(F) [FALSE] --> duration: 0:02:00 (skipped)
app:19992023-07-24 10:59:51.793infoAction: On: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:59:51.790infoAction: IF (Yamaha Receiver (porch)(on) is off(F) AND Variable Backyard Moves(82) >= 4(T) AND Mode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 10:59:51.761infoTriggered: Variable reported Backyard Moves(82) *increased*
app:19992023-07-24 10:59:51.729infoEvent: 1511 Palmyra Avenue variable:Backyard Moves 82
app:19992023-07-24 10:59:49.364infoAction: END-IF
app:19992023-07-24 10:59:49.362infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:59:49.359infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 10:59:49.349infoAction: IF (NOTMode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 10:59:49.342infoAction: ELSE (do actions)
app:19992023-07-24 10:59:49.339infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 10:59:49.328infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:59:49.325infoAction: Wait for Expression: Screen Door, Sliding Door all contact closed(F) AND Yamaha Receiver (porch)(on) is on(T) AND Back Porch Interior Motion motion inactive(T) [FALSE] --> duration: 0:02:00 (skipped)
app:19992023-07-24 10:59:49.294infoAction: On: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:59:49.291infoAction: IF (Yamaha Receiver (porch)(on) is off(F) AND Variable Backyard Moves(81) >= 4(T) AND Mode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 10:59:49.263infoTriggered: Variable reported Backyard Moves(81) *increased*
app:19992023-07-24 10:59:49.237infoEvent: 1511 Palmyra Avenue variable:Backyard Moves 81
app:19992023-07-24 10:56:35.620infoAction: END-IF
app:19992023-07-24 10:56:35.614infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:56:35.611infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 10:56:35.599infoAction: IF (NOTMode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 10:56:35.591infoAction: ELSE (do actions)
app:19992023-07-24 10:56:35.588infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 10:56:35.579infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:56:35.575infoAction: Wait for Expression: Screen Door, Sliding Door all contact closed(F) AND Yamaha Receiver (porch)(on) is on(T) AND Back Porch Interior Motion motion inactive(F) [FALSE] --> duration: 0:02:00 (skipped)
app:19992023-07-24 10:56:35.537infoAction: On: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:56:35.533infoAction: IF (Yamaha Receiver (porch)(on) is off(F) AND Variable Backyard Moves(80) >= 4(T) AND Mode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 10:56:35.491infoTriggered: Variable reported Backyard Moves(80) *increased*
app:19992023-07-24 10:56:35.447infoEvent: 1511 Palmyra Avenue variable:Backyard Moves 80
app:19992023-07-24 10:56:32.604infoAction: END-IF
app:19992023-07-24 10:56:32.601infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:56:32.598infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 10:56:32.589infoAction: IF (NOTMode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 10:56:32.582infoAction: ELSE (do actions)
app:19992023-07-24 10:56:32.580infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 10:56:32.572infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:56:32.569infoAction: Wait for Expression: Screen Door, Sliding Door all contact closed(F) AND Yamaha Receiver (porch)(on) is on(T) AND Back Porch Interior Motion motion inactive(F) [FALSE] --> duration: 0:02:00 (skipped)
app:19992023-07-24 10:56:32.549infoAction: On: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:56:32.546infoAction: IF (Yamaha Receiver (porch)(on) is off(F) AND Variable Backyard Moves(79) >= 4(T) AND Mode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 10:56:32.519infoTriggered: Variable reported Backyard Moves(79) *increased*
app:19992023-07-24 10:56:32.493infoEvent: 1511 Palmyra Avenue variable:Backyard Moves 79
app:19992023-07-24 10:56:31.181infoAction: END-IF
app:19992023-07-24 10:56:31.179infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:56:31.176infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 10:56:31.166infoAction: IF (NOTMode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 10:56:31.159infoAction: ELSE (do actions)
app:19992023-07-24 10:56:31.157infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 10:56:31.148infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:56:31.146infoAction: Wait for Expression: Screen Door, Sliding Door all contact closed(F) AND Yamaha Receiver (porch)(on) is on(T) AND Back Porch Interior Motion motion inactive(T) [FALSE] --> duration: 0:02:00 (skipped)
app:19992023-07-24 10:56:31.126infoAction: On: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:56:31.123infoAction: IF (Yamaha Receiver (porch)(on) is off(F) AND Variable Backyard Moves(78) >= 4(T) AND Mode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 10:56:31.098infoTriggered: Variable reported Backyard Moves(78) *increased*
app:19992023-07-24 10:56:31.076infoEvent: 1511 Palmyra Avenue variable:Backyard Moves 78
app:19992023-07-24 10:55:13.187infoAction: END-IF
app:19992023-07-24 10:55:13.184infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:55:13.181infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 10:55:13.169infoAction: IF (NOTMode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 10:55:13.166infoAction: ELSE (do actions)
app:19992023-07-24 10:55:13.146infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 10:55:13.131infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:55:13.128infoAction: Wait for Expression: Screen Door, Sliding Door all contact closed(F) AND Yamaha Receiver (porch)(on) is on(T) AND Back Porch Interior Motion motion inactive(F) [FALSE] --> duration: 0:02:00 (skipped)
app:19992023-07-24 10:55:13.095infoAction: On: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:55:13.092infoAction: IF (Yamaha Receiver (porch)(on) is off(F) AND Variable Backyard Moves(77) >= 4(T) AND Mode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 10:55:13.063infoTriggered: Variable reported Backyard Moves(77) *increased*
app:19992023-07-24 10:55:13.025infoEvent: 1511 Palmyra Avenue variable:Backyard Moves 77
app:19992023-07-24 10:55:03.778infoEvent: 1511 Palmyra Avenue variable:Backyard Moves 76
app:19992023-07-24 10:55:03.708infoAction: END-IF
app:19992023-07-24 10:55:03.705infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:55:03.702infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 10:55:03.689infoAction: IF (NOTMode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 10:55:03.680infoAction: ELSE (do actions)
app:19992023-07-24 10:55:03.677infoAction: Set Backyard Moves to 0 (skipped)
app:19992023-07-24 10:55:03.631infoAction: Off: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:55:03.628infoAction: Wait for Expression: Screen Door, Sliding Door all contact closed(T) AND Yamaha Receiver (porch)(on) is on(T) AND Back Porch Interior Motion motion inactive(F) [FALSE] --> duration: 0:02:00 (skipped)
app:19992023-07-24 10:55:03.589infoAction: On: Yamaha Receiver (porch) (skipped)
app:19992023-07-24 10:55:03.584infoAction: IF (Yamaha Receiver (porch)(on) is off(F) AND Variable Backyard Moves(76) >= 4(T) AND Mode in [Day, Evening, Quiet Morning, Early Bird, Party](T) [FALSE]) THEN (skipping)
app:19992023-07-24 10:55:03.554infoTriggered: Variable reported Backyard Moves(76) *increased*
app:19992023-07-24 10:55:03.505infoEvent: 1511 Palmyra Avenue variable:Backyard Moves 75
app:19992023-07-24 10:55:01.393infoEvent: 1511 Palmyra Avenue variable:Backyard Moves 74

First, screenshots of the logs are the preferred way to post logs, much easier to follow.

From looking at the logs you posted the first thing you rule checks is if the Yamaha receiver is off, which it is not for the time of the logs you posted so it goes to the ELSE.

Then it looks for the mode not to be any you listed which is again false and the rule skips over turning off the receiver. So in every instance it triggered, it did nothing.

1 Like

Apologies about the method posting the logs, noted and will do it the other way next time.

And yes - I think it's performing correctly in this regard when it is triggered (by either an increase in movement or a mode change), but I'm curious why the 'wait for expression' never seems to be coming into play. I mean to say that I understand it isn't true in this case, but I don't understand why it's not turning off after 2 minutes of doors closed and no motion. I would think the rule is triggered (true) to start the process, then would wait until then. Is every re-trigger killing that wait?

Because the receiver is on so it is skipped.

IF (Yamaha Receiver (porch)(on) is off(F) AND Variable Backyard Moves(76) >= 4(T) AND Mode in Day, Evening, Quiet Morning, Early Bird, Party [FALSE]) THEN (skipping)

2 Likes

When the rule first runs with Receiver off, Variable >= 4, and correct Mode it'll turn on the receiver then enter the wait. The next time it's triggered the Receiver is on and will fail the IF-THEN condition; however, the Wait will be canceled automatically by the retrigger. I think this should work using the existing triggers.

IF (Receiver is off AND Variable >=4 AND Mode in [Day,, Evening, ...] THEN
    ON: Receiver
ELSE-IF (NOT Mode in [Day, Evening, ...] THEN
    OFF Receiver
END-IF
Wait for Expression: ... all contacts closed AND ... motion inactive --> duration: 0:20:00
Off: Receiver
Set Variable to 0

Note that Receiver was removed from the Wait

1 Like

Ah, ok that makes sense. I'll adjust the other rule that adds to the count and have it stop adding if >= 4, which won't retrigger this one and test.

fun fact, the increase has been interesting - some days it's in the hundreds if we have a party or something. Crazy how busy the network can be during things like that with all the doors and motion... no wonder batteries can't keep up sometimes.

Edited my response to make it work with increasing variable but preventing it from increasing in addition to my new suggestion should work just fine.

oh I like your option better - not sure why it's never occurred to me to add the wait for expression at the end and outside of the if-then statement.

FWIW I just edited the other movement rule to no longer increase if at 4 and then had the trigger on this rule changed from "*increased" to "=4" and everything worked as well.

Thanks to all of you for the help!!

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