OH3 Smartthings Add-on Discovery not working

Tags: #<Tag:0x00007efec24e2b78>

I am the developer of the “Samsung Smartthings”: binding. I am trying to get it working on OH3. The discovery job was initialized but doesn’t run automatically. Here are the details:

Hopefully I am posting this in the right place. If not, let me know and I’ll copy it there.

Device Setup
I am using a Raspberry Pi 3 and have used the openHABian install. The versions I installed is: openhabian-pi-raspios32-v1.6.1b.img.xz. the installation went pretty smoothly.

I installed the Astro binding and that went smoothly. Right away there were 2 entries in the Inbox (Local Moon and Local Sun).

Smartthings Binding Setup
I added the Smartthings binding.
Next, I manually added the Smartthings Hub (this is the bridge and is needed before discovery can work).
At this point got the following entries in the log:

2020-12-22 15:04:10.921 [DEBUG] [s.internal.SmartthingsHandlerFactory] - SmartthingsHandlerFactory created BridgeHandler for smartthings:smartthings
2020-12-22 15:04:11.268 [DEBUG] [iscovery.SmartthingsDiscoveryService] - Discovery background scanning job started

When the discovery job runs I should see the following in the log:

2020-12-22 14:58:40.583 [DEBUG] [s.internal.SmartthingsHandlerFactory] - Sent message “{“discovery”: “yes”}” with path “/discovery” to the Smartthings hub, received HTTP status 202 (This is the normal code from Smartthings)

And, there are no entries in the Smartthings Hub log to indicate the discovery request was sent to the hub.

Any suggestions?

OH3 development environment
I have been developing using Eclipse. Can I use the instructions in the new documentation to setup a developers environment so I can test and debug? https://next.openhab.org/docs/developer/

Thanks

1 Like

Hi there, don’t have a solution, but just confirming then, the smartthings binding not discovering any ‘things’ in OH3 is due to an issue with the binding and not with setup?

Yes you can use the instruction. The main difference between 2.5 and 3.0 in relation to the development environment is that 3.0 requires Java 11, while 2.5 was run on Java 8.

@dayoyo Correct. I’m working on a solution.

@hilbrand Thanks for that info. If have a couple of additional questions:

  1. In the Eclipse installer what Product Version should I use? 2020-12 is the latest but the ide setup instructions has an image using 2019-06.
  2. The Add-ons github has 3 branches: main, 2.5.x and 3.0.x. If I want to do a pull request which branch should I use?

Thanks,

Bob Raker

Eclipse gets every 3 months a new release, so the screenshots tend to get outdated quickly. But both versions or any recent version is ok.

For pull requests always use the main branch. The other ones are for patch releases and are mostly only used to port bug fixes back from the main branch for a bug fix you want in a patch release.

Hi, Are you any further along with this? Interestingly, with a clean build and fresh install of OH3, after manually adding the hub the scan will find all the attached devices. It’s only after a second scan you lose sync.

Thanks

Antony

I am making progress. I have been seriously slowed down because I am having problems getting the Eclipse development environment to work properly. I recently installed the VS Code development environment and that works much better… I should be able to finish it in the next couple of days. I could put a copy in my github and you could get it right away. Let me know if you want that. This version will require openHAB 3.1. I’ve found some differences between the way 3.0 and 3.1 sends commands from OH to the binding.

BTW. If your system only has one binding installed the existing version is fine. It is when additional bindings are installed that it fails.

Bob

2 Likes

I completed the changes needed to make the discovery service work correctly. I submitted them to openHAB but I’m not sure how long it will take them to publish the update. I have deployed it on my github repo which you can find here. Make sure to download the jar file: org.openhab.binding.smartthings-3.1.0-SNAPSHOT.jar.

This requires OH 3.1. If you are running OH 3.0 you will have to upgrade. I had to choose 3.1 because that is the version in the openHAB add-ons repo.

I believe the correct installation steps would be:

  1. Setting -> Bindings -> select Smartthings -> click uninstall
  2. upgrade your install to 3.1 if necessary.
  3. shutdown openHAB
  4. copy the new jar file to the addons directory in you installation
  5. start openHAB
  6. when you click on Settings -> Bindings I believe that you will see Smartthings is already present.
1 Like

Hi - I am using a new 3.1 (Windows 10) fresh install of OH3.1. Completed ST Device/Handers configuration and copied your .jar to the
“C:\Program Files\PRODOpenHAB\userdata\tmp\mvn\org\openhab\addons\bundles\org.openhab.binding.smartthings\3.1.0-SNAPSHOT”

directory but still no luck. Using the ST Dev “Live Logging” I can see the request but not getting anything back in OH when I SCAN. Live Logging Below:

e75ba0c8-a557-4af3-b6f1-3e80ab65eeb3 9:06:11 AM: debug Creating event with message: [path:discovery]

e75ba0c8-a557-4af3-b6f1-3e80ab65eeb3 9:06:11 AM: debug Msg ‘[index:A4, mac:302432EAD1C0, headers:[post /discovery http/1.1:null, content-length:20, accept-encoding:gzip, host:192.168.2.201:39500, user-agent:Jetty/9.4.20.v20190813, content-type:application/json], body:{“discovery”: “yes”}, header:POST /discovery HTTP/1.1
Accept-Encoding: gzip
User-Agent: Jetty/9.4.20.v20190813
Content-Type: application/json
Host: 192.168.2.201:39500
Content-Length: 20, data:[discovery:yes], json:[discovery:yes]]’

Any Thoughts? The area I am not 100% confident, being a noob to this, is the .jar file. When I go to the addons dir above it has several files created from the bindings. so it is not a direct file replace. I really appreciate your time and efforts on this.

I have the same issue. I am un ubuntu. JAR file added to /usr/share/openhab/addons/. The binding does not show up in settings but is there when you add a thing. I also noticed an update to the smartapp so I updated the IDE. Even tried removing the smartapp and re-adding it but no luck.

It looks like the discovery request is being sent but no data is being returned. In the Smartthings Installation document did you complete the Configuration in the smartthings app? If not that is most likely your issue.

Also, I suspect you haven’t copied the jar file to the correct location. In the Windows Installation guide it says to unzip to a directory. Where is that on your system? There is an addons directory under where you unzipped to. On my system I copied the zip contents to d:\openhab so the addons dir is at D:\openhab\addons

@Antony_Price
OK, here are a bunch of things to try

Check the file permissions
Check the permissions of the Smartthings jar you copied to addons. The owner should be openhab:openhab and the permissions at least -rw-rw-r–

Check the bindings
In the UI: Settings -> Bindings
There should not be a Smartthings binding installed. If you see otherwise let me know the version.

Check the Things for the Smartthings Hub
In the UI: Settings -> Things
Is there an entry for Smartthings Hub? If so click on it and make sure it is correctly configured.
If not, Click on the Plus sign and see if you can add the Smartthings Hub. And, then configure the IP and port if possible.

Check if openhab has a copy of the Smartthings binding loaded
Open the console using these instructions
enter: bundle:list | grep Smartthings
What is the version? I think it should be 3.1.0.202101191633. I f not let me know what it is. Also, are there 2 Smartthings bundles?

Flush the caches
Sometime flushing the caches helps. Try that using these instructions. Then it would be good to go through there instructions again.

Let me know how all of this goes.