Handle ConfigurationUpdate

Hello,

I am trying to process configuration changes from the WebUI. I found the method

 handleConfigurationUpdate 

of the

 BaseThingHandler

I reused it in my class but it never gets called. Why?

@Override
public void handleConfigurationUpdate(Map<String, Object> configurationParameters) {
}

My use case is, that if a user has entered a wrong configuration in a Thing, that he is able to change it afterwards without deleting the thing. Any change in the WebUI does not get reflected in my config class neither is the supposed method called.

What am I missing? Could find any specific in the documentation about it.

When a user changes the thing configuration the method initialize in the thing handler will be called and your (re-)initialization process is performed again. (Before this call dispose is called). So you don’t have to do something with handleConfigurationUpdate.

1 Like

Hello, thanks for the reply. It is very much appreciated. However it is not working as expected. If I update something in the configuration of the Thing and Disable and Enable it,

initialize 

is called. However the change in the Configuration is not reflected.

I have the call

config = getConfigAs(HaassohnpelletstoveConfiguration.class);

in the initialization. To my understanding this is receiving the config from the WebUI form. It works by creating the Thing, but if I edit it, as said, I am not able to receive any update of the red circled Configuraiton items.
Any idea why?

If you refresh the webpage does it still contains your updated configuration?

1 Like

If I refresh the page, it still contains the old values.

How do I edit the values then? I enter them, and press enter. It does not take the new values over.
The only way to overcome this, is to Delete the Thing and recreate it. No possibility to edit it?

You need to save it (click the save icon)

I am sorry to say that, but I haven’t even recognized that there is a Save button until you pointed it out for me now. Thanks for you help hilbrand. I am bit shamed that I haven’t seen it myself :sob:

Is it on purpose, that I have to click save two times?

By clicking the first time Save

handleConfigurationUpdate 

is called, but still with the old values.

By clicking it directly after the second time

thingUpdated

is called, then the new values are taken over.
Is that by design?