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

[bticinosmarther] Initial contribution #7533

Merged
merged 21 commits into from
Jun 28, 2020
Merged

Conversation

MrRonfo
Copy link

@MrRonfo MrRonfo commented May 2, 2020

[bticinosmarther] Initial contribution

The BTicino Smarther binding implements a bridge to the C2C Legrand/Bticino Smarther v2.0 API and allows users to control their BTicino Smarther chronothermostat units (all models) with openHAB.

BTicino Smarther units have their own API set and doesn't conform to the OpenWebNet protocol.

Main thread in openHAB Community on this binding:

Companion HABPanel widget for this binding:

Other threads in openHAB Community where the idea to build this binding came from:

Signed-off-by: Fabio Possieri [email protected]

@MrRonfo MrRonfo requested a review from a team as a code owner May 2, 2020 19:18
@TravisBuddy
Copy link

Travis tests were successful

Hey @MrRonfo,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

@cpmeister cpmeister added the new binding If someone has started to work on a binding. For a new binding PR. label May 3, 2020
@TravisBuddy
Copy link

Travis tests were successful

Hey @MrRonfo,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

1 similar comment
@TravisBuddy
Copy link

Travis tests were successful

Hey @MrRonfo,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

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.

You put a lot of effort into this binding. There are only minor improvements, I found.

I'm not that familiar with servlets. Another reviewer should take a closer look into this part.

Copy link
Author

@MrRonfo MrRonfo left a comment

Choose a reason for hiding this comment

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

Thanks @fwolter for your kind suggestions, I'll try to review them by today.

@MrRonfo
Copy link
Author

MrRonfo commented May 25, 2020

Hi @fwolter, after having accepted few of your PR reviews here via github I found more practical to apply all of them locally, review and just commit once.
However, I noted that I cannot git push from local to my remote branch (as non-fast-forward), since the few commits above have been automatically reported by github to my remote branch too.
Any suggestions ?
Would a git push --force work in this case or is it better to act differently ?
Thanks!

@fwolter
Copy link
Member

fwolter commented May 25, 2020

Before you can push your changes, you have to rebase your local branch to incorporate your changes you done via the GitHub webinterface.

@MrRonfo
Copy link
Author

MrRonfo commented May 25, 2020

@fwolter thanks, done but had signoff issue, so DCO suggested to resolve with:

git rebase HEAD~11 --signoff
git push --force-with-lease origin smarther

Applied on my local copy but I think it messed up something, as I can see commits added for other bindings which actually weren't on my branch :|
How should I better proceed with that? Any way I can recover or what else?

Sorry to the other guys over there I accidentally requested a review to...

@TravisBuddy
Copy link

Travis tests have failed

Hey @MrRonfo,
please read the following log in order to understand the failure reason. There might also be some helpful tips along the way.
It will be awesome if you fix what is wrong and commit the changes.

@fwolter
Copy link
Member

fwolter commented May 25, 2020

Seems like you did a rebase on an old 2.5.x branch. First, make a backup of your local repo. Then, you can delete the five foreign commits by interactive rebase: git rebase -i e5e1561~1 (this is one commit before the bluetooth commit). Delete one at a time, to prevent conflicts and re-run the interactive rebase. If all looks fine again, you can do a force-push. No guarantees :) Hope that helps.

@MrRonfo
Copy link
Author

MrRonfo commented May 26, 2020

@fwolter thank you so much for your kind support, it seems to me the binding codebase is now ok.
All the reviews have been incorporated in the last commit, apart from the one pending on RuntimeException.
Cheers,

@MrRonfo MrRonfo removed the request for review from a team May 26, 2020 18:50
@TravisBuddy
Copy link

Travis tests have failed

Hey @MrRonfo,
please read the following log in order to understand the failure reason. There might also be some helpful tips along the way.
It will be awesome if you fix what is wrong and commit the changes.

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.

If you rename the package org.openhab.binding.smarther.internal.api.model to org.openhab.binding.smarther.internal.api.dto you'd get rid of several NonNullByDefault warnings.

You repalced the Joda calls with the old Date API. The vast majority of Joda has been merged into Java. You don't have to re-implement e.g. plusDays. Take a look at ZonedDateTime or Instant if UTC is sufficent.

@MrRonfo
Copy link
Author

MrRonfo commented May 28, 2020

Thanks again @fwolter for your code review. All suggestions merged and pushed here.

I've noted that Travis CI is failing, it seems, due to my codebase being on OH 2.5.5 while it's now expecting to build agains OH 2.5.6.
Would it be a good idea to rebase my smarther branch to origin/2.5.x (and, in case, what is the standard approach to do that for OH) ?

@fwolter
Copy link
Member

fwolter commented May 28, 2020

Correct, rebase will do the job.

@MrRonfo
Copy link
Author

MrRonfo commented May 29, 2020

Correct, rebase will do the job.

@fwolter noted, thanks. So no risk the whole locally rebased code of origin/2.5.x to be also added to this PR, when I'll push new code fixes to my remote Smarther branch ?
Sorry for the trivial question, but I don't want to mess anything like I did in past commits :)

@fwolter
Copy link
Member

fwolter commented May 29, 2020

Yes. If you're unsure, make a backup of your local repo. If you messed up something you can do a force-push from your backup, although it's not elegant.

@TravisBuddy
Copy link

Travis tests were successful

Hey @MrRonfo,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

MrRonfo added 5 commits June 23, 2020 20:40
Fixed the Bridge thing transition to Unknown status in initialize
method, moving it after variables initialization so that handleCommand()
is eventually called only after.

Signed-off-by: Fabio Possieri <[email protected]>
Changed wrong use of NonNullByDefault with Nullable wherever found,
removed OSGI component declaration in ThingHandlerService, fixed unit
attribute in config.xml

Signed-off-by: Fabio Possieri <[email protected]>
Added syntax exception handling to Json parsing calls, optimized reading
new notification from servlet request, fixed module discovery service.

Signed-off-by: Fabio Possieri <[email protected]>
Just refactored the binding naming to bticinosmarther (smarther alone
was too generic), as BTicino also provides other protocols that can be
integrated over time in OH by other developers

Signed-off-by: Fabio Possieri <[email protected]>
@TravisBuddy
Copy link

Travis tests have failed

Hey @MrRonfo,
please read the following log in order to understand the failure reason. There might also be some helpful tips along the way.
It will be awesome if you fix what is wrong and commit the changes.

@TravisBuddy
Copy link

Travis tests were successful

Hey @MrRonfo,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

@MrRonfo
Copy link
Author

MrRonfo commented Jun 24, 2020

@cpmeister @fwolter
Hi guys, I've updated the PR files to OH 2.5.7 and just taken the opportunity to rename the binding from "smarther" to "bticinosmarther" for two reasons:

  1. I found "smarther" to be a too generic naming (other devices in the market have similar names, this way is more easy for the end user to identify the right one);
  2. BTicino also provides other protocols to manage different systems (so, in the hope to keep some namespace consistency in case someone else will integrate one of these with OH in the future).

I see "changes approved": does that mean that the binding can be merged or is there anything else to be done here?
Thanks!

@MrRonfo MrRonfo changed the title [smarther] Initial contribution [bticinosmarther] Initial contribution Jun 24, 2020
@kaikreuzer
Copy link
Member

@MrRonfo The renaming makes sense to me, thanks.
I have a few final comments, which I will post tonight (don't have time earlier than that), but then we should be good to merge!

Copy link
Member

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

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

Thanks for your patience, @MrRonfo, here are my promised comments :-)

@MrRonfo
Copy link
Author

MrRonfo commented Jun 26, 2020

@kaikreuzer thanks for your suggestions, really appreciated. I've added few questions. I'll commit all the changes as soon as I get your feedback.
Cheers,

@kaikreuzer
Copy link
Member

Done - I hope I answered all questions. If I have missed any, please let me know :-)

Aligned README to OH template, fixed config locations fetch channel for
Bridge thing and config programs fetch channel for Module thing, moved
accessToken info from channel to log at trace level.

Signed-off-by: Fabio Possieri <[email protected]>
@TravisBuddy
Copy link

Travis tests were successful

Hey @MrRonfo,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

@MrRonfo
Copy link
Author

MrRonfo commented Jun 27, 2020

Done - I hope I answered all questions. If I have missed any, please let me know :-)

Thanks a lot @kaikreuzer.
I've integrated all of your suggestions to the last commit. Also changed from the generic (and a bit misleading) fetchConfig in both SmartherBridgeHandler and SmartherModuleHandler, to specific fetchLocations and fetchPrograms respectively.
Cheers,

Copy link
Member

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

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

Thanks for your very quick updates, @MrRonfo - lgtm now, so let's merge! 👍

@kaikreuzer kaikreuzer merged commit 8a5c07f into openhab:2.5.x Jun 28, 2020
@cpmeister cpmeister added this to the 2.5.7 milestone Jun 29, 2020
knikhilwiz pushed a commit to knikhilwiz/openhab2-addons that referenced this pull request Jul 12, 2020
CSchlipp pushed a commit to CSchlipp/openhab-addons that referenced this pull request Jul 26, 2020
MPH80 pushed a commit to MPH80/openhab-addons that referenced this pull request Aug 3, 2020
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
DaanMeijer pushed a commit to DaanMeijer/openhab-addons that referenced this pull request Sep 1, 2020
Signed-off-by: Fabio Possieri <[email protected]>
Signed-off-by: Daan Meijer <[email protected]>
markus7017 pushed a commit to markus7017/openhab-addons that referenced this pull request Sep 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cre Coordinated Review Effort new binding If someone has started to work on a binding. For a new binding PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants