BobRak / OpenHAB-Smartthings

53 stars 54 forks source link

Errors, child devices and capabilities #104

Open MrRusch opened 3 years ago

MrRusch commented 3 years ago

I've had a lot of problems with this binding in the past, but since we renovated our kitchen and installed all Samsung products - I am making another attempt.

The discovery process from Openhab still doesn't work. I followed the instructions for redirecting the discovery to a PC via curl and portlistener, which worked fine and I was able to confirm that the capabilities I had selected in the smartapp were indeed being exposed by the hub. Adding the things via Openhab UI created channels that when added as were to Items in config, didn't work. So I ended up configuring everything via .things and .items files manually according to instructions.

And now I'm in a somewhat functional state.. I sporadically get warnings like below during startup, [WARN ] [rnal.handler.SmartthingsThingHandler] - Attempt to send command to the Smartthings hub for <DEVICE> failed with exception: Total timeout 3000 ms elapsed And these values never seem to come back unless I restart openhab. So first concrete question: Q1. Is there a way to modify the timeout, and perhaps retry interval? I'm not sure why it is timing out, I can ping the hub without issue as this happens..

I also get errors like, [ERROR] [org.jupnp.transport.spi.StreamClient] - Request: HttpRequest[GET /capability HTTP/1.1]@1a207b7 failed java.lang.NullPointerException: Missing SslContextFactory at java.util.Objects.requireNonNull(Objects.java:228) ~[?:1.8.0_222] at org.eclipse.jetty.io.ssl.SslClientConnectionFactory.<init>(SslClientConnectionFactory.java:54) ~[bundleFile:9.4.20.v20190813] at org.eclipse.jetty.client.HttpClient.newSslClientConnectionFactory(HttpClient.java:1175) ~[bundleFile:9.4.20.v20190813] at org.eclipse.jetty.client.HttpDestination.newSslClientConnectionFactory(HttpDestination.java:137) ~[bundleFile:9.4.20.v20190813] at org.eclipse.jetty.client.HttpDestination.<init>(HttpDestination.java:94) ~[bundleFile:9.4.20.v20190813] at org.eclipse.jetty.client.PoolingHttpDestination.<init>(PoolingHttpDestination.java:25) ~[bundleFile:9.4.20.v20190813] at org.eclipse.jetty.client.http.HttpDestinationOverHTTP.<init>(HttpDestinationOverHTTP.java:32) ~[bundleFile:9.4.20.v20190813] at org.eclipse.jetty.client.http.HttpClientTransportOverHTTP.newHttpDestination(HttpClientTransportOverHTTP.java:51) ~[bundleFile:9.4.20.v20190813] at org.eclipse.jetty.client.HttpClient.destinationFor(HttpClient.java:546) ~[bundleFile:9.4.20.v20190813] at org.eclipse.jetty.client.HttpClient.send(HttpClient.java:579) ~[bundleFile:9.4.20.v20190813] at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:728) ~[bundleFile:9.4.20.v20190813] at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:681) ~[bundleFile:9.4.20.v20190813] at org.jupnp.transport.impl.jetty.JettyStreamClientImpl$1.call(JettyStreamClientImpl.java:155) [bundleFile:?] at org.jupnp.transport.impl.jetty.JettyStreamClientImpl$1.call(JettyStreamClientImpl.java:1) [bundleFile:?] at org.jupnp.transport.spi.AbstractStreamClient$RequestWrapper.call(AbstractStreamClient.java:204) [bundleFile:?] at org.jupnp.transport.spi.AbstractStreamClient$RequestWrapper.call(AbstractStreamClient.java:1) [bundleFile:?] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_222] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222] I am in no way sure this is related but as it is preceded by the above warning I have a feeling it is trying to run UPnP discovery over SSL and this is failing..

But then there are some things I'm not quite sure if I understand.. Let's take the Refrigerator for example. It's a side-by-side, so it has three child devices: Refrigerator Cooler, Refrigerator Freezer, and Ice Maker. When I go into smartapp settings, I can see that the "Contact Sensor" capability is exposed from both the parent device Refrigerator, and two of the child devices (Refrigerator Cooler and Refrigerator Freezer).

.things Bridge smartthings:smartthings:Home [ smartthingsIp="IP", smartthingsPort=PORT ] { Thing contactSensor refrigeratorContactSensor [ smartthingsName="Refrigerator" ] Thing contactSensor coolerContactSensor [ smartthingsName="Refrigerator Cooler" ] Thing contactSensor freezerContactSensor [ smartthingsName="Refrigerator Freezer" ]

.items Contact refrigeratorContactSensor "Refrigerator door [%s]" { channel="smartthings:contactSensor:Home:refrigeratorContactSensor:contact" } Contact coolerContactSensor "Cooler door [%s]" { channel="smartthings:contactSensor:Home:coolerContactSensor:contact" } Contact freezerContactSensor "Freezer door [%s]" { channel="smartthings:contactSensor:Home:freezerContactSensor:contact" }

.sitemap Default item=refrigeratorContactSensor Default item=coolerContactSensor Default item=freezerContactSensor

When I open a door, the refrigeratorContactSensor changes, but both child devices' values remain "CLOSED" in Openhab. When looking in Smarttings Developer Tools I can see the attribute changing on the child devices, but I guess not being communicated to Openhab. So I guess this might be the second question, Q2. Does the binding support child devices properly? The capabilities are obviously exposed in the smartapp, I just can't seem to get them to update properly in Openhab. Another such example would be the Oven, which also has 2 child devices, each with a doorControl capability. Can't get this to work either.

Moving on, I have a Dishwasher that is also connected to the hub and Developer Tools, but for which it seems no capabilities are being exposed in smartapp. Q3. Is the Dishwasher thing supported? I followed the link from here "If you find a device that doesn't work follow these instructions to collect the required data so it can be added in a future release." on the binding's Openhab page, but didn't really find what information I should collect.

Two specific capabilities that I see in the Capabilities Reference Documentation, but don't seem to be exposed in the your smartapp are the rapidCooling and rapidFreezing capabilities from the Refrigerator. Q4. Are they implemented as such? I tried using them as switch:es but this didn't work either.

Finally, a general question: Q5. Is there a way to read data from devices' states that aren't capabilities as such? For example, many devices have an attribute called versionNumber. Is it possible to read it somehow?

Thanks for your time and efforts!

BobRak commented 3 years ago

First of all - which version of the jar file are you using? In January I discovered that Discovery wasn't working & in late January I made an update. If you got the version from my Git repo you should have picked up the version: org.openhab.binding.smartthings-3.1.0-SNAPSHOT.jar. I think this should be the same as the one through openHAB but I don't know what their process is to take bindings they have reviewed and move them to production. During startup do you see any messages in the logs about Discovery running? If not it is likely you have a broken version.

With regards to the timeout messages: I have seen these as well and don't know what causes them but I don't think they are being caused by my Smartthings binding. There is a way to increase the timeout. In the .things file you can add a parameter smartthingsTimeout=xx. In the same block where smartthingsName goes. You can read a lot more about the timeout issue in #98. In particular read this comment from Sept 17.

I have no idea why you are getting SSL error messages. The communications between the ST hub and openHAB has to be over an un-encrypted conversation because the hub doesn't support SSL.

I've not made any attempt to support child devices. One of the (many) challenges has been that I don't have devices to test against. I don't own any Samsung appliances. I have had requests before to support some Samsung appliances (maybe washing machine and dishwasher). To do that I made "simulators" using the Smartthing tools. Lots of hours and of course they can only respond the way I think they should work. It seems like you've used curl and port listener to communicate directly with the hub. Have you tried setting up the port listener and then opening the door and seeing if a message is sent. If you look in THIS file you can see exactly what is supported. And, you can even change the file if you have a way to edit files already in side of a jar/zip file. You can not add new devices but you can change what is there.

I know I haven't answered all of you questions but I need to get out of the house now and wanted to get something back to you today. Let me know if you still want answers to the other questions.

Bob

MrRusch commented 3 years ago

First of all - which version of the jar file are you using? In January I discovered that Discovery wasn't working & in late January I made an update. If you got the version from my Git repo you should have picked up the version: org.openhab.binding.smartthings-3.1.0-SNAPSHOT.jar. I think this should be the same as the one through openHAB but I don't know what their process is to take bindings they have reviewed and move them to production.

I am using the addon version, bundled in openhab-addons-2.5.12.

During startup do you see any messages in the logs about Discovery running? If not it is likely you have a broken version.

Actually I dont, even with Openhab's addon-version. So OK, this might be fixed in a coming release. It's fine anyway now that I've figured out how to configure it manually.

With regards to the timeout messages: I have seen these as well and don't know what causes them but I don't think they are being caused by my Smartthings binding. There is a way to increase the timeout. In the .things file you can add a parameter smartthingsTimeout=xx. In the same block where smartthingsName goes. You can read a lot more about the timeout issue in #98. In particular read this comment from Sept 17.

Perfect, thanks - I will check this and see if it helps.

I have no idea why you are getting SSL error messages. The communications between the ST hub and openHAB has to be over an un-encrypted conversation because the hub doesn't support SSL.

That's what I thought as well. Just figured maybe it could be the reason for messages timing out. But if increasing the timeout resolves the issue, it is indeed unrelated.

I've not made any attempt to support child devices. One of the (many) challenges has been that I don't have devices to test against. I don't own any Samsung appliances. I have had requests before to support some Samsung appliances (maybe washing machine and dishwasher). To do that I made "simulators" using the Smartthing tools. Lots of hours and of course they can only respond the way I think they should work. It seems like you've used curl and port listener to communicate directly with the hub. Have you tried setting up the port listener and then opening the door and seeing if a message is sent. If you look in THIS file you can see exactly what is supported. And, you can even change the file if you have a way to edit files already in side of a jar/zip file. You can not add new devices but you can change what is there.

OK, I understand. I will try and dig into your code and see if I can contribute somehow - as I now have a side-by-side refrigerator, an oven, a cooktop, a dishwasher and a washing machine. So plenty of devices to test on..

EDIT: Alright, so rapidCooling and rapidFreezing are in fact not implemented. Will see if I can figure out what I need to add.. When redirecting the smartapp to my PC and port listener I can see the parent device (Refrigerator) generate an event when the door opens, but not the child devices (Refrigerator Cooler and Refrigerator Freezer). So I guess the smartapp is not forwarding them? I mean I can see the value change in the data tree in Developer Tools, so some kind of event is triggering this? What's perplexing to me is that the values are being populated at startup - where is that coming from if not from an event. In Developer Tools I can see the Event Subscriptions do exist for the child devices as well as parent.

I know I haven't answered all of you questions but I need to get out of the house now and wanted to get something back to you today. Let me know if you still want answers to the other questions. Bob

Thanks for the quick response Bob, much appreciated!