mirror of
https://github.com/danieldemus/openhab-core.git
synced 2026-07-29 12:34:22 +02:00
Fix textual things not updating on the first change (#4219)
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
This commit is contained in:
+5
-1
@@ -605,8 +605,9 @@ class GenericThingProvider extends AbstractProviderLazyNullness<Thing> implement
|
||||
if (!loadedXmlThingTypes.contains(factory.bundleName) || modelRepository == null) {
|
||||
return
|
||||
}
|
||||
val things = thingsMap.get(modelName)
|
||||
val oldThings = things.clone
|
||||
val newThings = newArrayList()
|
||||
val oldThings = thingsMap.put(modelName, newThings)
|
||||
|
||||
val model = modelRepository.getModel(modelName) as ThingModel
|
||||
if (model !== null) {
|
||||
@@ -619,10 +620,13 @@ class GenericThingProvider extends AbstractProviderLazyNullness<Thing> implement
|
||||
val oldThing = oldThings.findFirst[it.UID == newThing.UID]
|
||||
if (oldThing !== null) {
|
||||
if (!ThingHelper.equals(oldThing, newThing)) {
|
||||
things.remove(oldThing)
|
||||
things.add(newThing)
|
||||
logger.debug("Updating thing '{}' from model '{}'.", newThing.UID, modelName);
|
||||
notifyListenersAboutUpdatedElement(oldThing, newThing)
|
||||
}
|
||||
} else {
|
||||
things.add(newThing)
|
||||
logger.debug("Adding thing '{}' from model '{}'.", newThing.UID, modelName);
|
||||
newThing.notifyListenersAboutAddedElement
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user