-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[systeminfo] QuantityTypes and state descriptions cleanup #13804
Conversation
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
bundles/org.openhab.binding.systeminfo/src/main/resources/OH-INF/thing/channels.xml
Outdated
Show resolved
Hide resolved
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Test fail because DataAmount unit conversions do not work properly, see #3207. |
...teminfo/src/main/java/org/openhab/binding/systeminfo/internal/model/SysteminfoInterface.java
Show resolved
Hide resolved
...teminfo/src/main/java/org/openhab/binding/systeminfo/internal/model/SysteminfoInterface.java
Show resolved
Hide resolved
...teminfo/src/main/java/org/openhab/binding/systeminfo/internal/model/SysteminfoInterface.java
Show resolved
Hide resolved
...g.systeminfo.tests/src/main/java/org/openhab/binding/systeminfo/test/SysteminfoOSGiTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
This a breaking change as users will have to change their item types. |
What are we doing ? |
Code is good for me, I am just waiting for a successful compilation. |
Maybe (just an idea) the problem could be that we are using a unit defined by the OH core framework (Units.MEBIBYTE), not an official unit ? Edit: I see that @J-N-K just proposed a fix in core framework. |
This will also fail. The fix is in openhab/openhab-core#3208. But it should be checked if the binding really delivers |
Good remark. Hoping @mherwege can retrieve this information.
Of course, users will have to change their item types. But as this PR improve something (ability for the users to choose their displayed units), this is acceptable, no ? |
The binding should return the correct value (probably |
Understood. For the 2 other bindings, I hope there is no mismatch between MB and MiB. |
So far, the binding always returned MiB (so 1024 x 1024 bytes), but the state description was MB. I kept the state description, but the methods return MiB (there is even a method in the binding (getSizeInMB) that actually returns MiB, rather than MB. All methods returning data amounts rely on this method. So the calculation is correct. |
I think you should still be able to just keep a Number item without dimension linked to the channels with dimension. So I am not sure this makes it a breaking change. |
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Makes sense, so went for that in the last commit. |
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
Can I merge or should I wait for the fix in core framework? Can you prepare something for the release notes? |
@lolodomo Yes, I will prepare something for the release notes. It should work now as long as one does not do unit conversions on DataAmount and sticks with MiB. That is no worse then it was before, and will get better ones the core change is done. |
Please do it here. I will wait. |
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
Where do I have to push the content for the release notes? |
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, thank you
Your PR in openhab-distro is fine and should be sufficient. |
) * State descriptions cleanup * Converted channels to QuantityType, adjusted default translations * Channel definitions and percent to QuanityType * Changed default state descriptions from MB to MiB Signed-off-by: Mark Herwege <mark.herwege@telenet.be> Signed-off-by: Ben Rosenblum <rosenblumb@gmail.com>
) * State descriptions cleanup * Converted channels to QuantityType, adjusted default translations * Channel definitions and percent to QuanityType * Changed default state descriptions from MB to MiB Signed-off-by: Mark Herwege <mark.herwege@telenet.be> Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
) * State descriptions cleanup * Converted channels to QuantityType, adjusted default translations * Channel definitions and percent to QuanityType * Changed default state descriptions from MB to MiB Signed-off-by: Mark Herwege <mark.herwege@telenet.be> Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
Signed-off-by: Mark Herwege mark.herwege@telenet.be
Changes in core UOM handling make the system uptime channel interpret the minutes as seconds when linking an Number:Time item to the channel. This is because the state description has a wrong UOM. See core issue #3183.
This PR does a cleanup of descriptions and default state descriptions to avoid this issue.
Closes #3183.
Another issue has been discovered #13709 with unit conversions in relation to this binding. I don't see an immediate reason for this in the binding. If you have ideas, please suggest and I will include in this PR.