Rule machine issue

I have been using these Rule machine switches (sleep timers, I have a 15,30,60 and 2hrs) for about 3 years now. I moved from my c5 to a c7 and ever since I have been having many issues other than the sleep switches. I moved from c5 to c7 about 8 months ago and just in the last few weeks these timers quit work properly. The TV box will not turn off and every once in a while something else on the list will not shut off. Here is the set up. Remember, this has worked for years and...... I also tried replacing the switch to the tv box. I think it's an update that has caused this issue. I do put in every update. Oh yeah I forgot, I backup the firmware to about 2 month ago and it worked for a while and about 3 weeks ago I updated back to the newest. Thank you for your help! One other piece of info. I change the delay to 20 secs and it works every time.

When you say you change the delay to 20 seconds which delay?

What kinds of switches are these? If they're z-wave can you post a screen shot of your z-wave details?

FYI I think you could simplify the rule by simply changing the trigger to "60 min TV sleep button turns off and stays off for 60 min"

Turn on the rule logging and post the results.

I have looked around, Not seeing logging for rules.. Can you tell me how to do this?

See Rule 5.1 | Hubitat Documentation

At the bottom of the main page for your rule...

1 Like

I just turned on the logging. I made a change and it seems to work now. Here are the changes. I put the virtual button off outside the first loop.

Using the changed I think you're going to get some weird multiple triggering of the rule. Since you're already filtering out the off events, I think you can remove offs from the trigger. Additionally, if you happen to turn the Sleep button on then off then on again within the 1:00:20 delay I don't think you'll get the desired response. I'd change the trigger to turns on and change the Delay to Wait for Sleep button to turn off with a timeout of 1:00:20. You could then eliminate the first IF-THEN completely.

2 Likes

The virtual button is pushed, it stays on. I have it so if I decide to go with the 2 hours, it will cancel this by hitting the button again and shutting it off, it will keep everything on after the timer runs out.

1 Like

Why would the Changed cause an issue? The virtual button is pushed on the dashboard as I go to bed. It doesn't get hit but once and the ability to cancel it is available if I hit the button again. Am I thinking wrong?

The conditionals in your rule all test for the button to be turned on. There's no condition other than "on" so why not just change the trigger event to "on"? You could then get rid of your first IF altogether and the rule will not run again if the button is off.

1 Like

Unlike a Switch, which normally changes state (to On or Off) and remains there, a Button is temporary in nature (Depressed, then immediately Released), so we say it was "Pushed". The concern here is that by using "Changed" you're effectively asking the Rule to evaluate two events in rapid succession. I'd go with "Button N Pushed" as the Trigger.

Of course, if you've simply named a device "Button" when it's actually a Switch, my comments here don't apply. :wink:

2 Likes

But if the device is actually a button then I don't understand the 2nd IF... since you would have to press and hold it when the delay timer passed 1:00:20.

Maybe the device is actually a switch?

1 Like

Yes, it's a switch. I think i called it a button because it like a button on your screen. You press it. Just didn't name it correctly.

1 Like

You have a delay nested in your rule. If the rule is triggered multiple times the rule could generate a multiple instance error. General advice is to write the rule to prevent nested delays. Since you're not using the off events for anything, changing the trigger to on allows you to remove the first IF-THEN and then no more nested delay. But I think your delay could be a problem and should be cancelable with a corresponding Cancel Delayed Actions or just make it a Wait.

For example, you trigger the rule at 10:00. The delay is scheduled to end at 11:00:20. At 10:05 you decide to cancel the rule and hit the button again. The delay is still scheduled. At 10:45 you trigger the rule again. Your previous delay will still execute at 11:00:20, 45 minutes before you were expecting it to. I don't know your use case and if it's actually going to happen but the way the rule is written this could happen.

I rewrote the rule per advice and this is what I have. Totally did not work. TV Box Stayed on again! I am starting to think the C-7 box I have is bad. My C-5 never had issues like this and most of my virtual switches are not working. I have a mailbox switch that doesn't work now as well. I put my c-5 back for a day and everything worked like a charm. What is the difference between them? Do I have a bad box?

1 Like

What device is it that actually turns on and off the tv box? Is it a zigbee outlet? Can you turn logging on and let the rule run the full hour and see what the logs show? And does the TV box device turn on and off reliably from the devices page?

1 Like

Its a sonoff basic programmed with Tasmota. I changed out the switch thinking it might be intermittent. I just turned on logging. Took me a while to figure that out. Where can I view the logs? The log button, there are so many options and I cant make heads or tails out of what I am looking at.

The bottom of the menu is the Logs page. Check out the Live logs (real-time) or Past logs

1 Like

Last night it failed to turn off the tv box again. I hit the button again, and 1 hour later it worked. What can be causing it to be intermittent? I am thinking my hubitat has something wrong with it.