question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to discover devices with OH3

See original GitHub issue

I have been playing around with OH3 snapshot versions and noted alexa discovery for new devices fails with OH3. So i hosted my own OH Cloud and connected to local OH3. I also hosted by copy of alexa skill on AWS/ Amazon. Looking at the nginx logs, there is a failure with the first of the two Get requests:

34.XXX.XXX.XXX - xxx@xxx.com [15/Sep/2020:19:28:22 +0000] "GET /rest/services/org.eclipse.smarthome.i18n/config HTTP/1.1" 401 76 "-" "-"
34.XXX.XXX.XXX - xxx@xxx.com [15/Sep/2020:19:28:22 +0000] "GET /rest/items/?fields=editable%2CgroupNames%2CgroupType%2Cname%2Clabel%2Cmetadata%2CstateDescription%2Ctags%2Ctype&metadata=alexa%2Cautoupdate%2Cchannel%2Csynonyms HTTP/1.1" 200 1269 "-" "-"

The failed request is evident from the 401. The relevant code is here: lambda/smarthome/alexa/v3/directives/discovery.js

One thing is that probably the package org.eclipse.smarthome.i18n doesnt exist in OH3. But changing this package name to `org.openhab.i18n’ also results in the same issue.

On local OH3 server, this is the debug log from the OH cloud connector. Request 18 resulted in failuere (possibly corresponding to the first Get request from above) while Request 19 did not (the second Get request i suppose). The complete log is here: https://pastebin.com/7h0SKKUi

2020-09-16 00:58:21.228 [DEBUG] [io.openhabcloud.internal.CloudClient] - Got request 18
2020-09-16 00:58:21.239 [DEBUG] [io.openhabcloud.internal.CloudClient] - {"host":"openhab.mydomain.com","cache-control":"no-cache","accept-encoding":"gzip, deflate","accept":"application/json","user-agent":"openhab-cloud/0.0.1"}
...
2020-09-16 00:58:21.391 [DEBUG] [io.openhabcloud.internal.CloudClient] - Got request 19
2020-09-16 00:58:21.411 [DEBUG] [io.openhabcloud.internal.CloudClient] - {"host":"openhab.mydomain.com","cache-control":"no-cache","accept-encoding":"gzip, deflate","accept":"application/json","user-agent":"openhab-cloud/0.0.1"}
...
2020-09-16 00:58:21.541 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sent headers to request 18
...
2020-09-16 00:58:21.564 [DEBUG] [io.openhabcloud.internal.CloudClient] - {"headers":{"Transfer-Encoding":"chunked","Server":"Jetty(9.4.20.v20190813)","Date":"Tue, 15 Sep 2020 19:28:21 GMT","Content-Type":"application/json"},"responseStatusCode":401,"responseStatusText":"OK","id":18}
2020-09-16 00:58:21.667 [WARN ] [io.openhabcloud.internal.CloudClient] - Jetty request 18 failed: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
2020-09-16 00:58:21.689 [WARN ] [io.openhabcloud.internal.CloudClient] - Response Failure: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
2020-09-16 00:58:21.726 [DEBUG] [io.openhabcloud.internal.CloudClient] - Finished responding to request 18
...
2020-09-16 00:58:21.950 [DEBUG] [io.openhabcloud.internal.CloudClient] - Sent content to request 19
2020-09-16 00:58:21.983 [DEBUG] [io.openhabcloud.internal.CloudClient] - Finished responding to request 19

Overall, this results in a failed discovery.

I then tried with commenting out the Get requests to org.eclipse.smarthome.i18n and org.eclipse.smarthome.core.i18nprovider and used this code in discovery.js and it worked. Was able to discover and control devices.

Promise.all([
      rest.getItems(
        this.directive.payload.scope.token, this.timeout)
//      rest.getServiceConfig(
//        this.directive.payload.scope.token, 'org.eclipse.smarthome.i18n', this.timeout),
//      rest.getServiceConfig(
//        this.directive.payload.scope.token, 'org.eclipse.smarthome.core.i18nprovider', this.timeout)
    ]).then((data) => {

I wasnt sure where to post this or if this is this an issue with the openhab core packages or the alexa lambda code.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
jsettoncommented, Oct 10, 2020

I merged a fix for this one. It also supports the measurementSystem property that was just added by @kaikreuzer to the OH3 root resource based on my feature request. I also improved the 2.x service config requests where only the supported service pid will now be queried based on the api version.

@candiesdoodle I was able to test this change on a barebone OH3 install without any issue. Can you please update your skill setup and let me know if it is working for you? Once you confirm, I will update the live skill.

1reaction
jsettoncommented, Oct 15, 2020

The live skill has now been updated and will now work with OH3.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OH3: New devices are not found in the Alexa App
The Alexa app can no longer find new devices. The connection between Alexa App and myopenHAB and my local openHAB 3.0.0 works.
Read more >
OH3 - MySensors Binding
Hello,. I did some testing with 2 openhab versions to one ethernet gateway. At first it did not discover any devices, thats because...
Read more >
openhab/openhab - Docker Image - Docker Hub
This error message may occur when running a recent openHAB container image on a Docker host with an outdated version of libseccomp2. The...
Read more >
Tuya Local Key
Get Tuya device's local key easily using Official Tuya IoT Python SDK. I search a lot, try to use work arounds and I...
Read more >
How to Connect openHAB and Tuya Devices
If you are looking for affordable smart switches, the Tuya devices are very ... Among the array of options provided by IFTTT you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found