BobRak / OpenHAB-Smartthings

53 stars 54 forks source link

Some issues with discovery #63

Closed georid3r closed 5 years ago

georid3r commented 5 years ago

So, following the initial installation of the hub, I was able to get one Sengled Element Plus bulb working. Since then, discovery will not return any new smartthings (more Sengled Element Plus and Sengled Element Classiv bulbs). I can see all the devices in the smartthings developer app, but OH can't see them. I'm using a V3 smartthings hub, and the one bulb I was able to get connected is still working - dim, on/off - all working fine. But I can't discover anything else?

OH does appear to be discovering my cell phone when I run discover through the smartthings binding.

Openhabian 2.4 Smarthings V3 hub Sengled Element Plus bulbs Sengled Element Classic bulbs

Any thoughts?

Also, having trouble getting smartthings binding into DEBUG mode. Followed the troubleshooting page, but all I get are INFO when trying to discover

2019-01-26 10:52:35.446 PM EST22 minutes ago | COMMAND |   |   | deviceNotification |   | deviceNotification command was sent to OpenHabDevice | true 2019-01-26 10:52:35.423 PM EST22 minutes ago | APP_COMMAND |   |   | deviceNotification |   | OpenHabAppV2 sent deviceNotification command to OpenHabDevice | true 2019-01-26 10:52:35.291 PM EST22 minutes ago | DEVICE |   | message | {"path":"discovery","hubStart... |   | OpenHabDevice message is {"path":"discovery","hubStartTime":1548561155305,"openHabStartTime":1548561155122} | true 2019-01-26 10:50:55.412 PM EST24 minutes ago | COMMAND |   |   | deviceNotification |   | deviceNotification command was sent to OpenHabDevice | true 2019-01-26 10:50:55.396 PM EST24 minutes ago | APP_COMMAND |   |   | deviceNotification |   | OpenHabAppV2 sent deviceNotification command to OpenHabDevice | true 2019-01-26 10:50:55.264 PM EST24 minutes ago | DEVICE |   | message | {"path":"discovery","hubStart... |   | OpenHabDevice message is {"path":"discovery","hubStartTime":1548561055272,"openHabStartTime":1548561054687} | true

BobRak commented 5 years ago

Hi @georid3r Sorry for the delay in responding.

When I run discover on my RPi I see messages like:

2019-01-27 16:41:05.191 [INFO ] [hings.internal.SmartthingsHttpClient] - Sent message "{"discovery": "yes", "openHabStartTime": 1548636064857}" with path "/discovery" to the Smartthings hub, recieved HTTP status 202

2019-01-27 16:41:06.028 [DEBUG] [rtthings.internal.SmartthingsServlet] - Smartthings servlet service() called with: 192.168.86.46: POST /smartthings/discovery

2019-01-27 16:41:06.032 [DEBUG] [rtthings.internal.SmartthingsServlet] - Smartthing servlet function requested: discovery with Method: POST

2019-01-27 16:41:06.437 [DEBUG] [iscovery.SmartthingsDiscoveryService] - Event received on topic: org/openhab/binding/smartthings/discovery

2019-01-27 16:41:06.459 [DEBUG] [iscovery.SmartthingsDiscoveryService] - Discovery: Creating device: ThingType accelerationSensor with name Garage Door

2019-01-27 16:41:06.471 [DEBUG] [iscovery.SmartthingsDiscoveryService] - Discovery: Creating device: ThingType battery with name Garage Door

2019-01-27 16:41:06.502 [DEBUG] [iscovery.SmartthingsDiscoveryService] - Discovery: Creating device: ThingType contactSensor with name Garage Door

I guess you aren't seeing similar messages since those only show up in debug.

To set debug logging edit the file at: /var/lib/openhab2/etc/smartthings org.ops4j.pax.logging.cfg I added the following lines just after the "# Security audit logger section"

log4j2.logger.smartthings.name=org.openhab.binding.smartthings
log4j2.logger.smartthings.level=DEBUG

Maybe I should change the Discovery messages to INFO level, what do you think?

Here are some thing to check:

  1. In the Smartthings Classic app on your phone check that devices are included. This is described at the bottom of the SmartThingsInstallation.md file.
  2. Are you sure you have the correct mac (of the RPi) set? Look in the SmartThingsInstallation.md file. In the section titled "Create the device".

Try those things and let me know.

Thanks,

Bob

bjhiltbrand commented 5 years ago

What OS are you running OpenHAB in? There are some nuances in logging within Windows.

When you say "I can see all the devices in the smartthings developer app", are you referring to the SmartThings Smart App / Automation from within the SmartThings app? If you have selected them in the Smart App, they should be made visible to the rest of the world. I noticed that you are using a gen. 3 hub. That means that you had to use the Samsung Connect app to set it up. Are you also using the SmartThings Classic app? This integration will require the classic app.

Edit: Sorry, I was posting at the same time as Bob and missed that he had posted most of my same questions.

BobRak commented 5 years ago

@bjhiltbrand Thanks for adding your advice. I should have said that I have a v2 hub and not v3. Also, I somehow got the opinion that he is using a RPi. When I reread the message I see I may have been wrong about that. Can you tell us where the logging config is on windows?

Thanks,

Bob

bjhiltbrand commented 5 years ago

I don't know if he's in Windows or not, but if so, there are a couple ways to work with logging. The information I use is found here: https://www.openhab.org/docs/administration/logging.html

In Windows, you can go to [OpenHAB Install Folder]\userdata\config\org\ops4j\pax\logging.config. You can then edit the file by finding the line that says log4j2.logger.org_openhab_binding_smartthings.level="INFO" and Changing "INFO" to "DEBUG".

I prefer to change it on the fly, however. To do that, just go to the console window and type "log:set DEBUG org.openhab.binding.smartthings" (Without the quotes). To switch it back, type the same command again, but change "DEBUG" to "INFO"

openhab console

georid3r commented 5 years ago

@bjhiltbrand - Thanks for the reply. I am running OH 2.4.0-1 on a Raspberry PI 3 on an OpenHabian image.

When you say "I can see all the devices in the smartthings developer app"

@BobRak - Thanks for the reply. I had a really long message here full of detail that I happily deleted. I thought I would poke around in the Smartthing classic app as suggested. Note that when I wrote the first message, I had 1 bulb working, and I could discover my iphone and my Samsung smart TV. But, I could not get another bulb nor an identical bulb to be discovered. I even tried manually configuring the thing and item - still could not control it, even though it said it was online. I discovered in the classic app you have to click on the OpenHabAppV2, then scroll down to what device you are enabling and select it, and then check the box for that device. Now it can be controlled through openhab. I don't recall reading this, and I will go through it again just to be sure. If it is indeed there, please let me know where I missed it . . . . But, that was the whole problem. I now have one of the bulbs working that I couldn't get to work before.

I'll spend some more time on this tomorrow (I suspect the thing will be discovered if enabled), but for now, thanks, the information provided is much appreciated.

Scott

bjhiltbrand commented 5 years ago

@georid3r, Glad you found it. That's where I was getting at when I was asking about seeing all your devices in the app. Samsung makes it a point to have the end user explicitly declare what devices to work with in smart apps. This makes sense, but can kind of be a pain sometimes when setting up large smart apps like this one.

The relevant line is here: https://github.com/BobRak/OpenHAB-Smartthings/blob/master/org.openhab.binding.smartthings/SmartthingsInstallation.md

At the bottom of the page, Configuration in the Smartthings Classic App, item 6, bullet point 1, it states: "In the selection screen select the devices you want to interact with OpenHAB. Warning devices not selected can not be used with OpenHAB."

Maybe it could be worded a bit clearer. Anyway, well done on figuring it out! :)

georid3r commented 5 years ago

Thanks for pointing me there, I do see that now, and honestly don't recall doing that the first time around - I must have checked it the first time, though I don't recall.

After rereading it, I think it's worded clearly enough. Though, I might suggest changing the warning to: Warning devices not enabled (lacking the check mark in the box for the specific device) can not be used with OpenHAB.

But, that may just be me. I think it would depend on how many folks start asking the same question I did.

I do want to mention the logging notation in the troubleshooting section may need an update. The troubleshooting.md mentions

edit the file org.ops4j.pax.logging.cfg In the Root logger section near the top of the file add the line: log4j.logger.org.openhab.binding.smartthings = DEBUG

which is not working. I think it should read

edit the file at: /var/lib/openhab2/etc/org.ops4j.pax.logging.cfg Add the following lines just after the "# Security audit logger section" log4j2.logger.smartthings.name=org.openhab.binding.smartthings log4j2.logger.smartthings.level=DEBUG

Thanks again, the help is much appreciated!

BobRak commented 5 years ago

@georid3r Thanks for the feedback. I plan to make one more update prior to submitting it to openhab. I'll include your suggestions. Bob