-
-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve thing updates #3576
Improve thing updates #3576
Conversation
I am going to run again my scenario with the meteoalerte binding. |
@J-N-K : it looks clearly better ;) First subject: the warning in log and the updated thing configuration. Is it expected ?
Please note the warning about normalizing configuration and
and the thing config after migration:
As you can see the "refresh" config parameter value was changed from 1440 to 1440.0. Is it normal and expected ? The NOT_YET_READY status and the delay to initialize this thing is probably not related to the migration ? |
Second point that needs your feedback: I see that on all my unchanged channels, something was added: |
But what is important to say is that you have apparently fixed the issue I declared. I mean Example of channel before:
and after migration:
|
Looking at #3575 I think that |
The |
Does your branch includes Kai's change ? |
This is almost secondary. The real question is why I have this warning and why the parameter value is updated ? As a reminder, the thing was created using MainUI and I did not set/update this parameter. |
The value is probably also changed when you set it to Regarding the warning: do you see the channel-type in the registry? |
That would mean there is no config normalization when MainUI creates or updates the thing ? I can try again to restart OH keeping the original binding, just to confirm if I see the same warning and the same change of value, or if the warning and the change of value is only triggered by the thing migration.
You mean in org.openhab.core.thing.Thing.json file ? |
Yes, that's the way it works. The issue is that the value is written as-is to the database, so if MainUI sets 1440, 1440 is written to the database. However, when the entry is de-serialized, GSON makes 1440.0 of it (because all numbers are converted to doubles). The normalization code then uses the config description to convert it to 1440. During the thing-update the config is read (so it can be applied later) and written to the database. It doesn't matter if the database has 1440 or 1440.0 in it, the normalization code converts it to 1440 before the configuration is applied. The goal is not to mimic what the UI does, the goal is to make it functionally equivalent. This is obviously not the case when the |
No, I mean if you use the API Explorer under |
Ok but why is a warning logged if this is not important ? |
The warning is independent from the update, it is written by the I didn't check if this is the case here, but if e.g. the "old thing" has a channel-type |
Yes, exactly, that is this scenario, a channel type was removed (meteoalerte:alert-level) and new channel types were created.
So the NOT_YET_READY status and the delay of 120s is now explained. Remains the warning. |
I have now installed the last snapshot (3434). |
Same result with the snapshot 3434 patched with this PR. Migration code adds |
Result of GET /channel-types/meteoalerte:pluie-inondation:
No channels have a configuration.
|
I have fixed the validation message. Let's see what the ThingManager thinks is missing. |
Here is the result:
This is the channel type description that is missing ?
|
Maybe I got it: the original channel in org.openhab.core.thing.Thing.json has no description:
Just because the original channel type (meteoalerte:alert-level) had no description. I believe it should not trigger a warning when migrating to a new channel type having a description. |
And the log is about normalizing configuration while it seems to have nothing to do with configuration, neither thing configuration nor channel configuration. |
We can also notice that the migration changes the order of channels for the thing. I am going to create an issue but I already imagine it is not easy to fix. I also compared my migrated thing with a new thing created with MainUI. The only differences I can find (in my specific case) were already discussed:
|
The only issue I see is the warning for the missing channel type. But that is not related to the thing updates. |
Is that the message AFTER or BEFORE the migration? If it is AFTER the migration then something is wrong, because there should not be an "old" channel in the checking. If it is before, it's difficult to suppress, because we would need to know before the upgrade if the channel will be removed/replaced. Suppressing it all the time would hide "real issues". |
Where is stored the new storage ? I don't find it in userdata/jsondb. What is its name ? |
The updated thing is stored in the usual JSON database, there is no additional storage for that. The update process should remove the old and put the updated thing to storage. That's why I am wondering why the check is performed for the "old" channel-type after the upgrade. |
Ah ok.
As you previously said, we don't know if it is a log after or before the upgrade. Unfortunately, the log mentions the channel UID but not the channel type UID. |
Signed-off-by: Jan N. Klug <[email protected]>
Signed-off-by: Jan N. Klug <[email protected]>
9de9efd
to
2845378
Compare
Signed-off-by: Jan N. Klug <[email protected]>
I have added the missing description UID to the validation message. You could set a breakpoint to where the message is created (l. 680) and check what actually is in the channel type registry at that point. |
Ok, here is with the new log message:
So the warning is about channel type "meteoalerte:alert-level" which is in fact the old and removed channel type. |
Yes, that's an issue. If you look at the database: What is in there for this channel? |
Before upgrade:
and after upgrade:
|
That looks good. Can you try adding unique identifiers (like prefixing the message with 1, 2, 3 or the line-number) to the log messages in l. 409, 415 and 923? I would like to see where this really comes from. |
The log is coming from line 409, so when normalizing the old thing. |
Yes, we can probably reduce that to DEBUG. The reason it was introduced at all in #3157 was to provide consistent, normalized data in the |
Signed-off-by: Jan N. Klug <[email protected]>
Fine, thank you @J-N-K , the warning disappeared. Regarding the remaining warning:
the last part of the message (This should be fixed in the binding) annoys me as in my current case, there is nothing to fix in the binding. |
Can you suggest a better wording? It should be clear that if this happens not immediately after an upgrade that is a bug. Unfortunately we can't detect whether this is the first startup after an upgrade or just a restart. |
Something like that ? "In case this is not triggered during a thing upgrade, it should be fixed in the binding." |
@J-N-K : is my proposal to update the log message ok for you? @openhab/core-maintainers : it would be cool to review & merge this PR quickly before we merge more and more add-ons PR including thing upgrade instructions. |
Signed-off-by: Jan N. Klug <[email protected]>
Thank you @J-N-K |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks.
* Improve thing updates Signed-off-by: Jan N. Klug <[email protected]> GitOrigin-RevId: 960cf0c
Fixes #3574