What is a "Session without data"?

I use hologram sims with a SIM7600G-H cell modem hat and even after being tested and connecting to a cell network with a data connection after some time in the field it will switch to connecting without data. Is there a way to prevent this type of connection or set the device to only connect when there is data?

I’m not too far ahead of you in the learning curve, so take that for what it is. My implementation on an esp32 is to connect to the cell network then use MQTT via the PubSubClient. I no longer see no-data sessions, but still have events that consume more data than normal.

When I observed no data sessions, it as because MQTT was not connecting to the broker successfully after the modem was connected. That could have many reasons (timeout, refused/dropped connection, bad client ID/credentials, authorization failure, etc). The modem connection can also be lost. For the most part, my solution involves adding error trapping during MQTT (and modem) method calls and checking for the state of MQTT before any publish attempt. The connect and publish methods both return Booleans which can be caught (or ignored). Most example code assumes happy path which is fine as long as you control the entire infrastructure.

You might also want to pay attention to SOCKET_TIMEOUT and KEEP_ALIVE settings. My experience is that making these arbitrarily long mostly just makes the code less responsive without changing the outcome.

Hope this helps,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.