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

[smartthings] WIP Refactor binding to make use of new API #17855

Draft
wants to merge 77 commits into
base: main
Choose a base branch
from

Conversation

lo92fr
Copy link
Contributor

@lo92fr lo92fr commented Dec 6, 2024

This pull request is about rewriting the Smartthings addons that is not working anymore since a few month because of deep change in the samsung API.

This is link to issue : #16946
And also to discussion in communauty forum : https://community.openhab.org/t/smartthings-binding-eol/138750/19

This is currently work in progress.
What is working so far:

  • Creation of a new Smarthings Cloud Hub Things to handle request to Samsung API.
  • OAuth authorization schema to samsung account.
  • Automatic discovery of device link to the samsung account,
  • Some basic channel update are working : mainly switch and dimmer on light device.
  • Very basic try to start implements device status update.
  • Uncomplete handling of type registry on openhab side to handle samsung device/components/capabilites schema.

To start testing the new binding, you will app to create an oauth token from the following URL : https://account.smartthings.com/tokens/new

OAuth token name is arbitrary, you can set what you want.
For now, select all the scope.

When you have the token, go back to openhab, an fill the Smarthings Cloudhub device with the token.
You can ignore the clientId / clientSecret (put a random value), I will remove them in feature relase.

After that, you will need to go to the uri : http://{myopenhabinstance/smartthings.
You will have, on the second page, to select your smartthings location.
After this, a popup window will open on the Smartthings site.
First page is just about confirming the Smartthings App name, just keep the default and confirm.
Second page is about to confirm device access for openhab, just click confirm.

After this step, you can close the popup window, go back to openhab, and scan your device to inbox.

Notes : smartthings cli installation, and manual smartthings app creation is not need anymore.
All this process is automatic in new version.

Best regards,
Laurent.

@lo92fr lo92fr requested a review from BobRak as a code owner December 6, 2024 15:03
@lo92fr lo92fr force-pushed the smartthingsNG branch 2 times, most recently from 6e7f0da to 4549915 Compare December 6, 2024 15:09
@lolodomo lolodomo added the enhancement An enhancement or new feature for an existing add-on label Dec 9, 2024
@lo92fr lo92fr force-pushed the smartthingsNG branch 2 times, most recently from bd63abb to d5191d8 Compare December 13, 2024 10:29
@lo92fr
Copy link
Contributor Author

lo92fr commented Dec 15, 2024

Hello Laurent (@lolodomo),

Just a little remak. I'm see that BobRak was added as reviewer. I'm don't know if it's an automatic process as it was the creator of the first version of the binding.

I'm not sure that Bobrak is still there to follow openhab developpement. The smartthing binding is not working since already two years, and I never see an answer from Bob to the issues. Also notes that there is no activities on his github since 2021.

At the best, Bob do not seems to use Openhab anymore... or worst.

So we have peharps to thing to find another reviewer for this.

Just to let you know, the binding is starting to work quite well.

  • The onboarding process is now pretty end to 99%, far more easier then before as the setup of Smartthings apps is automated in last versions.
  • The state update is now working on both side, from Smartthings to Openhab, and from Openhab to Smarthings.
  • State update from Smarthings to Openhab use new Event system from Smarthings cloud.
  • Typeregistry becomes more complete, and I've get success working with multiple device : Light, Smartplug, Kitchen appliance and others.
  • The converters are now back, and handle most of type conversion between Openhab and Smarthings.

There is still some issue to be address:

  • Do some more test, on more device, getting more case handle by converter and type registry.
  • Rewrite the documentation.
  • and of course some code clean-up.

As soon as i Finish to rewrite the documentation, I will try to see on my side if I can find some beta tester that have smarthing device to do some more test.

Laurent.

Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
remove template player.html
change oauth scope

Signed-off-by: Laurent ARNAL <[email protected]>
code cleaning (WIP)

Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
WIP
will need to implements ThingTypeProvider and ChannelTypeProvider to provide full support

Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
fix group naming

Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
some fixes on typeRegistry
add reading for extended capabilities not in base capabilities listing

Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
fix bad event handling because group was wrong on incoming events
temp fix class cast exception in Converter

Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
@lsiepel lsiepel changed the title [WIP] Update Smartthings binding for new API [smartthings] WIP Refactor binding to make use of new API Dec 18, 2024
@lsiepel lsiepel marked this pull request as draft December 18, 2024 19:10
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
2 participants