Triggering problem among others

One trigger to kick it off, set your first dim over time, next line wait for condition (final dim level of 1st dim over time), next line dim over time, then wait for condition,.....
This way its only processing one part of the rule, using delay for all those events it queuing everything up for no good reason

These are all separate rules in my opinion. Might even be able to do them with Simple Automations app in some cases.

There are also IF statements being duplicated.
Let say it's 8:00.
Trigger becomes true and we evaluate the rule.
The first IF it comes to is Time between 8:00 and 8:10.
Lets ignore the other times the are 'OR'd.
The first IF - THEN it hits re-evaluates the time again.
This means the group of times at the top that are OR'd are pointless.
I'm not saying this is the route of the problem but IMHO it's just overly complicated.

Just my opinion and it's time to duck out of this now.

1 Like

Out of curiosity, which IF is that ELSE-IF at the bottom binding to? Looks like the End-IF above it closes off your first IF statement. (I could certainly be reading it incorrectly.)

1 Like

My main aim up to now has been to get something to work, the current script is the first of these 6 that has got close.

Again what I'm trying to achieve is turning lights on/off, up/down, basic stuff for any automation system. There are probably many ways to achieve what I'm trying to do, unfortunately there seems to be a problem with triggers not firing that's thrown a spanner in the works, now I have a working version it gives me the opportunity to tweak and get something that works and can be forgotten about

I had to add something at 1am because the lights kept coming on, even after I manually turned them off, it should be an else if to the first if, haven't checked the syntax and it may be wrong, but the lights stayed off :grin:

How did you determine that?

I don't know how else I can say this, your rule is just not good, and with how you have it written, there is almost no hope to tell where the issue happens. There have been what, 4-5 of us on this thread that have tried to tell you this.

Why the reluctance to just divide this into a few simpler rules? One super complex rule is not better in any way than a few simpler ones. This is everyone's advice on this thread and in general when dealing with rules.



This is the 6th version of the rule, the early versions were basic "if time = x then light on, else if time = y then dim light etc etc." They also had a number of time triggers.

Logically when the time became the same as a trigger the script ran and the relevant if or else if run. Except they didnt, anywhere up to a qtr of the trigger times did not trigger the rule, that to me suggests there is a problem with triggers, especially if there is quite a few of them.

As for the current script, it may not be perfect, but it works, the lights come on, fade up/down and go off at the times programmed, over the weekend I will play with it and clean it up, but in the meanwhile it works, which is all I want it to do.

Tried simple, in fact 5 lots of lights in the room are controlled by simple lighting scripts. The current script is effectively several simple if this then that rules all tucked into one rule.

Mind posting a screenshot of the rule you ended up settling on?

It's in the post above, although I removed the erroneous end if

The complexity is due to it checking to see if the previous trigger had fired. What people seem to be missing is I know what the problem is/was. It's very simple and its mentioned throughout my posts and it's even in the subject of the post. Triggers have repeatedly failed to fire the script, i have to reduce the number of triggers, which means writing multiple rules or writing a slightly more complex rule.

Compared to some of the rules I run this is, as Americans would state, kindergarten stuff, there is no noticable slowing of the hub, in fact the script is parsed in less than a second.

Earlier, far less complex rules, were parsed in far less than a second, WHEN IT WAS TRIGGERED, obviously it took no time whatsoever when the trigger failed, which unfortunately is the problem.

There was and is absolutely nothing wrong with any of the code (other than the erroneous and now removed End If) Multiple Triggers are the problem and I, for one, dont want 10 scripts just to turn lights on and off and fade up and down (see my second/third post showing screen shot of 5th version with the triggers, the rule should of worked, if the trigger, I.e. time of day, had fired which it didnt do for 25% of the time.

Once again, how did you determine that? The rule not working does not prove triggers didn't fire. It proves the rule didn't work and nothing more. The cause could be anywhere within the rule.

You have repeatedly said this, and we have read and understand what you are saying, but we believe you are looking at the wrong thing here. How do you know it is a trigger problem vs just a badly written rule that is bombing out partway through? You insisting so doesn't make it true.

You are going to have to break this into smaller parts to see what is failing, and why. At least start with small rules and combine them after they all work IF you really have to for some reason.

In your opinion. And maybe there isn't. But in my and others opinions, there is something wrong, mainly the complexity of all those dozens of nested statements.

With the way you wrote this rule, good luck trying to find the error. You haven't even provided screenshots of logs. That "log" above doesn't even show triggers, for example. Cut and paste doesn't work for this purpose. You MUST turn on full logging, run the rule, and see what happens.

Break the darn rule into small sections so that you and we can diagnose it. Who cares if you have 100 small rules if they all work vs one large one that fails. One part of this could be wrecking everything and we have no idea where or how it failed. Again, you show no logs to prove either you or us correct.

So try for a 7th that still doesn't work?

You are smashing your finger with a hammer, saying OUCH, and then hitting it again, and again, and again. At some point stop hitting your finger !

If that rule is simple, I would hate to see complex!


I determined that it was the triggers from the first 5 versions of the rule were time based triggers did not fire the rule.

Were because of the number of triggers the rule wouldn't clone and provide update or run rule buttons and if you tried to run the cloned rule you got Java errors.

What you are all fixating upon is the 6th quick and dirty version of the rule which actual works.

The earlier versions were no where near as complex they were simple

When time is 8am
When time is 8:30
When time is 9am

If time = 8am then dim fishroom light one 5
Else if time = 8:30 then dim fishroom light two 5
Else if time = 9am then dim fishroom light three 5

Now if the script didnt run at 8, 8:30, 9, 9;30, 10 and only fired at 11am on such a simple if end if list what would you consider as the problem, when the rule would only clone successfully when you removed the triggers, again what would you think was the problem.

Stop fixating on the last rule WHICH WORKS and consider that I know what I'm doing.

As for rule 6 being complex I dont see how nested if's are complex, obviously you learnt coding differently then me,

glad to :ear: its working now