openhab-core icon indicating copy to clipboard operation
openhab-core copied to clipboard

Unexpected item state restore with OH4.3

Open spacemanspiff2007 opened this issue 7 months ago • 1 comments
trafficstars

Similar to #3605

Steps to reproduce:

Create a fresh installation of 4.3.3 and install mapdb persistence.

Observe that no standard persistence service is configured: Image

Create an item and post a state to the item. Delete item and create it again. Observe that the previous state is restored through mapdb.

Observed events:

# Create item
{"type":"ItemAddedEvent","topic":"openhab/items/TestItem/added","payload":"{\"type\":\"String\",\"name\":\"TestItem\",\"label\":\"\",\"category\":\"\",\"tags\":[],\"groupNames\":[]}"}

# Udate state
{"type":"ItemStateUpdatedEvent","topic":"openhab/items/TestItem/stateupdated","payload":"{\"type\":\"String\",\"value\":\"my_string\"}"}
{"type":"ItemStateChangedEvent","topic":"openhab/items/TestItem/statechanged","payload":"{\"type\":\"String\",\"value\":\"my_string\",\"oldType\":\"UnDef\",\"oldValue\":\"NULL\"}"}

# Remove item
{"type":"ItemRemovedEvent","topic":"openhab/items/TestItem/removed","payload":"{\"type\":\"String\",\"name\":\"TestItem\",\"label\":\"\",\"category\":\"\",\"tags\":[],\"groupNames\":[]}"}

# Create item with same name
{"type":"ItemAddedEvent","topic":"openhab/items/TestItem/added","payload":"{\"type\":\"String\",\"name\":\"TestItem\",\"label\":\"\",\"category\":\"\",\"tags\":[],\"groupNames\":[]}"}

# Observe state restore
{"type":"ItemStateUpdatedEvent","topic":"openhab/items/TestItem/stateupdated","payload":"{\"type\":\"String\",\"value\":\"my_string\"}"}
{"type":"ItemStateChangedEvent","topic":"openhab/items/TestItem/statechanged","payload":"{\"type\":\"String\",\"value\":\"my_string\",\"oldType\":\"UnDef\",\"oldValue\":\"NULL\"}"}

Since no persistence service is configured as a default persistence no restore should happen.

spacemanspiff2007 avatar Mar 25 '25 09:03 spacemanspiff2007