[SOLVED] OH3 Issue: unable to create rules, scripts, schedules

Hi all,

There was one thing I couldn’t get right after migrating to OH3. I cannot create rules, scripts and schedules.

When I try this, I get on the first attempt (in the log):

00:46:36.680 [WARN ] [automation.rest.internal.RuleResource] - Creation of the rule is refused: null

And on the 2nd save attempt:

00:49:23.986 [WARN ] [automation.rest.internal.RuleResource] - Creation of the rule is refused: Cannot add element, because an element with same UID (5130d50f0c) already exists

However, the rule is not saved - or at least not visible

2020-12-26 01.52.52 192.168.100.10 f7b86756ab90

Does anyone have an idea?

Thanks

Greetz,
Christoph

Hi there,

I’m still struggling with this issue. My attempt to solve was the same like I tried to solve the issue with the model page:

But without success. Problem persists.

Isn’t there really not idea / option to “debug” whats going on there?

Thanks.

Hi all,

in this case I would like to try a another thing. Therefore the question: where does OH store the rules if they are not text-based?

Thanks

I investigated a litte bit further.

Although the error above still persists, when I try to create a new and empty rule, a rule with the ID is created in

/var/lib/openhab/automation_rules.json

"921879d390": {
    "class": "org.openhab.core.automation.dto.RuleDTO",
    "value": {
      "triggers": [
        {
          "id": "1",
          "configuration": {
            "startlevel": 100.0
          },
          "type": "core.SystemStartlevelTrigger"
        }
      ],
      "conditions": [],
      "actions": [
        {
          "inputs": {},

As you see, the rule ID is the same like here:

2020-12-28 22.46.10 192.168.100.10 a0622b652103

It seems the the ID is created, the trigger as well but no action. At least this explains the error message saying that the rule already exists.

Maybe this helps a little to ivestigate what’s going on there. More and more I’m convinced that I experience a general bug here…

OK. Now I found a solution by my own.
I did the following: (just if somebody gets someday the same issue)

  1. Stopped openhab sevice
  2. openhab-cli clean-cache
  3. I edited /var/lib/openhab/automation_rules.json an removed everything except the {}. Everything I tried during the last days was there, as well al some old rules I made with OH 2.5 and its Next-Gen Rule Engine.
  4. Restarted Openhab

Voila, it works, now I am able to create rules in OH3 as expected.
Seems that this is / was a migration issue in connection with the NGRE of OH2.5

Greetz

6 Likes

Thanks a lot!
Not sure how I missed it all this time but been struggling with rules not firing and not being able to create new rules through the GUI for about a month now :slight_smile:
This fixes all open issues for me.

You are welcome.

Seems that this is / was in fact a general migration issue.

Thank You, this fixed my rules as well. Home is back to normal now! Happy wife happy life lol.