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

[ecobee] Ecobee binding initial contribution #6823

Merged
merged 13 commits into from
Apr 16, 2020

Conversation

mhilbush
Copy link
Contributor

Contributing an OH2 version of the ecobee binding.

Binding supports:

  • Auto discovery of thermostats and remote sensors.
  • Currently uses OAuth process from OH1 version of the binding. Changes to core are needed to use the core OAuth support, so that will be tackled when the binding is ported to OH3.
  • Added several thing actions in addition to the actions from OH1.

Things are organized in a Bridge->Bridge->Thing configuration. The first level (Account Bridge) represents the Ecobee Account. The second-level (Thermostat Bridge) represents the Thermostats that are associated with the Ecobee Account bridge. The third-level (Remote Sensor Thing) represents the remote and internal sensors that are associated with the Thermostat bridge.

Signed-off-by: Mark Hilbush mark@hilbush.com

@mhilbush mhilbush added new binding If someone has started to work on a binding. For a new binding PR. work in progress A PR that is not yet ready to be merged labels Jan 12, 2020
@mhilbush mhilbush force-pushed the ecobee-binding branch 8 times, most recently from a392439 to e83dabd Compare January 14, 2020 01:04
@mhilbush mhilbush changed the title [WIP] [ecobee] Ecobee binding initial contribution [ecobee] Ecobee binding initial contribution Jan 14, 2020
@mhilbush mhilbush removed the work in progress A PR that is not yet ready to be merged label Jan 14, 2020
@mhilbush
Copy link
Contributor Author

Removed the WIP tag.

@Hilbrand Hilbrand added the oh1 migration Relates to migrating an openHAB 1 addon to openHAB 2 label Jan 14, 2020
@openhab openhab deleted a comment from TravisBuddy Jan 14, 2020
@openhab openhab deleted a comment from TravisBuddy Jan 14, 2020
@openhab openhab deleted a comment from TravisBuddy Jan 14, 2020
@openhab openhab deleted a comment from TravisBuddy Jan 14, 2020
@openhab openhab deleted a comment from TravisBuddy Jan 14, 2020
@openhab openhab deleted a comment from TravisBuddy Jan 14, 2020
@openhab openhab deleted a comment from TravisBuddy Jan 14, 2020
@openhab openhab deleted a comment from TravisBuddy Jan 14, 2020
@Hilbrand
Copy link
Member

I see this binding includes OAuth2 support and that you plan to implement the core variant later. What you already could do is to implement the current version using the same interface. So create the same classes with only the methods you need in your binding package. Then later on you can simply change the imports and changing can be done fast. I've done this in the past for the Spotify binding. Here you can see what that looked: https://github.com/astenlund74/openhab2-addons/tree/bee1134692e1c61d2caf38dbfffe92b0cfd8891f/addons/binding/org.openhab.binding.spotify/src/main/java/org/openhab/binding/spotify/internal/oauth2

@mhilbush
Copy link
Contributor Author

What you already could do is to implement the current version using the same interface.

That's a good suggestion. Wish I had thought of it. 😉

I've done this in the past for the Spotify binding.

I see you used the Authorization Code method in the Spotify binding. I had considered changing from the PIN method, which is what the OH1 version of the binding used, to the Authorization Code method, however, the Ecobee documentation says that in their OAuth implementation redirect URIs cannot have port numbers. This would seem to be a showstopper, as the default redirect URI would need to be something like http://<openhabhost>:8080/connectecobee. Am I understanding this correctly?

That being the case, I guess I would need to stick with the PIN method, and would need to adjust the local OAuth classes to account for this. In addition, as @cweitkamp and I had discussed separately, the OHC OAuth implementation would need to be extended to support a non-standard grant type used by Ecobee (i.e. "grant_type=ecobeePIN"). For example, a new method such as this:

OAuthClientService::getAccessTokenResponseByAuthorizationCode(String grantType)

@openhab openhab deleted a comment from TravisBuddy Jan 14, 2020
@mhilbush mhilbush added the work in progress A PR that is not yet ready to be merged label Jan 16, 2020
@mhilbush mhilbush changed the title [ecobee] Ecobee binding initial contribution [WIP} [ecobee] Ecobee binding initial contribution Jan 16, 2020
@mhilbush
Copy link
Contributor Author

Resetting back to WIP while I rework the OAuth stuff.

@openhab openhab deleted a comment from TravisBuddy Jan 17, 2020
@TravisBuddy
Copy link

Travis tests were successful

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

@mhilbush
Copy link
Contributor Author

mhilbush commented Apr 7, 2020

@cpmeister I've pushed some changes that address most of your review feedback, as well as the rework of EcobeeActions to use your proxy suggestion (with the addition of IEcobeeActions).

For the remaining review feedback not covered in the changes I pushed, I've added answers and/or questions in response to your review comments.

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.

I think these are the last changes I can find.

Copy link
Contributor

@robnielsen robnielsen left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Mark Hilbush <mark@hilbush.com>
@TravisBuddy
Copy link

Travis tests were successful

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

@mhilbush
Copy link
Contributor Author

mhilbush commented Apr 8, 2020

@cpmeister I pushed some additional changes.

There are a couple things above that are still unresolved. If you could have a look at my comments when you get a chance.

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 the cre Coordinated Review Effort label Apr 8, 2020
@robnielsen
Copy link
Contributor

@cpmeister, what does the cre label stand for?

@cpmeister
Copy link
Contributor

@robnielsen "Coordinated Review Effort" it basically used to mark PRs that require additional reviewers to review it.

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.

Awesome work, @mhilbush!
I only had a quick glance over it, but as you are known to be a very experienced binding author and we already have two approvals, there shouldn't be any reason to wait with the merge any longer 🎉.

@kaikreuzer kaikreuzer merged commit 36d7ef0 into openhab:2.5.x Apr 16, 2020
@openhab openhab deleted a comment from TravisBuddy Apr 16, 2020
@cpmeister cpmeister added this to the 2.5.4 milestone Apr 16, 2020
@mhilbush
Copy link
Contributor Author

Thanks @kaikreuzer. Very much appreciated. And thanks for fixing up CODEOWNERS.

@cpmeister @robnielsen Thanks again for the reviews!

@mhilbush mhilbush deleted the ecobee-binding branch April 16, 2020 21:21
yfre pushed a commit to yfre/openhab-addons that referenced this pull request Apr 27, 2020
Signed-off-by: Mark Hilbush <mark@hilbush.com>
Signed-off-by: Eugen Freiter <freiter@gmx.de>
markus7017 pushed a commit to markus7017/openhab-addons that referenced this pull request May 29, 2020
Signed-off-by: Mark Hilbush <mark@hilbush.com>
LoungeFlyZ pushed a commit to LoungeFlyZ/openhab2-addons that referenced this pull request Jun 8, 2020
Signed-off-by: Mark Hilbush <mark@hilbush.com>
J-N-K pushed a commit to J-N-K/openhab-addons that referenced this pull request Jul 14, 2020
Signed-off-by: Mark Hilbush <mark@hilbush.com>
CSchlipp pushed a commit to CSchlipp/openhab-addons that referenced this pull request Jul 26, 2020
Signed-off-by: Mark Hilbush <mark@hilbush.com>
Signed-off-by: CSchlipp <christian@schlipp.de>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
Signed-off-by: Mark Hilbush <mark@hilbush.com>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
Signed-off-by: Mark Hilbush <mark@hilbush.com>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
Signed-off-by: Mark Hilbush <mark@hilbush.com>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
Signed-off-by: Mark Hilbush <mark@hilbush.com>
DaanMeijer pushed a commit to DaanMeijer/openhab-addons that referenced this pull request Sep 1, 2020
Signed-off-by: Mark Hilbush <mark@hilbush.com>
Signed-off-by: Daan Meijer <daan@studioseptember.nl>
markus7017 pushed a commit to markus7017/openhab-addons that referenced this pull request Sep 19, 2020
Signed-off-by: Mark Hilbush <mark@hilbush.com>
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. oh1 migration Relates to migrating an openHAB 1 addon to openHAB 2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants