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

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:

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.


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


The Scheduled Jobs section was captured around 9:01

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


Jobs scheduled prior to them running:

Jobs scheduled after they ran:

1 Like

Currently running version: 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?

That's fine, but note that it should not have an impact on the outcome--a reboot does not cancel scheduled jobs. (They will be missed if the hub is off at the exact time it was scheduled to run, perhaps because it was rebooting at that moment, this is otherwise not a concern.)

Yes, most apps do not log events. If apps log something, it is generally to "Logs," and normally you have to enable an option in the app to make that happen.

As for why this particular automation isn't working, I don't know. It looks right. You could try creating a new instance and removing this one, just in case something got corrupted, or perhaps you could try a different app in case you've stumbled on an odd bug. What would be good to know is whether the app is executing the command on the device or not, or if the device is indeed having the command run but simply not responding to it. From your logs a couple posts above, I don't see anything to suggest the app is sending the command (this would be an "app:" log, not a "dev:"/device log, and only if the app has logging enabled--which it appears you do?). If it is the latter, that could indeed be a Zigbee network problem, but I'm not sure it looks like that. If it is, there are some diagnostic tools built-in, but the best approach is generally just to make sure you have a good network with enough repeaters and no "problem devices" like many brands of smart bulbs.

Follow-up: I am mostly certain that the problem is with the zigbee communication of the smart outlet, either because the signal strength is bad or because the outlet itself behaves poorly.

I plugged another Sonoff S40 Lite smart outlet (named "Living room outlet") in between my hub and the lamp I'm trying to control. It appears to have become a relay, like you might expect:

Parent child parameters
EzspGetParentChildParametersResponse [childCount=0, parentEui64=0000000000000000, parentNodeId=65535]

Child Data

Neighbor Table Entry
[Living room outlet, 6B5F], LQI:234, age:3, inCost:5, outCost:1
[Family Room lamp, 7BE8], LQI:253, age:3, inCost:3, outCost:0

Route Table Entry
status:Active, age:64, routeRecordState:0, concentratorType:None, [Family Room lamp, 7BE8] via [Living room outlet, 6B5F]

Since that time, the lamp has been more reliable about turning on and off. Unfortunately, I'm not sure whether the problem is "real" or because of hardware glitching, but honestly I'm not sure how to distinguish between the two.

1 Like

I would say the problem is real and if i am reading that table right related to the very few devices you have for zigbee to route through. In many cases having several devices for either zwave, or zigbee can enhance routing options and will improve reliability. The moure routing devices you have scattered the better.

That stinks for folks just getting started but is unfortunately a result of using low powered devices with tiny radios and anttennas.

1 Like

Right now I only have two Zigbee devices, and they're both routers. Nothing is battery powered yet. I wanted to have a "proof of concept" before doing more.