Delay, Light, Power : Suggestion Needed

Hello,

I have this rule that is working but not flawlessly. Maybe a new pair of eyes could help me.

Goal:
The goal is that when there is motion, the light open or remain open.
If there is NO motion BUT the TV is open to keep the light open (it means we are doing stationary bike). If there is no motion and TV is close, it should close after the delay of 10 minutes.

Problem:
The light turn off once in a while. I haven't pinpointed the issue, but sometimes I am on the bike, TV is on and the light turns off.

Code:

Any suggestion?

Not sure that it helps, but when do you turn on the TV?
Are you stationary at the bike that time? So that the motion sensor might have become inactive already, and by that you don't inactivate the timer?

Also, what if you are to fast so that the corridor sensor still is active?

(these answers obviously depends on for how long the sensors stays active after movement, I use Aqara, and they seems to be active about a minute)

BR
Reine

Also 2 questions.
Why is you ON a custom command?

You can slightly remove some complexity to the rule by combining the 2nd IF with a AND

IF (ceiling light is ON AND power level of TV is <=10) THEN
Turn off with delay.

This I believe is the main issue, I think also @mrdesjardins you don't quite understand how rules run, your 99% there though.
I would make a few changes.

1st how chatty is the TV power reporting? If it only report's on certain changes, then perfect.

Trigger
TV power changed <=20
Motion changes.

Actions

Cancel delayed actions
IF(motion inactive) THEN
   IF( light is ON AND TV level is <=10) THEN
    OFF light
   END IF
ELSE IF (light is OFF) THEN
ON light
END IF

Not sure that it helps, but when do you turn on the TV?

@reine.edvardsson I sit on the bike and turn the TV on. So, the complete sequence is 1) open the garage door to get into the garage from inside. Walk about 15 feet, sit on the bike, use the remote to turn the TV on.

Are you stationary at the bike that time?

Yes I can be sitting for 30 minutes

So that the motion sensor might have become inactive already, and by that you don't inactivate the timer?

Yes, when training it gets inactive. However, during the day when I just get into the garage to pick up something the light open and I leave before the 10 minutes.

1st how chatty is the TV power reporting?

The TV powering is pretty good. It goes between 35-55. So the 10 in the rule give plenty of room.

Why is you ON a custom command?

Good question, let me change that to switch on. Probably an experimentation that remained.

1 Like

I have modified from the suggestions and will give a try soon! Thanks and lets hope I won't train in the dark :smiley:

1 Like

You need to add the other trigger of TV power value <=20.

Edit:

Actually if we do this we are going to need to move the cancellation again, because otherwise each time the TV changes it will stop and start the delay again. Need to think about that :thinking:. Definitely put one after the ELSE (for motion active)

Edit 2:
After the IF motion inactive THEN
Add a simple condition of
IF(power level is >10 ) cancel delayed actions.

little off-top, how You managed to create such complicated program using this interface? xD

Add a simple condition of
IF(power level is >10 ) cancel delayed actions.

Is this required since the first line is to Cancel Delayed Actions?

I was under the impression that from this thread one of the main changes was to always cancel the action (the 10 minutes ceiling light) when the motion sensor change.

little off-top, how You managed to create such complicated program using this interface? xD

Well, it's under 20 lines. I hate the interface but we need to work with what Hubitat offers us... I could really be 10x faster by writing commands down instead of juggling with all these combo boxes :laughing:

This would need to be removed.

Yes that's correct, but due to you needing to have the TV power also within the trigger (due to some edge case possibilities) that inturn created some edge cases that I missed. So you don't want it to cancel no matter what but you do want it to cancel on both sides of the IF. You have one on the ELSE as you always want it to cancel on active, but on inactive you only want it to cancel if the TV is above 10

1 Like