WebThingsIO / thing-url-adapter

Proxy adapter for Web Thing API endpoints
Mozilla Public License 2.0
22 stars 18 forks source link

ESP8266 is disconnected #80

Closed PPCM closed 4 years ago

PPCM commented 4 years ago

Hello there,

I made a simple webthing with Wemos D1 Mini. The source file is joined to this post. Wifi_led.ino.txt

The connection to the WIFI and WebThings Gateway is done correctly. I can control the led without problem. But if there is no action after one or two minutes on the device, it is disconnected from WebThings Gateway.

Some investigations :

To reconnect the device to the gateway, the device has to be reseted.

How to make a stable permanent?

mrstegeman commented 4 years ago
PPCM commented 4 years ago

I don't know which version of the library I use, I downloaded it from here: https://github.com/mozilla-iot/webthing-arduino/releases

I use WebThing 0.4.1 on the gateway, but I didn't add any URL of the ESP8266 device, I simply add the device with the + button.

I don't think the device is low power mode because it responds to pings and direct access to the ESP8266 webserver succeed

PPCM commented 4 years ago

@mrstegeman Your post made me think about the way I added the device. So I changed the procedure:

That's mean there are 2 ways to add a new device, one works fine and the second doesn't work correctly. Perhaps, it will be good if only one way becomes available.

An other reflection: my devices are on a network with a DHCP server, what happen if the device changes its IP address? Does the gateway store devices with there MAC Address?

mrstegeman commented 4 years ago

Ah, good. Glad that's working for you. It seems like there's probably an mDNS issue, then. Lots of those seem to exist with the ESP mDNS libraries: https://github.com/mozilla-iot/webthing-arduino/issues

An other reflection: my devices are on a network with a DHCP server, what happen if the device changes its IP address?

The device will become disconnected. You're best off assigning a static IP to your device, if possible.

Does the gateway store devices with there MAC Address?

No. Ideally, mDNS resolves those issues. However, that doesn't seem to work all the time.