Use of ligth or deepsleep ESP32 not sending data to gateway

Hi, first I’m enjoying playing around with the webthings, great job!
I’m using an ESP32 with a BME280. With a ‘normal’ routine I get the readings in the gateway and also the logs ar ok. But my idea is to set the project with a LiPo battery, so I’m trying to enhance the battery life time. When using the light or deepsleep in the serial port works but the gateway can see the device but the values ar keept constant, so no continuos input of data. I tryied to add a delay of 5s before go to sleep to keep the wifi signal working, but no luck.
there is any restriction like the device has to be always online to get a continous inout of data in the gateway? Any idea?

If Gateway can see the device check if data is sent to Gateway via webSocket.
I think in power saving mode WiFi is woke up immediately after LwIP receives data for sending.
I use ESP32 with minimum power saving “esp_wifi_set_ps(WIFI_PS_MIN_MODEM)” and with Gateway 1.0.0 it works fine.
My WiFi configuration is beacon every 1024 ms, DTIM = 1.
See my example project:

Hi Krzysztof_Zurek, I’m quite new on that. As far I could search online, fo reach property of the device, the gateway open a websocket? I tryied to read your project and seems you are coding in C/C++. I think your project is quite different that what I want to do. I’m using arduino code using the wethings-arduino library. My main concern is if the gateway (on Raspi) is listening all the time or every n seconds, and if need to have the thing’s wifi connnected all the time. I realized that after a minute or so the gateway says that the thing is disconnected.

Hi Sirty, I don’t exactly know what gateway does because some activities are hidden in websocket implementation.
But in my network ESP32 goes sleep and wakes up every 1 second, so wifi does not have to be on all the time.

I think you should:

  1. check wifi configuration, beacon period and DTIM, start with standard beacon period 100ms and DTIM=1, when it is ok extend beacon period to save more energy,
  2. check if you use the latest gateway version (1.0.0), the earlier versions had problem with power saving on ESP32.
  3. check if websocket on ESP32 is open and if it responds to “ping” messages (I don’t know how it is done in arduino-webthings).