Rule with received command is not fired

Hello All,

I have a rule which relies on a zwave scene button.

When i rely on the below condition and use the switch:

rule “Devolo 1 Switch”
when
Item Dsc1_Scene received update
then
logInfo(“LightsRule”, “Devolo Switch received command”)
end

The rules works fine.
When i do it like this:

rule “Devolo 1 Switch”
when
Item Dsc1_Scene received command
then
logInfo(“LightsRule”, “Devolo Switch received command”)
end

The rule doesn’t get fired at all… i dont receive any errors, it just not fired at all.

Any ideas?

(I think that) If the item type is a Number, it doesn’t get commands, only updates.

http://docs.openhab.org/configuration/items.html#type

I use a Number type for my Scenes:

/* Fibaro Push Buttons FGBP-101 */
Number  FibBut01_Scene		"FB01 Scene: [%s]"		<contact>	(gZWave)	{channel="zwave:device:ZW090C:node9:scene_number"}

Then, in my rules:

rule	"Fibaro Button 01 Pushing"
when
	Item FibBut01_Scene received update
then
	[...]
end

Thats new to me :slight_smile:

Thanks for replying…

Another question though, the received update will be triggered if the scene switch is just reporting status in the wake up… correct? Which mean the rule will then be fired as well.

I am not sure if I am right about the Number item type and the received command part…
I never tried that combo since I have been using received update with my Number items.
Maybe some else can share experiences here also.

Unfortunately… (I think that) you are correct.

I believe that I have seen this (or a similar) behavior also in my system.
When I restart OH2, my scene rules are triggered/fired.
I believe that this has to do with the persistence service (mapdb) and the restoreOnStartup option (and not so much with the status update due to the endpoint device wake up)
The state of the Number item is being updated and the rule fires based on the conditions that I set for the scene.

24-Oct-2017 21:25:55.785 [INFO ] [.smarthome.ui.basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
24-Oct-2017 21:25:57.271 [INFO ] [org.eclipse.smarthome.model.script.FB01           ] - FB01 1x pushed
24-Oct-2017 21:25:57.288 [INFO ] [org.eclipse.smarthome.model.script.FB02           ] - FB02 kept in

I will remove these items from my persistence group and report back soon :slight_smile:

That’s exactly what is happening to me and that’s why i wanted to use received command, but it doesnt fire at all.

Let’s see if someone else going to share his experience here.

Thanks alot anyway for fast replying…

1 Like

I don’t know that a Number Item cannot receive a command but it is likely that the binding will only postUpdate for a Number Item. I’m pretty sure I’ve used a Number Item with a Switch with Mappings on the sitemap to sendCommand trigger some rules.

Anyway, I had to deal with something similar back when I had a Minimote set up. What I did was have the rule that does the work trigger on changed and another rule that immediately changes the Item to NULL. It would look something like this:

rule "Devolo 1 Switch"
when 
    Item Dsc1_Scene changed
then
    if(Dsc1_Scene.state != NULL){
        logInfo("LightsRules", "Devolo Switch changed")
    }
end

rule "Reset Devolo 1 Switch"
when
    Item Dsc1_Scene received update
then
    if(Dsc1_Scene.state != NULL) Dsc1_Scene.postUpdate(NULL)
end

However, I’m not sure that actually addresses the status reporting wake up. The Minimote is battery powered so there was no status reporting. This could be a tough one.

1 Like

Thanks guys for replying.

Unfortunately the normal zwave update/wakeup triggers the rule which is causing disturbance for the lights…
I set the wake up time to 1 week for now.

I wanted to use in-wall relays but i have only the live wire running behind the face plate and no access to neutral wire at all :frowning:
Is there a smart solution for this case??