Skip to content
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

[WlanThermo] Add support for new Nano V3, Mini V3, Link V1, Mini V1/V2(ESP32) devices [V3.x] #9579

Merged
merged 40 commits into from
Jan 18, 2021

Conversation

CSchlipp
Copy link
Contributor

@CSchlipp CSchlipp commented Dec 29, 2020

This PR adds support for the new Nano V3, Mini V2 (with ESP32-Upgrade), and Link V1 devices.

The API of these hardware versions has changed compared to the previous devices, but is the same for the whole new platform (thus named "esp32"). This commit follows the same approach as the initial contribution and contains auto-generated classes for parsing the new JSON output.

The thing description xml has been spit up to different files to ease the future development.
No further changes to existing things, thus backwards compatible.

Configuration of different thing types has been merged to avoid duplicate code.

Backport of changes to 2.5.x branch via PR #9580 (same changes)

@CSchlipp CSchlipp changed the title [WlanThermo] Add support for new ESP32-powered devices [WlanThermo] Add support for new ESP32-powered devices [V3.x] Dec 29, 2020
@Hilbrand Hilbrand added the enhancement An enhancement or new feature for an existing add-on label Dec 29, 2020
@fwolter fwolter self-assigned this Dec 31, 2020
Copy link
Member

@fwolter fwolter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your code doesn't build, because there are some checkstyle errors. You could take a look at target/code-analysis/report.html.

@CSchlipp CSchlipp force-pushed the wlanThermoBinding-v3 branch from 1d81981 to b164d7b Compare December 31, 2020 13:56
@CSchlipp
Copy link
Contributor Author

CSchlipp commented Jan 1, 2021

Thanks for the review!
All required changes, except for the scheduler, are included with the last commits. Some of the improvements have also been ported to the other supported hardware versions.

Local builds do not show any blocking checkstyle errors, let's wait for the Jenkins build...

@CSchlipp
Copy link
Contributor Author

CSchlipp commented Jan 1, 2021

License Headers were missing.
Why isn't this reported during local mvn install?

Signed-off-by: Christian Schlipp <[email protected]>
Signed-off-by: Christian Schlipp <[email protected]>
Signed-off-by: Christian Schlipp <[email protected]>
Signed-off-by: Christian Schlipp <[email protected]>
Signed-off-by: Christian Schlipp <[email protected]>
Signed-off-by: Christian Schlipp <[email protected]>
further improved logging

Signed-off-by: Christian Schlipp <[email protected]>
Signed-off-by: Christian Schlipp <[email protected]>
Specify Quantity Type for Temperature and Power Channels

Signed-off-by: Christian Schlipp <[email protected]>
Signed-off-by: Christian Schlipp <[email protected]>
Signed-off-by: Christian Schlipp <[email protected]>
Signed-off-by: Christian Schlipp <[email protected]>
@CSchlipp CSchlipp force-pushed the wlanThermoBinding-v3 branch from ae80ec0 to 65628c9 Compare January 3, 2021 15:00
Revert to default scheduler

Signed-off-by: Christian Schlipp <[email protected]>
@CSchlipp
Copy link
Contributor Author

CSchlipp commented Jan 3, 2021

The build failed during the Feed-Binding Integration Tests - seemingly unrelated to this binding or the changes within this PR.
Could it be related to #9610?

Signed-off-by: Christian Schlipp <[email protected]>
@CSchlipp CSchlipp requested a review from fwolter January 5, 2021 16:23
Copy link
Member

@fwolter fwolter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some checkstyle warnings left. You could take a look at target/code-analysis/report.html.

Signed-off-by: Christian Schlipp <[email protected]>
Signed-off-by: Christian Schlipp <[email protected]>
@CSchlipp
Copy link
Contributor Author

Argh, missed the last spotless:apply commit. Would you label it for rebuild again, please?
Sorry for the inconvenience caused...

@cpmeister cpmeister added rebuild Triggers Jenkins PR build and removed rebuild Triggers Jenkins PR build labels Jan 15, 2021
@cpmeister
Copy link
Contributor

Argh, missed the last spotless:apply commit. Would you label it for rebuild again, please?
Sorry for the inconvenience caused...

No problem.

@cpmeister
Copy link
Contributor

Just need to get a completed jenkins build that succeeds. Did you ever address @fwolter's comment about the target/code-analysis/report.html?

I couldn't find any checkstyle warnings in my local build anymore.
There are some warnings about potential null pointer access due to Gson having @nullable return objects. All of them should now be covered by a check for null before accessing the object, so this should be false positives.

Actually, the potential null pointer access warnings I see there would be caused by using nullable fields directly instead of caching the field into a local variable first. The null checker assumes that any nullable field can become null at any time due to concurrency. And yes, I understand that it is often a wrong assumption but it is also the safest assumption.
So please make an effort to address those null pointer warnings.

Ensure Gson objects are NonNull
Generify Handlers
Generify Utils

Signed-off-by: Christian Schlipp <[email protected]>
@CSchlipp
Copy link
Contributor Author

Actually, the potential null pointer access warnings I see there would be caused by using nullable fields directly instead of caching the field into a local variable first. The null checker assumes that any nullable field can become null at any time due to concurrency. And yes, I understand that it is often a wrong assumption but it is also the safest assumption.
So please make an effort to address those null pointer warnings.

Guess I've found a quite pretty solution for the null pointer warnings.
Additionally, I've added unit tests for all models and moved a lot of duplicated code & logic to parent classes.

Would you please trigger a rebuild? Thanks!

@cpmeister cpmeister added rebuild Triggers Jenkins PR build and removed rebuild Triggers Jenkins PR build labels Jan 17, 2021
move test json to resources

Signed-off-by: Christian Schlipp <[email protected]>
Signed-off-by: Christian Schlipp <[email protected]>
Copy link
Contributor

@cpmeister cpmeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cpmeister cpmeister added rebuild Triggers Jenkins PR build and removed rebuild Triggers Jenkins PR build labels Jan 18, 2021
@cpmeister
Copy link
Contributor

The build failed, looks like you need to run spotless.

Signed-off-by: Christian Schlipp <[email protected]>
@CSchlipp
Copy link
Contributor Author

This is driving me nuts some day...
Sorry, fixed.

@cpmeister cpmeister added rebuild Triggers Jenkins PR build and removed rebuild Triggers Jenkins PR build labels Jan 18, 2021
@cpmeister cpmeister merged commit d8e5a57 into openhab:main Jan 18, 2021
@cpmeister cpmeister added this to the 3.1 milestone Jan 18, 2021
@CSchlipp CSchlipp changed the title [WlanThermo] Add support for new ESP32-powered devices [V3.x] [WlanThermo] Add support for new Nano V3, Mini V3, Link V1, Mini V1/V2(ESP32) devices [V3.x] Jan 19, 2021
@CSchlipp
Copy link
Contributor Author

Thanks again!
I've updated the PR name to be more precise in the changelogs.

themillhousegroup pushed a commit to themillhousegroup/openhab2-addons that referenced this pull request May 10, 2021
…b#9579)

* Add support for ESP32 devices
* Add Unit Tests
Ensure Gson objects are NonNull
Generify Handlers
Generify Utils

Signed-off-by: Christian Schlipp <[email protected]>
Signed-off-by: John Marshall <[email protected]>
thinkingstone pushed a commit to thinkingstone/openhab-addons that referenced this pull request Nov 7, 2021
…b#9579)

* Add support for ESP32 devices
* Add Unit Tests
Ensure Gson objects are NonNull
Generify Handlers
Generify Utils

Signed-off-by: Christian Schlipp <[email protected]>
marcfischerboschio pushed a commit to bosch-io/openhab-addons that referenced this pull request May 5, 2022
…b#9579)

* Add support for ESP32 devices
* Add Unit Tests
Ensure Gson objects are NonNull
Generify Handlers
Generify Utils

Signed-off-by: Christian Schlipp <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants