Skip to main content Link Search Menu Expand Document (external link)


store_states takes one or more items or groups and returns a map {Item => State} with the current state of each item. It is implemented by calling OpenHAB’s events.storeStates().

states = store_states Item1, Item2 

or in a block context:

store_states Item1, Item2 do
end # the states will be restored here

It can take an array of items:

items_to_store = [ Item1, Item2 ]
states = store_states items_to_store
states.restore_changes # restore only changed items

The returned states variable is a hash that supports some additional methods:

restoreRestores the states of all the stored items by calling events.restoreStates() internally
changed?Returns true if any of the stored items had changed states
restore_changesrestores only items whose state had changed