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

[boschspexor] Initial contribution #12706

Closed
wants to merge 11 commits into from

Conversation

marcfischerboschio
Copy link

Hello guys,

Description

this is the initial contribution to support the Bosch spexor with openHAB 3.2.x.
The binding requires a short simple configuration and provides a servlet which guides any user to setup the plugin.
I already provided an community post with a bit of information about the Bosch spexor here: https://community.openhab.org/t/bosch-spexor-binding-openhab3-beta/135090

The goal of the new Binding is that we would like to enable a) openHAB with a smart sensor that measures Air Quality - Acceleration, Temperature etc. and also b) enable the spexor to other systems easily to get a better user experience.
We do think that also the openHAB could also be used on mobile devices like camper to also get thus smart.

Used libraries

The addon is having a servlet for easy setup and is storing and handling an OAuth 2.0 device code flow mechanism.
Therefore I included some apache 2.0 licensed libraries for better and stable inclusion.
I did some bounding to the internal http client of openHAB to consider system setups of openHAB. It also contains embedded jquery and a QRcode library in javascript based on MIT licenses. I added them also into the source code for traceability.
For more details please see the attached commit information file LICENSES_USED_LIBRARIES

Testing

The code was originally developed based on the 3.1.x version and is now linked to 3.2.x version.
The code is tested with 3.1.x as well as 3.2.x version on Mac - Linux and Windows based openHAB installations.
I created a few unit tests / integration tests to reflect server communication and also the mechanism of the authorization flow to ensure that everything is working proper. The tests are do need a while due to a simulated state.

Code

I checked all coding guidelines and applied them as I understood. Findings are only on Unit tests but the marked issues are wished and should consider error cases. The code is also shared through my department and I'm contributing this we rules of Bosch.IO. Therefore we did also lots of checks regarding security & open source compliance.

Please let me know if I need to change something. My team and me are using this quite a long time and didn't had any bad experience but if so, let me know!!

Marc

@marcfischerboschio marcfischerboschio changed the title Boschspexor main [boschspexor] initial commit of spexor plugin May 9, 2022
@marcfischerboschio marcfischerboschio changed the title [boschspexor] initial commit of spexor plugin [boschspexor] initial contribution of spexor plugin May 9, 2022
@marcfischerboschio marcfischerboschio marked this pull request as ready for review May 9, 2022 16:21
@marcfischerboschio marcfischerboschio requested a review from a team as a code owner May 9, 2022 16:21
@openhab-bot
Copy link
Collaborator

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

https://community.openhab.org/t/bosch-spexor-binding-openhab3-beta/135090/1

@jlaur jlaur added new binding If someone has started to work on a binding. For a new binding PR. labels May 9, 2022
@jlaur jlaur changed the title [boschspexor] initial contribution of spexor plugin [boschspexor] Initial contribution May 9, 2022
Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

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

Thank you for contributing!
I mainly focused on housekeeping and checked allmost all files. I think other reviewers would need to check licences, oauth/servlet and thingstate handling etc If i have more time i try to do another pass.

@marcfischerboschio
Copy link
Author

Latest changes on code due to the recommendation of @lsiepel applied

Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

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

Some small feedback. It's allways good to use a spell checker on documentation before a commit :-)

Please also mark feeedback that is resolved.

bundles/org.openhab.binding.boschspexor/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.boschspexor/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.boschspexor/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.boschspexor/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.boschspexor/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.boschspexor/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.boschspexor/README.md Outdated Show resolved Hide resolved
Copy link
Author

@marcfischerboschio marcfischerboschio left a comment

Choose a reason for hiding this comment

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

added some comment to request more details

@Hilbrand
Copy link
Member

Something went wrong, the pr now seems to include changes for other bindings?

@marcfischerboschio
Copy link
Author

@Hilbrand will try to fix it. Didn't added this - only due to the CDO recommendation...

…ents

Signed-off-by: Marc Fischer <marc.fischer2@bosch.io>
@marcfischerboschio
Copy link
Author

sorry for having some unwished commits in the PR.
I was trying to resolve the DCO findings but it seemed like there were also other PR's then include to mine.

Big sorry but I saved everything and applied your PR recommendations. Only topic currently is the point by @lsiepel regarding the topic of returning an empty list and and maybe confuse the user. But in this case I tested a lot and adjusted the behavior and it was working as expected. Including behavior of detaching things that are not any more available.

Copy link
Member

@Hilbrand Hilbrand left a comment

Choose a reason for hiding this comment

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

Here is a first review. I haven't reviewed everything, but wanted to give this. One part not completely reviewed is regarding the channels dynamically added. The sensors channels could also be of a QuantityType and given them units, but this will be more work, as each unit type you need to define a separate channels.

Regarding OAuth2. openHAB has built in support for OAuth2 authentication flow. Did that not work? or did it miss anything?

@mvalla mvalla removed their request for review May 17, 2022 04:18
@marcfischerboschio
Copy link
Author

Here is a first review. I haven't reviewed everything, but wanted to give this. One part not completely reviewed is regarding the channels dynamically added. The sensors channels could also be of a QuantityType and given them units, but this will be more work, as each unit type you need to define a separate channels.

Regarding OAuth2. openHAB has built in support for OAuth2 authentication flow. Did that not work? or did it miss anything?

Hello @Hilbrand, thanks for your review.
Regarding the OAuth2: Yes I did now that there is a general implementation of the OAuth2 mechanism in it. I tried it quite a long time to map all my data in the corresponding services but I had to include "internal" classes to store and use the refresh urls. Due to the OAuth2 device code flow, which is not supported in the implementation, I then decided to use another library and store the tokens on my own.

I also requested a bit of support here: openHAB Community: OAuth2.0 Device Authorization Grant (device_code) but also there was the same outcome to use custom implementation.

Signed-off-by: Marc Fischer <marc.fischer2@bosch.io>
Signed-off-by: Marc Fischer <marc.fischer2@bosch.io>
…s to a better fitting one

Signed-off-by: Marc Fischer <marc.fischer2@bosch.io>
…ndation for better UX'

Signed-off-by: Marc Fischer <marc.fischer2@bosch.io>
Signed-off-by: Marc Fischer <marc.fischer2@bosch.io>
Signed-off-by: Marc Fischer <marc.fischer2@bosch.io>
Signed-off-by: Marc Fischer <marc.fischer2@bosch.io>
Signed-off-by: Marc Fischer <marc.fischer2@bosch.io>
@lolodomo
Copy link
Contributor

lolodomo commented Nov 6, 2022

There were already several review steps. What is the current status ? @Hilbrand : is your review finished ?

@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

See #11833

<parent>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>3.4.0-SNAPSHOT</version>
Copy link
Member

@wborn wborn Dec 29, 2022

Choose a reason for hiding this comment

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

Suggested change
<version>3.4.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be adapted to the new addon.xml, the PR to adapt the developer docs is not merged yet, so if you need more details, the corresponding issue is here: openhab/openhab-core#2058
But you can also update your branch and look at another binding's addon.xml and adapt it to this initial contribution.

@jlaur jlaur added the awaiting feedback Awaiting feedback from the pull request author label Mar 22, 2023
@lsiepel lsiepel added the stale As soon as a PR is marked stale, it can be removed 6 months later. label Apr 29, 2024
@lsiepel
Copy link
Contributor

lsiepel commented Jun 21, 2024

Unfortunately it looks like we cannot bring this PR to the finish line. After two years of inactivity i close this PR. If there is a need to restart, feel free to re-open or start a new PR.

@lsiepel lsiepel closed this Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback Awaiting feedback from the pull request author new binding If someone has started to work on a binding. For a new binding PR. stale As soon as a PR is marked stale, it can be removed 6 months later.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants