Rule stopped working

Dear Kees. I had sometimes strange error messages with rules as well. Try renaming the rule file garage.rules -> garage.test and back again…

Thank you, i will give that a try, although the rule does run and the timer is created, it just crashes on the sendmail.

Sadly that wasnt the solution either

Yes, that’s correct. however, you could change the two trigger lines to one simple line.

Item Garage_Door changed

would fit, as the Item shouldn’t change to a state other than OPEN or CLOSED, should it?
But this wouldn’t solve the problem. I can’t see any typo and nor does the designer itself.

indeed, I tried several changes in that section, but the code runs undisturbed till after the timer is created and then crashes on the sendMail. Can’t figure it out. I know one can get that message if there is an undefined state, like right after start up, but that’s also not the case.
Really have no idea what is wrong

The last thing to try is, to write down the rule in a new rule file (don’t copy and paste though but do it manually!!!)

I had been thinking about that. Weird as it is.
I already tried pasting it in a simple straight text editor, hoping to get rid of any stray characters (in case that would be the issue), but that didnt help. I will give it a try.

Sadly, same problem

This rule works without problems:

var Integer RandomInterval = (Math::floor((Math::random * (25) + 5).doubleValue).intValue)
rule "General - lightsoff"
when
Time cron "0 29 22 1/1 * ? *" // 10.29pm  => 10.34 <>10.54
then
   	 RandomInterval = (Math::floor((Math::random * (15) + 0).doubleValue).intValue)
   	  LightsOffTimer = createTimer(now.plusMinutes(RandomInterval)) [| sendMail("xxxxxx@gmail.com", "burglarrules", "het licht is uitgegaan") ]
  
end

so I really cant figure out what is wrong with the orther rule

Just to make sure, I renamed the item. That didnt help.
Anybody have another solution??

I am having a similar issue… Did this get resolved? Would there be a way to see stray characters if using vi editor?

I have a rule that sets status of a device and it runs a few times and then just stops. I am looking for tips on how to troubleshoot. The device is a z-wave lock, I have tried looking at the z-wave and the rules logs via Karaf but I see nothing that calls my attention.

How can I check if the rules engine is running?

Please consider to use VSCode with openHAB plugin to edit any file. VSCode is the official editor for openHAB, eclipse Smarthome Ddesigner is end-of-life.

3 Likes

Hector, apologies that I haven’t picked up on your reaction earlier.
I am not sure anymore if this got solved as in fact I still have some trouble with this rule and some others that only seem to work for one day, but that is the subject of a more recent post

@Udo_Hartmann I will try setting that up and see how it goes editing the files through there. I typically just ssh to my OH box, will I be able to connect to a remote server using that setup?

@Kees_van_Gelder Ill keep poking around the forum to see if I find anything that will help. So far it seems like its this one rule so I am thinking there may be something OH doesn’t like. I implemented that rule I found on a post in this forum and it seems like it works for others so I may be missing something in my setup.

1 Like

You have to setup a samba share to get remote access to the configuration. When using openHABian, this is activated by default.

Ok great, not using openHABian but I did find some documentation that should be helpful on the openhab web site. I’ll give that a try.

Just got VSCode with openHAB plugin set up. In case anyone runs into this, you can find the info here…

VSCODE
https://code.visualstudio.com/Download

and

openHAB plugin
https://github.com/openhab/openhab-vscode/blob/master/README.md

I have used it to modify my files and while I have not been able to get it to work, I can say that I see it very useful.

I was able to resolve my issue, turns out I had MySQL persistence for the particular items in my rule incorrectly set up. Fixing the items not only got my persistence to work correctly, but also fixed my rule at the same time.

Thanks Hector.
Sadly that’s not gonna help me as I have no persistence set up for those items.
I am afraid the suggestion of card failure that was made also didn’t help me. I complete reinstall shows the same problem.
Currently I make do by restarting Openhab every day

Although it should only be necessary for lambda rules, I experienced something similar with my timers when not using a space.
This was introduced recently in the snapshot release, so try

garageTimer = createTimer(now.plusMinutes(20)) [ |

instead of

garageTimer = createTimer(now.plusMinutes(20)) [|

Thanks sihui
I had heard about the space after and before square brackets in the newest update, but I think my problems stem from before that. nevertheless it might be worth a try.

Also the majority of problems seem to be with rules that have a simple cron statement
I also have ONE rule with a Thread statement. One such statement shouldn’t be a problem, but I may just stop that one for a while and se what happens.

Thank you for your continued attention

Did you re-install on the same card or a brand new one. Because formating a card and burning a new partition will only “hide” the faulty sectors and new ones will appear again and your system will fail again. Further mode if you backed up, re-formatted and burned the back-up all you would have achieved is backing up the faults.

Thanks, got a brand new one and did a complete reinstall from scratch (that’s why it took a while), but I did ofcourse copy my item/sitemap/rules files with a simple file copy