BobRak / OpenHAB-Smartthings

53 stars 54 forks source link

HTTPS Port not working #38

Closed HeikoScholtes closed 5 years ago

HeikoScholtes commented 6 years ago

When specifying a HTTPS based port (e.g. 8443) in the Device called "OpenHabDevice" both the discovery and the manual definition of the Thing fails with the following logs in the Smartthings Live Logging:

3902fb37-c99e-432c-989f-51db41347806 14:18:13: error java.lang.NullPointerException: Cannot invoke method contains() on null object @line 77 (parse) 3902fb37-c99e-432c-989f-51db41347806 14:18:13: debug Msg '[index:15, mac:xxxxxxxxxxxx, ip:xxxxxxxxxxx, port:20FB, requestId:850b158a-89ac-4e43-b7eb-e6ca456937e6]' 3c19b957-cd92-4a13-9eaa-2d74b7be1c5d 14:18:13: debug Discovery is returning JSON: {"path":"/smartthings/discovery","body":["{\"capability\": \"accelerationSensor\", \"attribute\": \"acceleration\", \"name\": \"Contact Sensor\", \"id\": \"8411b1fb-f7a7-45bd-a2d1-ac34c3240cd2\" }","{\"capability\": \"battery\", \"attribute\": \"battery\", \"name\": \"Contact Sensor\", \"id\": \"8411b1fb-f7a7-45bd-a2d1-ac34c3240cd2\" }","{\"capability\": \"contactSensor\", \"attribute\": \"contact\", \"name\": \"Contact Sensor\", \"id\": \"8411b1fb-f7a7-45bd-a2d1-ac34c3240cd2\" }","{\"capability\": \"temperatureMeasurement\", \"attribute\": \"temperature\", \"name\": \"Contact Sensor\", \"id\": \"8411b1fb-f7a7-45bd-a2d1-ac34c3240cd2\" }","{\"capability\": \"threeAxis\", \"attribute\": \"threeAxis\", \"name\": \"Contact Sensor\", \"id\": \"8411b1fb-f7a7-45bd-a2d1-ac34c3240cd2\" }"]} 3c19b957-cd92-4a13-9eaa-2d74b7be1c5d 14:18:12: debug Entered discovery handler 3c19b957-cd92-4a13-9eaa-2d74b7be1c5d 14:18:12: debug Received device event from Message : [path:discovery] 3902fb37-c99e-432c-989f-51db41347806 14:18:13: debug Sending '{"path":"/smartthings/discovery","body":["{\"capability\": \"accelerationSensor\", \"attribute\": \"acceleration\", \"name\": \"Contact Sensor\", \"id\": \"8411b1fb-f7a7-45bd-a2d1-ac34c3240cd2\" }","{\"capability\": \"battery\", \"attribute\": \"battery\", \"name\": \"Contact Sensor\", \"id\": \"8411b1fb-f7a7-45bd-a2d1-ac34c3240cd2\" }","{\"capability\": \"contactSensor\", \"attribute\": \"contact\", \"name\": \"Contact Sensor\", \"id\": \"8411b1fb-f7a7-45bd-a2d1-ac34c3240cd2\" }","{\"capability\": \"temperatureMeasurement\", \"attribute\": \"temperature\", \"name\": \"Contact Sensor\", \"id\": \"8411b1fb-f7a7-45bd-a2d1-ac34c3240cd2\" }","{\"capability\": \"threeAxis\", \"attribute\": \"threeAxis\", \"name\": \"Contact Sensor\", \"id\": \"8411b1fb-f7a7-45bd-a2d1-ac34c3240cd2\" }"]}' to device 3902fb37-c99e-432c-989f-51db41347806 14:18:12: debug Creating event with message: [path:discovery] 3902fb37-c99e-432c-989f-51db41347806 14:18:12: debug Msg '[index:06, mac:xxxxxxxxxxxxx, headers:[post /discovery http/1.1:null, content-length:20, accept-encoding:gzip, host:xxxxxxxx:39500, user-agent:Jetty/9.3.22.v20171030, content-type:application/json], body:{"discovery": "yes"}, header:POST /discovery HTTP/1.1 Accept-Encoding: gzip User-Agent: Jetty/9.3.22.v20171030 Content-Type: application/json Host: xxxxxxxxxx:39500 Content-Length: 20, data:[discovery:yes], json:[discovery:yes]]'

Turning back to HTTP port (e.g. 8080) works but is not acceptable in terms of privacy and network security.

Please provide a fix for the HTTPS communication. I am more than happy to test it immediately.

Thank you

BobRak commented 6 years ago

Isn't your smartthings hub on the same network as your OpenHAB server? If it is that traffic is only on your private network and is not seen on the internet. Sure, it is possible that you have a device on your private network that is snooping other traffic on your network but that indicates you have bigger problems than the conversation between your Smartthings hub and your OpenHAB server. In summary what is your situation that requires secure communications?

It is possible to configure OpenHAB to receive and send on https ports. So far I haven't done that. But, is it possible for the Smartthings hub to communicate on ssl ports? I have not seen any documentation that indicates this is possible. Do you know this is possible?

At the moment I have very limited time to make enhancements to this binding. I'll keep this issue open and will investigate Smartthings ssl support when time permits.