[SOLVED] Rules: No trigger from item at all (only time cron triggers are working)

  • Platform information:

    • Hardware: Raspberry Pi 4 Model B Rev 1.1
    • OS: Raspbian GNU/Linux 10 (buster) / Linux 4.19.93-v7l+
    • openHAB version: 2.5.1-2 (Release Build)
  • Issue:
    All my rules are not trigger from any items by changed, receive command or receive update. Only by time cron jobs. Curiously after start sometimes the first minutes the triggers are correct, but than switch of completely without any massages in the logs. I tried a lot of things like:

    • knx the device as TUNNEL and Router
    • Types with switch and switch-control
    • disable swap file on raspberry
    • change mode of package in addons.cfg from expert to standard
    • delete db4o jar file from addon folder

    Log informations:
    In the event.log I can see the item changing but the openhab.log there is no entry

    The Switch with the openHAB App by Android mobile phone is working.
    I think it is not a “bug” of the knx binding, it is something between the all items and the rules

    Do somebody know how I can fix that or how I can debug it?

  • Things

     Bridge knx:ip:bridge "KNX-IP" @ "KNX"[
     ] {
        Thing device SA_1_1_12 "Schaltaktor 1.1.12" [
        ] {
           Type switch : EG_Buero_Licht_SW "EG Büro Licht" [ ga="1/1/50+<1/1/51" ] 
  • Items configuration related to the issue

    Switch EG_Buero_Licht_SW "Büro Licht"  <light>  { channel="knx:device:bridge:SA_1_1_12:EG_Buero_Licht_SW" }
  • Rules code related to the issue
    Rule Test1 is not working
    Rule Test2 is working

    rule Test1
        Item EG_Buero_Licht_SW changed
       logInfo("TEST", "Trigger wurde ausgelöst")
    rule Test2
        Time cron "0 * * * * ?"   // jede Minute
       logInfo("TEST", "Time cron trigger wurde ausgelöst")

In the console, what is returned from executing…

things list

… and…

items list

I doubt this is a problem with your rules or rule engine, but your Item or Thing configuration, binding or device.

BTW… welcome to the forum!

Thank’s for your answer Scott.

in the things list I see modbus things incl. their types, the same with my homematic things. And also the knx things but without their types

openhab> things list
knx:device:bridge:SA_1_1_12 (Type=Thing, Status=ONLINE, Label=Schaltaktor 1.1.12, Bridge=knx:ip:bridge)
modbus:data:localserial:modParam2:UG_TECHNIK_FW_VolumenM3_MSB (Type=Thing, Status=ONLINE, Label=UG_TECHNIK_FW_VolumenM3_MSB, Bridge=modbus:poller:localserial:modParam2)
homematic:bridge:3014F711A000048410247 (Type=Bridge, Status=UNINITIALIZED (DISABLED), Label=Homematic IP CCU3, Bridge=null)
knx:device:bridge:generic (Type=Thing, Status=ONLINE, Label=KNX Device, Bridge=knx:ip:bridge)
homematic:HmIP-WTH-2:3014F711A000048410247:000A9A49A6A4A5 (Type=Thing, Status=UNINITIALIZED (DISABLED), Label=Hobbyraum, Bridge=homematic:bridge:3014F711A000048410247)
homematic:HmIP-WTH-2:ccu:000A9A49A6A4A5 (Type=Thing, Status=ONLINE, Label=Klima, Bridge=homematic:bridge:ccu)
homematic:HmIP-WTH-2:3014F711A000048410247:000A98A9A225B3 (Type=Thing, Status=UNINITIALIZED (DISABLED), Label=Technikraum, Bridge=homematic:bridge:3014F711A000048410247)
homematic:HmIP-WTH-2:ccu:000A98A9A225B3 (Type=Thing, Status=ONLINE, Label=Klima, Bridge=homematic:bridge:ccu)
modbus:data:localserial:modParam2:UG_TECHNIK_FW_WaermemengeKWh_LSB (Type=Thing, Status=ONLINE, Label=UG_TECHNIK_FW_WaermemengeKWh_LSB, Bridge=modbus:poller:localserial:modParam2)
modbus:data:localserial:modParam1:UG_TECHNIK_FW_VL_SekundaerT8 (Type=Thing, Status=ONLINE, Label=UG_TECHNIK_FW_VL_SekundaerT8, Bridge=modbus:poller:localserial:modParam1)
modbus:data:localserial:modParam1:UG_TECHNIK_FW_AussentemperaturT6 (Type=Thing, Status=ONLINE, Label=UG_TECHNIK_FW_AussentemperaturT6, Bridge=modbus:poller:localserial:modParam1)
modbus:data:localserial:modParam1:UG_TECHNIK_FW_SOLLTEMPERATUR_HEIZKOERER_HK0 (Type=Thing, Status=ONLINE, Label=UG_TECHNIK_FW_SOLLTEMPERATUR_HEIZKOERER_HK0, Bridge=modbus:poller:localserial:modParam1)
modbus:data:localserial:modParam2:UG_TECHNIK_FW_Vorlauftemperatur (Type=Thing, Status=ONLINE, Label=UG_TECHNIK_FW_Vorlauftemperatur, Bridge=modbus:poller:localserial:modParam2)
modbus:data:localserial:modParam1:UG_TECHNIK_FW_VL_FB_HK1 (Type=Thing, Status=ONLINE, Label=UG_TECHNIK_FW_VL_FB_HK1, Bridge=modbus:poller:localserial:modParam1)
knx:device:bridge:JRA_1_1_32 (Type=Thing, Status=ONLINE, Label=KNX JRA_1_1_32, Bridge=knx:ip:bridge)
modbus:data:localserial:modParam2:UG_TECHNIK_FW_JahrRegler (Type=Thing, Status=ONLINE, Label=UG_TECHNIK_FW_JahrRegler, Bridge=modbus:poller:localserial:modParam2)
modbus:data:localserial:modParam1:UG_TECHNIK_FW_StatusUebergabestation (Type=Thing, Status=ONLINE, Label=UG_TECHNIK_FW_StatusUebergabestation, Bridge=modbus:poller:localserial:modParam1)
modbus:data:localserial:modParam2:UG_TECHNIK_FW_TagRegler (Type=Thing, Status=ONLINE, Label=UG_TECHNIK_FW_TagRegler, Bridge=modbus:poller:localserial:modParam2)
modbus:poller:localserial:modParam1 (Type=Bridge, Status=ONLINE, Label=Regular Poll, Bridge=modbus:serial:localserial)
modbus:data:localserial:modParam1:UG_TECHNIK_FW_VL_HEIZKOERPER_HK0 (Type=Thing, Status=ONLINE, Label=UG_TECHNIK_FW_VL_HEIZKOERPER_HK0, Bridge=modbus:poller:localserial:modParam1)
modbus:poller:localserial:modParam2 (Type=Bridge, Status=ONLINE, Label=Regular Poll, Bridge=modbus:serial:localserial)
modbus:data:localserial:modParam2:UG_TECHNIK_FW_LeistungKW_LSB (Type=Thing, Status=ONLINE, Label=UG_TECHNIK_FW_LeistungKW_LSB, Bridge=modbus:poller:localserial:modParam2)
modbus:data:localserial:modParam2:UG_TECHNIK_FW_VolumenM3_LSB (Type=Thing, Status=ONLINE, Label=UG_TECHNIK_FW_VolumenM3_LSB, Bridge=modbus:poller:localserial:modParam2)
modbus:data:localserial:modParam2:UG_TECHNIK_FW_BufferZirkulationRL (Type=Thing, Status=ONLINE, Label=UG_TECHNIK_FW_BufferZirkulationRL, Bridge=modbus:poller:localserial:modParam2)
modbus:data:localserial:modParam1:UG_TECHNIK_FW_Status_HK0 (Type=Thing, Status=ONLINE, Label=UG_TECHNIK_FW_Status_HK0, Bridge=modbus:poller:localserial:modParam1)
knx:ip:bridge (Type=Bridge, Status=ONLINE, Label=KNX-IP, Bridge=null)
modbus:data:localserial:modParam2:UG_TECHNIK_FW_Durchfluss_lph (Type=Thing, Status=ONLINE, Label=UG_TECHNIK_FW_Durchfluss_lph, Bridge=modbus:poller:localserial:modParam2)
modbus:data:localserial:modParam2:UG_TECHNIK_FW_Betriebstage (Type=Thing, Status=ONLINE, Label=UG_TECHNIK_FW_Betriebstage, Bridge=modbus:poller:localserial:modParam2)

In the items list are all items (1528 items - crazy, it grows over the years)

openhab> items list
OG_Kind2li_Temperatur_Ist (Type=NumberItem, State=21.04, Label=Temperatur Lara's Zimmer (Ist), Category=temperature, Groups=[gTemperatur_Ist_OG_Kind2li])
UG_TECHNIK_FW_BufferTemperaturOben_Steigung_minus17h0 (Type=StringItem, State=NULL, Label=Fernwärme - Buffertemp. oben, Category=null)
gState (Type=GroupItem, Members=14, State=6.0, Label=null, Category=null, Groups=[All])
EG_Buero_Licht_SW (Type=SwitchItem, State=OFF, Label=Büro Licht, Category=socket, Groups=[gGarage])
EG_Wohn_Tag_Wohnzimmertisch_Stufen (Type=NumberItem, State=1.0, Label=EG Wohn Tag Wohnzimmertisch - Stufen, Category=slider, Groups=[All])

So, after an OH restart, your rules work properly, but after a few minutes they stop working? Did this just start happening or has something changed?

See if this topic helps…

If there were something wrong with your Items, that would seem an unlikely observation.

Yes. Oh sorry, I forgot the background.
I’m using openhab since about 7 years now. Version 1.3 was my first version, when I remember correctly.
I switched to openHAB 2 with knx1 and modbus1. Which working well before 2.5.1 but than I had some streng behaviour. So I switch to knx2 and modbus2. And with that I got the rule problems.

Thanks for the link. But I saw this before I added my issue. In fact, I had some sleeps in my rules, but I removed them and also tried to change the runtime.cfg to


and to


but without positive effects. How can I see if the that is the cause of my problems?

I have further question to the output of the things list and items list:
Is it normal that the modbus and homematic items are in the things list but the knx items are missing? Or is there somewhere the problem?

I tried the commandos from your post https://community.openhab.org/t/why-have-my-rules-stopped-running-why-thread-sleep-is-a-bad-idea/47695/12?u=biker

openhab> shell:threads --list |grep "RuleEngine" |wc -l
openhab> shell:threads --list |grep "safeCall" |wc -l
openhab> shell:threads --list |grep "discovery" |wc -l
openhab> shell:threads --list |grep "thingHandler" |wc -l

Is there something abnormal?

No, that looks fine. Are the rules currently triggering properly?

The problem is, that only rules with Time cron Trigger are triggering. The rules with the item event triggers are not triggered

Do you see events in the event.log when the Items change states? Maybe you could provide a sample of it. Are the names of your non-cron rules all different?

Are the cron rules in a separate file? Are there any errors in the log when you save any of the rule files with non-cron rules?

Hello Scott, firstly, thanks a lot for your time.

Yes I see a lot of events in the event.log

2020-02-11 20:54:27.608 [vent.ItemStateChangedEvent] - Out_Temp_Quadra changed from 2.72 to 2.9
2020-02-11 20:54:27.622 [ome.event.ItemCommandEvent] - Item 'UG_TECHNIK_Strom_Wirkarbeit_Gesamt_kWh' received command 32193.3926
2020-02-11 20:54:27.647 [ome.event.ItemCommandEvent] - Item 'UG_TECHNIK_Wasser_MaxDurchlfuss_Seit_IBN_Liter' received command 1655
2020-02-11 20:54:27.662 [vent.ItemStateChangedEvent] - UG_TECHNIK_Strom_Wirkleistung_Gesamt_W changed from 380 to 376
2020-02-11 20:54:27.663 [ome.event.ItemCommandEvent] - Item 'UG_TECHNIK_Strom_Wirkleistung_Gesamt_W' received command 364
2020-02-11 20:54:29.885 [vent.ItemStateChangedEvent] - UG_TECHNIK_FW_AussentemperaturT6 changed from 30 to 29
2020-02-11 20:54:29.902 [vent.ItemStateChangedEvent] - Out_Windgeschwindigkeit changed from 2.42 to 3.58

Yes all rules had different names

Yes and no, the most files have both. Time based rules and item event based rules

There are no errors when loading the rules, only some had the warning you can see below

2020-02-11 20:59:07.818 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'alarm.rules'
2020-02-11 20:59:34.952 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'bewegung.rules', using it anyway:
The operator '!=' should be replaced by '!==' when null is one of the arguments.
2020-02-11 20:59:34.956 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'bewegung.rules'
2020-02-11 20:59:37.266 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'shuttersOut.rules'

Maybe that is a usefull information?!

openhab> shell:threads --list |grep "RuleEngine"
448 x pipe-grep "RuleEngine"     x RUNNABLE      x 237      x 200
openhab> shell:threads --list |grep "safeCall"
447 x pipe-grep "safeCall"       x RUNNABLE      x 315      x 250
openhab> shell:threads --list |grep "thingHandler"
448 x pipe-grep "thingHandler"   x RUNNABLE      x 312      x 270
openhab> shell:threads --list |grep "RuleEngine"
447 x pipe-grep "RuleEngine"    x RUNNABLE      x 407      x 350
openhab> shell:threads --list |grep "safeCall"
448 x pipe-grep "safeCall"      x TIMED_WAITING x 419      x 370
openhab> shell:threads --list |grep "thingHandler"
447 x pipe-grep "thingHandler"  x TIMED_WAITING x 490      x 420
openhab> shell:threads --list |grep "RuleEngine"
448 x pipe-grep "RuleEngine"    x TIMED_WAITING x 492      x 430
openhab> shell:threads --list |grep "safeCall"
447 x pipe-grep "safeCall"      x RUNNABLE      x 557      x 480
openhab> shell:threads --list |grep "thingHandler"
446 x pipe-grep "thingHandler"  x RUNNABLE      x 113      x 90

OK, but do you see any for the Items that are to trigger your rules?

Not a problem, but easily fixed (just do what the warning advises).

I missed this earlier. Don’t confuse Things and Items… they are totally different.

When migrating from OH 1.x to 2.x, it is hard tio resist the urge to not use textual configuration for your Things, since this is what you are used to in 1.x, but it is best let OH manage your Things. There may be an issue in your config that would not have occurred if OH had created the Things for you.

You only listed one KNX Item and it is shown in the list of Items from the console. What do you see as missing? Can you control and/or get proper values for all of your Items in a UI?

You are very welcome!

Yes, for example UG_TECHNIK_FW_AussentemperaturT6

	Line 51049: 2020-02-11 22:06:00.081 [vent.ItemStateChangedEvent] - UG_TECHNIK_FW_AussentemperaturT6_C changed from 2.80000000 to 2.90000000
	Line 51417: 2020-02-11 22:07:00.062 [ome.event.ItemCommandEvent] - Item 'UG_TECHNIK_FW_AussentemperaturT6_C' received command 2.90000000
	Line 51641: 2020-02-11 22:07:42.219 [vent.ItemStateChangedEvent] - UG_TECHNIK_FW_AussentemperaturT6 changed from 29 to 28
	Line 51746: 2020-02-11 22:08:00.030 [ome.event.ItemCommandEvent] - Item 'UG_TECHNIK_FW_AussentemperaturT6_C' received command 2.80000000
	Line 51748: 2020-02-11 22:08:00.036 [vent.ItemStateChangedEvent] - UG_TECHNIK_FW_AussentemperaturT6_C changed from 2.90000000 to 2.80000000
	Line 51877: 2020-02-11 22:08:23.820 [vent.ItemStateChangedEvent] - UG_TECHNIK_FW_AussentemperaturT6 changed from 28 to 29
	Line 51934: 2020-02-11 22:08:34.775 [vent.ItemStateChangedEvent] - UG_TECHNIK_FW_AussentemperaturT6 changed from 29 to 28
	Line 51970: 2020-02-11 22:08:43.368 [vent.ItemStateChangedEvent] - UG_TECHNIK_FW_AussentemperaturT6 changed from 28 to 29
	Line 52051: 2020-02-11 22:09:00.036 [ome.event.ItemCommandEvent] - Item 'UG_TECHNIK_FW_AussentemperaturT6_C' received command 2.90000000
	Line 52053: 2020-02-11 22:09:00.046 [vent.ItemStateChangedEvent] - UG_TECHNIK_FW_AussentemperaturT6_C changed from 2.80000000 to 2.90000000
	Line 52119: 2020-02-11 22:09:13.783 [vent.ItemStateChangedEvent] - UG_TECHNIK_FW_AussentemperaturT6 changed from 29 to 28
rule FW_UG_AussentemperaturT6
	Item UG_TECHNIK_FW_AussentemperaturT6	changed
	if (UG_TECHNIK_FW_AussentemperaturT6.state instanceof DecimalType)
		var Number tempT6 = UG_TECHNIK_FW_AussentemperaturT6.state as DecimalType
		if (tempT6 > 1000) // > 100°C
			tempT6 = tempT6 - 65535
		// Plausibel? 0,1°C
		if ( (tempT6 < 1000) || (tempT6 > -1000) )
			tempT6 = (tempT6)/10.0
			logInfo("Fernwärme", "ERROR: FW: Außentemperatur T6 (Reg. 40601) nicht plausibel <" + (tempT6/10.0) + "°C>")
			sendNotification("hegau.biker@abc.de", "FW: ERROR: TempT6 nicht plausibel <" + (tempT6/10.0) + "°C>")
		logInfo("Fernwärme", "ERROR: FW: Außentemperatur T6 (Reg. 40601) <not able to read>")
		sendNotification("hegau.biker@gmx.de", "FW: ERROR: TempT6 <not able to read>")

I like text file, there for I also don’t want to switch to the next rule engine. But I will try to set up a knx.things file with the webui and will compare them…

I miss the triggering of the rules and also the log entries logInfo(…) in the openhab.log file. For example, the item UG_TECHNIK_FW_AussentemperaturT6 is a modbus item which doesn’t work. But also the knx items are not triggering the rules, like Out_Daemmerung

Line 2577: 2020-02-11 18:16:57.354 [vent.ItemStateChangedEvent] - Out_Daemmerung changed from 1.37 to 0.37
	Line 3804: 2020-02-11 18:21:56.909 [vent.ItemStateChangedEvent] - Out_Daemmerung changed from 0.37 to 0.15
	Line 5090: 2020-02-11 18:26:58.170 [vent.ItemStateChangedEvent] - Out_Daemmerung changed from 0.15 to 0.08
	Line 6263: 2020-02-11 18:31:57.416 [vent.ItemStateChangedEvent] - Out_Daemmerung changed from 0.08 to 0.02

Yes, I use the openHAB App on my Android mobile phone there I see all my sitemaps with items and graphs, and I also can control everthing (rollershuter, lights,…)

That appears to show your rule working as expected?

	Item UG_TECHNIK_FW_AussentemperaturT6	changed

The rule produces no other logs if it follows the path to issue the command, the command that we can see in your events.log

The UG_TECHNIK_FW_AussentemperaturT6_C update is because of my workaround rule which is trigger by Time cron "0 * * * * ?" // jede Minute

Other question:
When I add a knx device thing by paper UI. I can’t see it in the openhab2-conf\things-folder. Is that normal?


Changes made using PaperUI are never ever stored back into xxx.items or xxx.things files.
Do not attempt to use both methods on the same name Things or Items - or you will get in a mess.

Thanks rossko57.
That’s it …

  1. I removed my knx.things file in the things folder
  2. sudo systemctl restart openhab2.service
  3. Delete all knx things in the paper ui (there was some)
  4. restore the knx.things file in the things folder
  5. sudo systemctl restart openhab2.service

…and now the items trigger the rules. Maybe I have to do that also for my homematic.things and modbus.things.

Thanks 5iver and rossko57 for your hints. Currently I’m happy. I hope that solve the problem, but currently it looks great.

1 Like

Just FYI, the new rule engine is not just the UI editor… it’s also scripted automation (text file) and there are a lot of useful helper libraries that make it easier to use!

Managed Thngs (not created in .things files) are stored in the jsondb, which are just JSON text files in $OPENHAB_USERDATA/jsondb/. You can edit these files too… just do it when OH is not running.

I’m glad you got it working. My suspicions were were right…

I still have my Items in files, but none of my Things. There are some limitations with UI created Items, but they will be remedied in OH 3.0.

1 Like

Thank you for the hint. In that case it was a misunderstanding from my side. If I can use textfiles like it is discriped in first steps, it is completely fine for me. If it is writen in Python, Java or anything else doesn’t matter for me.

That’s greate to know, because that morning, not all have worked like I expected. So I have to look into it this evening.