Rule: received command or received update

Hi,
what is the difference between this two things on top of a rule?

I have a rule:

when Item Light_Switch received update
then Lamp.sendCommand(ON)

What will be, if i change to “received command”?

Could this be, that after a server restart the persisted Light_Switch or the persisted Lamp gets the persisted value and the rule fires if i use “received update”?

Some of my light switches, Blinds and so on have a strange behaviour when i make a openhab server reboot.

http://docs.openhab.org/configuration/rules-dsl.html#manipulating-item-states

Edit: sorry, wrong link …

2nd Edit; here we go:

1 Like

thanks for linking the documentation :sweat_smile:

@halloween please let us know if the answer is not there and I hope we can answer it here and in docs.

Not directly…

When i reboot my openhab server, sometimes i get strange things. Some lights switch on, blinds open, …

I think this is because of the persistence wich is restoring the previous state to the item and when there is a rule with " when item received update", then this rule will fire.

So to prevent the rule from firing when the persistence restores the persisted value to the item on startup, i have to change the rule to “when item received command” ?

Am i right?

1 Like

Well… not quite. May i ask why you activated restoreOnStartup for these items to begin with? The state of lights or blinds which are directly linked to a binding don’t have to (i could even say “shouldn’t”) be restored.

Restoring restores previous, possibly outdated and wrong, data. Think about the usefulness of that. Items that are supposed to represent the real world should be influenced by the binding. If the binding doesn’t send data (e.g. because the device is offline) you want your item to stay in the NULL state for further processing. You only want to use the RestoreOnStartup functionality for abstract data like aggregated states.

I don’t use restoreOnStartup in my setup at all…

1 Like

Because some of my items gets new updates at big time intervals.

Example is Xiaomi Mi Home Gateway and the Temp-Sensors or Door-Sensors. They only send an update every 50 minutes, if there is no movement / temp-difference / … in this time.

Or my hoermann garage door with knx gatway. It only sends new values when there is a movement of the door.

But i think i have found the problem in my config. I sometimes have all items of one thing in the same group. Sensor-Values and Switches also. I removed the switches and only restore the sensor values on startup - and i changed some rules to only update the item state, but not sending a command. So i hope i can prevent openhab to do silly things in future.

A few days ago my garage door was opened after a server reboot. Not so goot, if you are not at home…