[SOLVED] Since switch to OH 2 simple On off rule does not work anymore

the automatic created linked items can´t be used in rules can they?

I wouldn’t really know. I have always added Z-Wave devices in PaperUI with the automatic linking, and then writing .items file as you did in your first post.

YOU ARE THE MAN!!! its finaly working again :wink: I assume the reporting thing war the missing piece…also the wall plug is triggewring the rule again…alltough it is 5 sec delay so after the white is turned on it takes arround 5 sec until the defined colors from the rule apply to the adsditional LEDs. Not really perfect as it was instant with OH1 but that might be another strange settting somewhere… do you have a idea? :smiley:

Not other than I recall you said you are running OH2.3 ?
In OH2.4M and SNAPSHOT there is a new Z-Wave binding that has received a lot of love from the maintainer.
But be aware of a breaking change! Read posts from @chris about it.
I would make that switch sooner rather than later.

Hi there is nothign I can breake
all you have seen is all what is in the OH 2 at the moment
so its a 3 files copy job :smiley: I will just go for it in a couple of minutes and see if that is changing anything :smiley:

Thx a lot… if I coudl I would hug you now :wink:

Go for it.
Really all you have to do is delete each and every Z-Wave thing (not exclude!) and just do a new Z-Wave search that will appear in the Inbox. Just re-add it. No need to re-include!

i tried the following:
item:

Dimmer			Dummy2	"Testschalter Dummy2 [%s]" (gPower)

sitemap:

    Switch item=Dummy2
    Default item=Dummy2

Rule:

rule "Test Dummy2"
when
    Item Dummy2 received command
then
    logInfo("Dummy2.rules", "Switch: " + Dummy2 + " Command: " + receivedCommand)
end

and the logger says, when dimming or switching:

2018-11-09 00:55:12.496 [INFO ] [.smarthome.model.script.Dummy2.rules] - Switch: Dummy2 (Type=DimmerItem, State=33, Label=Testschalter Dummy2, Category=null, Groups=[gPower]) Command: 33
2018-11-09 00:56:26.475 [INFO ] [.smarthome.model.script.Dummy2.rules] - Switch: Dummy2 (Type=DimmerItem, State=61, Label=Testschalter Dummy2, Category=null, Groups=[gPower]) Command: 61
2018-11-09 00:56:28.926 [INFO ] [.smarthome.model.script.Dummy2.rules] - Switch: Dummy2 (Type=DimmerItem, State=16, Label=Testschalter Dummy2, Category=null, Groups=[gPower]) Command: 16
2018-11-09 00:56:59.822 [INFO ] [.smarthome.model.script.Dummy2.rules] - Switch: Dummy2 (Type=DimmerItem, State=0, Label=Testschalter Dummy2, Category=null, Groups=[gPower]) Command: OFF
2018-11-09 00:57:01.539 [INFO ] [.smarthome.model.script.Dummy2.rules] - Switch: Dummy2 (Type=DimmerItem, State=100, Label=Testschalter Dummy2, Category=null, Groups=[gPower]) Command: ON

If your using the dimmer you will get a value as receivedCommand and if your using the switch you will get ON or OFF, but the state will allways be between 0 - 100.

So try an “if-function” in the rule to check the receivedCommand, if it’s ON/OFF or value.

Could this be a possibility for a solution?

Something like that:

rule "Test Dummy2"
when
    Item Dummy2 received command
then
    logInfo("Dummy2.rules", "Switch: " + Dummy2 + " Command: " + receivedCommand)
    if ( receivedCommand == ON)
    {
    logInfo("Dummy2.rules", "ON: " + Dummy2 + " Command: " + receivedCommand)
    return;
    }
    if ( receivedCommand == OFF)
    {
    logInfo("Dummy2.rules", "OFF: " + Dummy2 + " Command: " + receivedCommand)
    return;
    }
    else
    {
    logInfo("Dummy2.rules", "value: " + Dummy2 + " Command: " + receivedCommand)
    }

end

Try:

rule "Test Dummy2"
when
    Item Dummy2 received command
then
    logInfo("Dummy2.rules", "Switch: " + Dummy2 + " Command: " + Dummy2.state)
    if ( Dummy2.state== ON)
    {
    logInfo("Dummy2.rules", "ON: " + Dummy2 + " Command: " + Dummy2.state)
    return;
    }
    if ( Dummy2.state== OFF)
    {
    logInfo("Dummy2.rules", "OFF: " + Dummy2 + " Command: " + Dummy2.state)
    return;
    }
    else
    {
    logInfo("Dummy2.rules", "value: " + Dummy2 + " Command: " + Dummy2.state)
    }

end

Thank you all for your answers and input. To complete the whole thing. I woudl like to drop the final rule wich proved to be working. Sometimes a little delayed I don´t understand why, but at least its always working. I had to replace the “received command” as this was causing my z-stick do go nuts and made the system inpoerational. It happend multiple times duiring testing, therefore I had to replace it by “changed from OFF to ON”. So here is the final result, maybe it helps the one or the other.

rule “Esszimmerlampe einschalten”
when
Item EsZi_Lampe_Weiss_SW changed from OFF to ON
then
sendCommand(EsZi_Lampe_Gruen, 100)
sendCommand(EsZi_Lampe_Weiss, 25)
sendCommand(EsZi_Lampe_Blau, 25)
end

rule “Esszimmerlampe ausschalten”
when
Item EsZi_Lampe_Weiss_SW changed from ON to OFF
then
sendCommand(EsZi_Lampe_Rot, OFF)
sendCommand(EsZi_Lampe_Blau, OFF)
sendCommand(EsZi_Lampe_Gruen, OFF)
sendCommand(EsZi_Lampe_Weiss, OFF)
end

(sorry could not find the rules fence this time :frowning: )