[Solved] Rule not working because not triggered?

Hi there,

even I’ve searched the forum and found a couple of similar questions, none of them works for me. I’m trying to start automate some things by rule scripts. For a very first test and to get familar I just want to switch on my lights if a phone call arrives. I’ve configured FritzboxTR064 Binding (in an .item file) and even have all my hue lights configured in an item file. Here is my simple rule I want to run:

rule "Eingehender Anruf"
    Item fboxRinging received command ON

The fboxRinging item is defined as:

Switch  fboxRinging  "Phone ringing [%s]" {fritzboxtr064="callmonitor_ringing" }

The Licht_Wohnzimmer as:

Switch	Licht_Wohnzimmer "Wohnzimmerlicht" [ "Lighting" ] { channel="hue:0210:00178861c975:WohnzimmerDecke:color" }

If I set up a similar rule in Paper UI with the ‘Rule Engine (Experimental)’ this rule works well. I’ve even created a sitemap where I have the following configured:

Switch item=fboxRinging label="Eingehender Anruf"

Now, when I access the sitemap and switch on the item manually, the rule works fine, too. For this case, the Event log shows the following:

2018-01-01 23:38:15.805 [ome.event.ItemCommandEvent] - Item 'fboxRinging' received command ON
2018-01-01 23:38:15.854 [vent.ItemStateChangedEvent] - fboxRinging changed from OFF to ON
2018-01-01 23:38:15.896 [vent.ItemStateChangedEvent] - Licht_Wohnzimmer changed from OFF to ON

But if I just upload the rule script above, nothing happens. I think it’s not triggered because what I see in the Event log is, that in the case a call arrives there is no ‘Item’ mentioned. It just says: fboxRinging changed from NULL to ON but above in the log there is the additional line Item ‘fboxRinging’ received command ON
This is all I get in the log if a call arrives when I just use the rule script:

2018-01-02 10:18:26.186 [vent.ItemStateChangedEvent] - fboxRinging changed from NULL to ON
2018-01-02 10:18:26.192 [vent.ItemStateChangedEvent] - fboxIncomingCallResolved changed from NULL to 089123456846
2018-01-02 10:18:36.963 [vent.ItemStateChangedEvent] - fboxOutgoingCall changed from NULL to 
2018-01-02 10:18:36.970 [vent.ItemStateChangedEvent] - fboxRinging changed from ON to OFF

I don’t know why the Item is not triggered or at least not mentioned? What is different to the Rule configuration in Paper UI:

Thanks for any help on this.

I think the log tells you that your Item gets updated when there is a incoming call.
The rule is written to trigger on command, so it does not trigger on that update.
Fudging the Item state from the UI generates a command and so will trigger the rule.

It’s worth spending a bit of time grasping the non-obvious differences between commands and updates in OpenHAB.
In general, commands are used when OpenHAB wants to “do something” to an external device, like turning a light on.
Updates often represent “incoming signals” from the outside world, like a presence detector. Or a ring detector.
Rule triggers can be written to select these different cases.

Thank you! I’ve changed it now to:

rule "Eingehender Anruf"
	Item fboxRinging received update ON or
	Item fboxRinging received command ON

It works with both scenarios (manually switching on in sitemap and incoming call).