Rule fires twice

Hi,
below my configuration:

Switch HM_Funkschalter1 “board” {channel=“homematic:HG-HM-LC-Sw1PBU-FM:CCU:OEQ0625787:1#STATE”}

rule "Rule11"
when
Item HM_Funkschalter1 received update OFF
then
z=z+1
logInfo(“lichtschalter”, "Rule11 : " + z )
end

EventLog:
2018-02-26 18:52:39.883 [vent.ItemStateChangedEvent] - HM_Funkschalter1 changed from ON to OFF
2018-02-26 18:52:39.890 [vent.ItemStateChangedEvent] - homematic_HG_HM_LC_Sw1PBU_FM_CCU_OEQ0625787_1_STATE changed from ON to OFF

The first event is on itemname "HM_Funkschalter1 "
the second event is on the channelname “homematic_HG_HM_LC_Sw1PBU_FM_CCU_OEQ0625787_1_STATE”

What do i have to change?

I can’t find a problem. There are two entries in the event.log, one fore the item and one for the channel. I think the rule runs once.

you can see that the rule is fireing twice, because the counter z was raising from 3 to 4

2018-02-26 20:04:47.402 [vent.ItemStateChangedEvent] - HM_Funkschalter1 changed from ON to OFF
2018-02-26 20:04:47.411 [INFO ] [smarthome.model.script.lichtschalter] - Rule11 : 3
2018-02-26 20:04:47.411 [vent.ItemStateChangedEvent] - homematic_HG_HM_LC_Sw1PBU_FM_CCU_OEQ0625787_1_STATE changed from ON to OFF
2018-02-26 20:04:47.441 [INFO ] [smarthome.model.script.lichtschalter] - Rule11 : 4

I’m not familar with homematic but can it be, that you have defined two items. One in text file and one in paperui?

Both report ItemStateChangeEvent.

EventLog:

2018-02-26 18:52:39.883 [vent.ItemStateChangedEvent] - HM_Funkschalter1 changed from ON to OFF
2018-02-26 18:52:39.890 [vent.ItemStateChangedEvent] - 
homematic_HG_HM_LC_Sw1PBU_FM_CCU_OEQ0625787_1_STATE changed from ON to 
OFF

I think the rule is running when you have told it to run.
Remember that an Item that is already OFF can still receive an update to OFF.

Would the rule run when you really wanted, if you triggered it on changed to OFF ?

@HomeAutomation This could be a hint

i have a switch in the file .item:
Switch HM_Funkschalter1 “KücheSteckboard” {channel=“homematic:HG-HM-LC-Sw1PBU-FM:CCU:OEQ0625787:1#STATE”

But where can i find the switch in the paperui?

it is possible to adress the switch directly in the sitemap?
actually it is like this:
Switch item=HM_Funkschalter1 label=“Steckboards” icon=“light”

The matter is, when i turn the switch on;
3 events are fired
Log: Item ‘HM_Funkschalter1’ received command ON
==>Trigger:received update ON
Log: HM_Funkschalter1 changed from OFF to ON
==> Trigger:changed from OFF to ON
and again : Trigger: received update ON

Hello @slzbi

As @rossko57 mentioned, try to change your rule to

Item HM_Funkschalter1 changed to OFF

or if you like to geht the rule fired when you switch it on to

Item HM_Funkschalter1 changed to ON

regards
Michael

@slzbi
I think I cannot help you. I use only text files to configure OH. I don’t know how to delte or create an item in PaperUI

Go to items in PaperUI and type something like in the filter text box:

homematic:HG-HM-LC-Sw1PBU

It should list all items which either have this as a part of their name or the channel they are linked to.
You easily should find yours and then you can delete it by clicking on the trash icon.

@Sascha_Billian
I found it below “Configuration/Things”.

If i delete it there, should it be available in the file ".items"
Switch HM_Funkschalter1 “KücheSteckboard” {channel=“homematic:HG-HM-LC-Sw1PBU-FM:CCU:OEQ0625787:1#STATE”

or do i have to pair it again?

If you remove the thing itself, you would have to pair it again.
If you are only removing the items which are associated with the thing, you do not need to repair them.

By the way, when you go to the thing in PaperUI you should see for the channel selected also all items that are associated with it (even when they purely are configured within an items file):
e.g.

so you easily should see if more than one item is associated with the things channel