freaktechnik / Webthingify

Turn your Android phone into a Web of Things thing
MIT License
35 stars 3 forks source link

Moz Gateway 0.9.1 and webthings #11

Open MarcKarasek opened 4 years ago

MarcKarasek commented 4 years ago

I cloned your app and built it. Installed on a Nexus 6 running carbon rom. Server on phone (port 8088) runs fine. When I try to find it on the gateway it says paring as failed?

Wil post some logs when I get the gateway back up.. it has lost its settings for add-ons and I need to reset things.

MarcKarasek commented 4 years ago

Finally got the gateway back up:

Here is a log from the gatewat ssh:

2020-01-13 22:52:35.938 INFO : thing-url: Starting mDNS discovery 2020-01-13 22:52:46.690 INFO : thing-url: Failed to connect to http://192.168.8.159:8088: FetchError: request to http://192.168.8.159:8088/ failed, reason: connect ECONNREFUSED 192.168.8.159:8088 2020-01-13 22:53:09.418 INFO : Pairing timeout 2020-01-13 22:53:09.429 ERROR : Thing was not added 2020-01-13 22:53:09.435 ERROR : addNewThing cancelled

2020-01-13 22:02:44.964 INFO : thing-url: Adapter: ThingURLAdapter id thing-url-adapter pairing cancelled

The server is running on the phone.
I have tried both http and https configured under web-things add-on.. Both are the same failed ECONNREFUSED..

eisengrau commented 4 years ago

Mentioned similar issue in #10, closed it. This definitely relates. The difference in my case that I ran the gateway on a Debian host.

MarcKarasek commented 4 years ago

I have compiled the app from the latest src on github and tried this (shoudl be against webthigns 0.12) which is also what the gateway I have is on..

same behavior ECONNREFUSED

MarcKarasek commented 4 years ago

? Did you have to do anything on the phone to open port 8088?

MarcKarasek commented 4 years ago

I have checked my phone via OS Monitor and it does not show the phone listening on port 8088.
/proc/net/tcp shows other ports but nothing listening on the webthing server port.

eisengrau commented 4 years ago

Could be that I have my phone rooted, it was listening on 8088, however the issue remains, it seems like the latest gateway is not compatible with the app.

freaktechnik commented 4 years ago

A quick test suggests that with the latest webthing library, the port that is specified is not the port that is bound - though that may also be an issue with android, where 8088 doesn't work without root. However, if I then make a request on the proper port, it seems to crash with java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern : %�NJ for which I have no idea where it'd come from.