Rule engine not yet started - not executing rule

No I have no clue about how and where? Can you help me please?

Many Thanks,

Konrad

If you create the rule in MainUi, click
add trigger
system event
and select the start level

Hi

unfortunately it doesn’t helped. My Rules configuration maybe you can see the error…

triggers:
  - id: "1"
    configuration:
      itemName: Konrad_Anwesend
      state: ON
      startlevel: 50
      previousState: OFF
    type: core.ItemStateChangeTrigger
  - id: "3"
    configuration:
      startlevel: 50
    type: core.SystemStartlevelTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      type: application/javascript
      script: >-
        var Actions = Java.type("org.openhab.core.model.script.actions.Things");

        var mailActions = Actions.getActions("mail","mail:smtp:6a99578ade");

        var aufgaben = itemRegistry.getItem('FamilienAufgaben').getState()

        mailActions.sendMail("konrad.eichstaedt@gmx.de", "Offene Aufgaben", aufgaben);
    type: script.ScriptAction

not sure, but you have to delete trigger 1 or set the startlevel to 100

based on your actions I doubt that this rule should be launched at startup.
please explain shortly what you want to achieve

I have an Item which detect my smartphone within LAN. If the Switch changed from OFF to ON I will trigger an email sending.

ok. then we misunderstood each other.

your script has nothing to do with startup rule and startlevel. delete trigger 3 and startlevel: 50 from trigger 1

ok but why can I start this rule manually but not if the item state has been changed?

maybe the current state is NULL or already ON?
go to MainUI’s Developer Tools and start API Explorer.
choose items - post and send OFF and then ON to your item.

or even better change your rule to received command ON

I tried using the API explorer and sending ON and OFF with the following result in the logfile but unfortunately without sending an email.

21:48:05.281 [DEBUG] [re.automation.internal.RuleEngineImpl] - The trigger ‘1’ of rule ‘58961ea251’ is triggered.
21:48:05.281 [DEBUG] [internal.profiles.ProfileCallbackImpl] - Delegating command ‘ON’ for item ‘Konrad_Anwesend’ to handler for channel ‘tr064:subdeviceLan:223534b017:uuid_3A75802409_2Dbccb_2D40e7_2D8e6b_2D3431C4E5430F:macOnline_24_3A18_3A1D_3A8D_3A7E_3AB5’
21:48:05.282 [DEBUG] [re.automation.internal.RuleEngineImpl] - Rule engine not yet started - not executing rule ‘58961ea251’,
21:48:05.282 [DEBUG] [e.internal.common.CombinedClassLoader] - Loaded class “org.openhab.core.thing.binding.ThingHandler” by classloader “org.eclipse.osgi.internal.loader.EquinoxClassLoader@259d669e[org.openhab.binding.tr064:3.1.0(id=242)]” for “[class org.openhab.binding.tr064.internal.Tr064SubHandler]”
21:48:05.283 [DEBUG] [e.internal.common.CombinedClassLoader] - Loaded class “org.openhab.core.thing.ThingStatusInfo” by classloader “org.eclipse.osgi.internal.loader.EquinoxClassLoader@259d669e[org.openhab.binding.tr064:3.1.0(id=242)]” for “[class org.openhab.binding.tr064.internal.Tr064SubHandler]”
21:48:05.283 [DEBUG] [e.internal.common.CombinedClassLoader] - Loaded class “org.openhab.core.thing.ChannelUID” by classloader “org.eclipse.osgi.internal.loader.EquinoxClassLoader@259d669e[org.openhab.binding.tr064:3.1.0(id=242)]” for “[class org.openhab.binding.tr064.internal.Tr064SubHandler]”
21:48:05.284 [DEBUG] [e.internal.common.CombinedClassLoader] - Loaded class “org.openhab.core.thing.binding.ThingHandlerCallback” by classloader “org.eclipse.osgi.internal.loader.EquinoxClassLoader@259d669e[org.openhab.binding.tr064:3.1.0(id=242)]” for “[class org.openhab.binding.tr064.internal.Tr064SubHandler]”
21:48:05.284 [DEBUG] [e.internal.common.CombinedClassLoader] - Loaded class “org.openhab.core.thing.Thing” by classloader “org.eclipse.osgi.internal.loader.EquinoxClassLoader@259d669e[org.openhab.binding.tr064:3.1.0(id=242)]” for “[class org.openhab.binding.tr064.internal.Tr064SubHandler]”
21:48:05.285 [DEBUG] [internal.common.InvocationHandlerSync] - Already in a safe-call context, executing ‘ThingHandler.handleCommand()’ directly on ‘org.openhab.binding.tr064.internal.Tr064SubHandler@33bd027a’.
21:48:05.285 [DEBUG] [inding.tr064.internal.Tr064SubHandler] - Discarding command ON to tr064:subdeviceLan:223534b017:uuid_3A75802409_2Dbccb_2D40e7_2D8e6b_2D3431C4E5430F:macOnline_24_3A18_3A1D_3A8D_3A7E_3AB5, read-only channel
21:48:05.299 [DEBUG] [t.core.internal.GsonMessageBodyWriter] - Failed writing HTTP response, since other side closed the connection
21:48:05.300 [DEBUG] [g.openhab.core.io.rest.SseBroadcaster] - Sending event to sink failed
org.eclipse.jetty.io.EofException: Closed
at org.eclipse.jetty.server.HttpOutput.checkWritable(HttpOutput.java:768) ~[bundleFile:9.4.40.v20210413]
at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:792) ~[bundleFile:9.4.40.v20210413]

go to openHAB-conf/rules and create a file test.rules with the following content:

rule "Test"
when
	Item Konrad_Anwesend received command
then
	logInfo("Test","Item Konrad_Anwesend hat rule getriggert")
end

check logfile when saving. Do you see this entry?

if yes, send command ON to your item

Moin oliver,

unfortunately the rules hasn’t been triggered. Maybe the problem is that I’am running in docker. I tried several folder but failed always. Also switching to command recieved failed. The only config which show a trigger logfile was Item status changed from OFF to ON. In this case I’am getting the already known log entry of the relevant trigger.

RuleEngineImpl] - The trigger ‘3’ of rule ‘58961ea251’ is triggered.
08:48:05.051 [DEBUG] [re.automation.internal.RuleEngineImpl] - Rule engine not yet started - not executing rule ‘58961ea251’,
08:48:05.050 [DEBUG] [g.openhab.core.io.rest.SseBroadcaster] - Sending event to sink failed
org.eclipse.jetty.io.EofException: null
at org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:279) ~[bundleFile:9.4.40.v20210413]

May last rule config:

triggers:
  - id: "3"
    configuration:
      itemName: Konrad_Anwesend
      state: ON
      previousState: OFF
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      type: application/javascript
      script: >-
        var Actions = Java.type("org.openhab.core.model.script.actions.Things");

        var mailActions = Actions.getActions("mail","mail:smtp:6a99578ade");

        var aufgaben = itemRegistry.getItem('FamilienAufgaben').getState()

        mailActions.sendMail("konrad.eichstaedt@gmx.de", "Offene Aufgaben", aufgaben);
    type: script.ScriptAction

Have you any experience with docker maybe this is the problem? Because the rule which I created with UI I haven’t found any rules file in the openhab subdirectory?

Was this a clean install or did you do an update - from which version?
did you install any additional scripting modules? if yes, deinstall and use the built-in scripting language.
and maybe try to install a milestone build. just in case a file got corrupted.

If you are using MainUI for creating rules, then the rules folder is empty because MainUI uses a json file for storing rules. I prefer .rules files because when you save a rule you see a syntax check in the log. MainUI does not do this.

It was a clean installation of a docker container with openhab 3.1.0 with no special adjustments. I have none additional scripting language installed but I use javascript instead of DSL because I won’t using an installed SMTP Server addon to send E-Mail. Do you know where I have to put a rules file within docker?

as written above

which is in fact

/etc/openhab/rules

but you already did it, didn‘t you?

This is my directory structure of docker:

root@360969bc12b6:/openhab# ls -latr
total 64
-rwxr-xr-x  1 openhab openhab   199 Jun 27 20:05 start.sh
-rwxr-xr-x  1 openhab openhab    73 Jun 27 20:05 start_debug.sh
-rw-r--r--  1 openhab openhab 13430 Jun 27 20:28 LICENSE.TXT
drwxr-xr-x  1 openhab openhab  4096 Jun 27 20:44 dist
drwxr-xr-x  2 openhab openhab  4096 Sep 30 08:37 .karaf
drwxrwxrwx  2 openhab openhab  4096 Nov 25 18:07 addons
drwxr-xr-x  1 root    root     4096 Nov 25 18:07 ..
drwxr-xr-x 12 openhab openhab  4096 Nov 27 13:18 userdata
drwxr-xr-x  1 openhab openhab  4096 Nov 28 07:55 runtime
drwxrwxrwx  8 openhab openhab   256 Nov 28 08:01 conf
drwxr-xr-x  1 openhab openhab  4096 Nov 28 08:01 .
root@360969bc12b6:/openhab# ls -latr conf/
total 12
drwxrwxrwx 2 openhab openhab   64 Sep 29 12:30 conf
drwxrwxrwx 2 openhab openhab   64 Sep 29 12:30 userdata
drwxrwxrwx 2 openhab openhab   64 Oct 27 06:18 addons
-rw-r--r-- 1 openhab openhab  159 Nov  8 20:05 goettlin.sitemap
drwxr-xr-x 3 openhab openhab   96 Nov 27 13:18 services
drwxr-xr-x 3 openhab openhab   96 Nov 28 07:55 rules
drwxrwxrwx 8 openhab openhab  256 Nov 28 08:01 .
drwxr-xr-x 1 openhab openhab 4096 Nov 28 08:01 ..
root@360969bc12b6:/openhab# ls -latr conf/rules/
total 4
-rw-r--r-- 1 openhab openhab 125 Nov 28 07:55 test.rules
drwxr-xr-x 3 openhab openhab  96 Nov 28 07:55 .
drwxrwxrwx 8 openhab openhab 256 Nov 28 08:01 ..```

But the installation ignores the test.rules file ...?

I am not familiar with docker. If you were in the right directory, there should be about 10 subdirectories, like rules, sitemap, items, html, persistence, and so on.

If you change and save test.rules and you do not see the above mentioned log entry (“Loading model Test.rules”) then I guess something went wrong with your rules engine during install or docker is blocking something.

Maybe compare your bundle:listoutput with mine t.txt (15.1 KB) if there are some fundamental bundles missing

The openHAB-conf folder @Oliver2 refers to is located in /openhab/conf inside the Docker container. You should have a volume mapped to that folder so your configs are saved when you recreate the container.

Rules created through the UI are stored in /openhab/userdata/jsondb/automation.json.

I assume you’ve restarted openHAB since this error appeared?

This problem should have nothing to do with the fact you are running in Docker. Something is wrong with openHAB.

Hi There,

I found the noticed automation.json but can’t identify any missing module. I guess that I have to stop here and trying and plain openhab installation on my MAC directly.

Many Thanks to your all for your support.

Best regards

Konrad

Hi Everybody,

Many Thanks for your help, I installed openHAB 3 on my MAC directly instead using docker. And same configuration and rule has been processed successfully. So it seems a direct issue with openHAB 3 and docker installation.

Best regards

Konrad