-
-
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
[jdbc] Return QuantityTypes for number items with dimension #9426
Conversation
Yes, certainly. This is for post 3.0, correct? |
Thank you. Yes, my plan is to introduce this feature after OH 3 release. |
cb034ea
to
31072f0
Compare
I added a check which excludes all value having base unit |
31072f0
to
5906dc5
Compare
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
5906dc5
to
df7b4e4
Compare
I am running this version for nearly two weeks now and it seems to be stable. Feel free to do some additional testing or start review. Thanks. |
One quick comment... If we're upgrading the mysql jdbc driver version to 8.0.13, this log message should be changed, too. |
And, unrelated to your PR, this line could be made debug. |
Not sure if we have to do it, because the message shows information about the minimum required version. I thought about that too when I increased the MariaDB connector version but decided to not change it. |
But when I installed 5.1.37, it didn't work. Then I looked in the pom and saw the 8.0.13 dependency. So I installed 8.0.13 and it started to work. I'll try again to see what it's complaining about. |
Maybe I missing something, but none of the 5.1.* or 6.0.* versions I've tried will work for me. Only the 8.0.x versions work. The older versions all result in this.
I realize this is unrelated to your changes, so let me see if I can get it sorted out. |
tbh I don't know which version is missing for MySQL and when it has been changed to the used one. Maybe you can find an answer on the old openhab1-addons repository. |
In openhab1-addons, I saw where the mysql persistence service was updated to use the 8.0.13 driver back in November 2018, and the mysql version in the jdbc persistence service was updated to use 8.0 in December 2018. But the jdbc service's README still says it was tested with the 5.1.39 driver version. I dunno. In any event, 8.0.13 works so that's what I'm using. Question on Even the documentation is confusing, as it doesn't say anything about the return type of Further down in the README here, it shows an example using temperature where it actually includes the units in answer. 🤔 |
I agree, the docs might be confusing in the example. Beside others
|
Ok, that's what I figured. And changing it will be a breaking change, right? Since existing rules depend on those functions always returning a DecimalType. Other than that bit of confusion on my part, everything I've seen looks good. |
Changing the return value is a breaking change. |
I ran into another issue, but I don't think it's related to your changes because it also happens when I use an item defined as just a plain The functions I know this call works, because it's also used to get But here, does Or, is there something else I'm missing? |
I added the line |
Thanks for the analysis. What makes me curious is that my unit test in PersistenceExtensionsTest are working. Might they be wrong too? |
Hmm. That's really weird. Am I right that by the time it gets to line 400, the iterator |
Doesn't there need to be an |
🤦 Guess what ... The methods // EDIT: You figured it a second before me. And your suggestion is working. 👍 PR would be appreciated. Thanks. |
Sure. Will do. Shall I also add the annotations to the tests? |
Of course. This will validate that you are right. 😉 |
Tests now run and succeed. |
@openhab/add-ons-maintainers Ready for review. Thanks. |
…9426) Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
…9426) Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
QuantityType
s for number items with dimensionThis implementation uses the same approach like introduces for RRD4J in #8866 and #8938. But I am seeing some issue with Items of type
Number:Dimensionless
.In general it would be possible to extend the database structure by adding a column for the unit for number items. This will need a little bit more effort.
@mhilbush May I ask you to chime in and help testing?
Related to openhab/openhab-core#1954
Signed-off-by: Christoph Weitkamp github@christophweitkamp.de
Depends on #9445