My rule to turn off my light didn't work last night; how do I debug?

I have a smart plug and a dumb lamp, and it's connected by Zigbee to the hub. It's been working for a couple weeks, but I had this experience recently where it didn't turn off at 10pm like I expected it to.

How do I even go about debugging something like this? Is it the Zigbee connection, or something else? Please advise.

Some basic things to check would be the logs on the hub and the events for the device.

What are you using to turn the plug off? RM or one of the other RM-like apps? Could your hub have been restarted mud-rule?

Thanks. I used the Basic Rules app to make the rule. Is that what you mean?

I tried to check the logs but I guess I didn't know the right place to look. I found the log of the smart plug, but it just .... has a void. The only entry in the log is "physical turn off" or something like that, when I clicked it off myself.

Yes. Could you post a screenshot of the rule?

The text of the rule is this:

When Time of Day is 30 minutes before sunset ...
Turn on Family Room lamp
Wait until Time of Day is 10:00 PM, then ...
Turn off Family Room lamp

It was working previously. Does that give any clues?

Could the hub have been restarted between the lamp being turned on and 10pm?

It's definitely possible. I remember I installed an update, but don't remember when. It could have been during that time.

Perhaps I should split it into two rules, to avoid this issue?

If only as an exercise in knowing how to work this out, if you check the logs section of the web Ui there is a tab that includes hub events like this, it may be worth familiarising yourself with that.

With such a (potentially) long time between triggering and 10pm, it is probably a good idea. Certainly not to say never use wait's, but maybe just for shorter windows of time.
EDIT: This is not entirely true, see my post below

Looks like I am wrong about the potential for a reboot to affect your use of a wait, unless you were rebooting at 10pm.

There must be something else going on ... If you didn't reboot at 10pm

This document might help: https://docs.hubitat.com/index.php?title=How_to_Troubleshoot_Apps_or_Devices.

But since we have a few more details now than in the original post, I might try two three things:

  1. Just open the Basic Rule you created and hit Done to re-initalize things (note that this will cancel the wait--i.e., it won't turn off at 10 PM until it starts over again, which looks like sunset-30 for you, so maybe wait until sometime that isn't between these two times if you want to test the 10 PM thing).
  2. Check the App Status (gear icon) page, particularly the "Event Subscriptions" and "Scheduled Jobs" sectoion. In your case, it looks like you should see a scheduled job for either sunset-30 or 10 PM, depending on when you look.
  3. Make sure your time and location (which are used to calculate sun times) are correct in Settings > Hub Details.
1 Like

You could also check you system settings to ensure that your timezone is set properly.

http://hubitat.local/hub/details

I made a similar rule and found that the Wait didn't schedule correctly.

image

The Scheduled Jobs section was captured around 9:01

I just tried it and it did work for me on platform version 2.3.2.139. Are you on that same version?

Rule:
image

Jobs scheduled prior to them running:

Jobs scheduled after they ran:

1 Like

Currently running version: 2.3.2.139

2.3.2.139 for me

I recreated this rule two more time and both are scheduling the Waits correctly. Not sure why the first one didn't work. @user1378 for testing purposes, can you change your On and Wait times to see if it schedules everything correctly? Make sure logging is on.

1 Like

It happened again tonight. I captured the log:

Does this reveal anything?

Sunset was 8:25, and I clicked it on manually at 8:37.

Unfortunately it probably doesn't, at least not for me...

It's certainly odd that turning the lamp on manually worked but the rule didn't. If you physically turned the lamp on and there was no log of that I would suspect communication issues with the device and HE, but the fact you see the manual turning on recorded, that kind of puts that in doubt.

If you open the device edit page in HE (TIP - access this by clicking the INFO icon / text in the logs), do you see the Basic Rule in the In Use By section at the bottom? Not expecting this to be the issue...

Can't believe I didn't ask earlier, but what driver are you using for the device?

Have you tried working through @bertabcd1234 's notes above?

Only other suggestion I can think of would be to try creating it in RM and see if it behaves any differently.

Instead of #1, I rephrased the rule as two separate rules (one to turn on and one to turn off), based on someone else's suggestion.

For #2 the Events tab shows an empty table when I click the gear next to my rules or the gear next to Basic Rules (at the top). Is that expected?

Re #3 - I did verify that the date/time are correct. This makes sense because usually, the rules work properly.

The driver is the "Generic Zigbee Outlet".

Regarding the communication issues: when I say "manually turned it on", I mean that I clicked the physical button on the device, not through the app. That being said, I am also able to toggle it via the app (if I click "On" or "Off" from the device page, it responds).

edit: I'm wondering if there could be some intermittent zigbee connectivity problem? If there is, how would I diagnose that?