I thought postUpdate would only send the command to the device if it was changing the value, of course with persistence configured.
It’s been a while since I’ve had to edit my rules, but I use that a lot in there still.
There is a lot of misunderstanding in that sentence.
postUpdate
only sends updates to Items, not commands; updates and commands are two different events (changed is a third type of event)- an Item can be updated without changing and that update will be an event
- persistence has nothing to do with any of this outside of the fact that persistence can be configured to save commands, changes, or updates to the database when they occur. If you choose to save updates, the state of the Item need not change to save the value.
While not included in the statement I think there is a final confusion which might be included there which is only commands go to the binding and therefore out to the devices. Furthermore, commands never change the state of an Item. An Item may receive an update in response to processing a command, and that update may or may not result in a change.
Let’s say that a Switch is ON and we sendCommand OFF to that Item. The following events will occur:
- commanded to OFF (picked up by the binding and send to the device)
- updated to OFF (either by the binding when the device reports when it’s changed state or by autoupdate predicting the new state)
- changed to OFF
Now let’s say that Switch is OFF and we postUpdate ON to that Item. The following events will occur:
- updated to ON (binding is not involved)
- changed to ON
Updates are internal to OH.
Now let’s say that Switch is OFF and we postUpdate OFF to that Item. The following event will occur:
- updated to OFF
3 Likes