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

[WIP] Update Smartthings binding for new API #17855

Open
wants to merge 44 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 need to create a samsung smartapp using the smarthings cli.
https://github.com/SmartThingsCommunity/smartthings-cli
This will be describe more in depth later, but you mainly need:

  • To create an OpenHab app :
    smartthings apps:create

  • To configure OAuth for this app:
    smartthings apps:oauth {myAppId}

  • To generate a clientId/clientSecret for this oauth:
    smartthings apps:oauth:generate {myAppId]

You will get an answer like this one:

───────────────────────────────
Client Name Openhab
Scope r:locations:,r:devices:$,r:scenes:,w:installedapps,r:installedapps,w:rules:,x:scenes:,r:hubs:,r:rules:,x:devices:,w:devices:$,w:locations:,r:devices:,w:devices:,x:locations:*,x:devices:$
Redirect Uris https://api.smartthings.com/installedapp,https://localhost:8443/connectsmartthings
OAuth Client Id 39bf5964-xxxx-xxxx-xxxx-xxx
OAuth Client Secret efeabe17-xxxx-xxxx-xxxx-xxx
───────────────────────────────

You can after create the Smarthings Cloud Hub in Openhab, filling the clientId and clientSecret as parameters.
And then do a discovery scan to start using the binding.

Best regards,
Laurent.

@lo92fr lo92fr requested a review from BobRak as a code owner December 6, 2024 15:03
lo92fr added 16 commits December 6, 2024 16:04
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]>
lo92fr added 10 commits December 6, 2024 16:27
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]>
automatic creation of smartapps from openhab (WIP)

Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
…sion

==> WIP : need refactoring code to clarify the process

Signed-off-by: Laurent ARNAL <[email protected]>
@lolodomo lolodomo added the enhancement An enhancement or new feature for an existing add-on label Dec 9, 2024
add more Dto
add more ApiCall
handle api returning Array of type
Remove old addons specific stuff

Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
fix SmartthingsApi token retrieven

Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[email protected]>
channeType creation must be done before device detection from capabilities reading !

Signed-off-by: Laurent ARNAL <[email protected]>
Signed-off-by: Laurent ARNAL <[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.

2 participants