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

Normalize thing configuration before initialization

Open J-N-K opened this issue 3 years ago • 1 comments

There were some reports on the forum that de-serialized values (and probably other) do not have the correct type. We already normalize thing configurations when they are set via REST API, but it seems that under some circumstances integer values are not properly de-serialized. This PR adds normalization of the configuration before the thing is initialized.

This is not the best solution, but unfortunately it'll get very complex otherwise. The best would be to normalize the configuration immediately when it is read from the database, but that can't be done because the config description needed for that is not available at the time the thing registry is first filled. Holding back things in the ManagedProvider would require keeping track of the config descriptions and thus duplicating what is already in the ThingManagerImpl.

Doing it before the initialization might also mitigate problems with integer/string values in textual configuration.

Signed-off-by: Jan N. Klug [email protected]

J-N-K avatar Jul 01 '22 16:07 J-N-K

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/parsing-integer-config-entries-results-in-an-error-since-3-3-0-stable/136960/3

openhab-bot avatar Jul 02 '22 15:07 openhab-bot

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/tapocontrol-control-tapo-smart-wifi-devices-with-openhab/118389/180

openhab-bot avatar Sep 26 '22 17:09 openhab-bot