Issues with timed actions


Recently I'm having trouble with some rules and timed actions.

This rule had been working for over a year and recently it stopped working properly. As you can see it should activate a certain scene during the daytime (0:600 and sunset-140) and another scene when the evening starts(sunset-140 and 19:30) but they are both set to TRUE. which is wrong because the current time on the hubitat is set to:

I did add a second hub on the second floor recently and connected it through Mesh checked the timezone on that device and it is set to the correct one.

I have similar issues with other rules as well. What am I doing wrong ? Tried turning it off and on again. Updated the rules. All to no avail. Any input would be helpful !

Which HE platform version and which version of RM are you using?
(For RM version, the Apps page will show in the "type" column for the rule something like "Rule-4.0", "Rule-5.1", etc.)

I'm using HE platform version on hardware revision C-7 and RM Version 1.0.3 (2/28/2022) The type column shows "Rule-5.0" as shown below

BTW checked it again after 19:30 and the first timed condition is now set to false so that is working correctly. Something goes sour with the second timed condition as it is still on TRUE and it is after 19:30 now.

I seem to recall there were some sunset related bugs in Rule-5.0; You might try testing with a new Rule to see if the issue is resolved in the newer Rule-5.1.

@bravenel Could probably say for sure if this is a known issue or not. :slight_smile:

1 Like

As we approach the summer solstice, and sunset is later, I must ask-- What time is your sunset? Is it possible that the (sunset - 140) is after 19:30, in which case you'll run the second IF block rule pretty much most of the time?


@jpcurcio nailed it! Sunset was 21:51 so Sunset-140 minutes is 20:11. The second IF-THEN would evaluate as True from 20:11 until 19:30 the next day. It is possible that both evaluating True was correct.

@jpcurcio YES ! sunset is at 21:53 today. Damned, of course. I did not take that into account and feel stupid now ! In my defence just became a father for a second time so I have been on little sleep lately. Not the sharpest knife in the drawer atm lol.

Thanks a lot for the help all ! Good stuff

One other thing, if I may, regarding style. You have five single "if" statements, which means that every time this rule is triggered, it will execute them all. I find it much cleaner and easier to understand if these are done in a single, nested if-then-else statement (this also eliminates the need to do an AND in the Boolean check). This way, the most comparisons made will be three, and you won't have to test as much since the "else" is only run if the "if" fails. The other thing is that it can guarantee (with proper consideration) that the situation you saw here with sunset doesn't happen.

For instance, this would be my take on re-coding to avoid this situation... (any typos are mine!)

IF (Zithoek Palfond is on) THEN
  IF (Time between 19:30 and 06:00) THEN
    Activate scenes: Avond
  ELSE-IF (Time between 06:00 and Sunset-140 minutes) THEN
    Activate scenes: Zithoek Overdag
    Activate scenes: Avond Start
  Off: Zithoek
  IF (Time between 19:30 and 06:00) THEN
    On: Transition Stop
    Off: Keuken, Eethoek
1 Like

Nice one,

To be honest I switched from HA to Hubitat in one weekend last year and just went with it. Never read a manual for any of it. Which in itself says a lot about the ease of use of Hubitat and my lack of coding skills. Though it has been working for me quite well so far lol.

But indeed I had some issues with some of my automations in the "to be solved category" which can be attended to in the manner you described.

Looking at your comments it might be time to read up on stuff. Thanks for the heads up !