I210I2000I2100I2100PI2120I2200I2300I3000I2105I2205I2150I2250I2350I3500I500I5000I5100I5200I5800V3000V5000V60004G/5G Industrial RouterU3M56MG11M9CT52C52C50EC100C110C120C20EC21EC22C23ECG11CM126C16C10CM554G/5G CPE/MiFiW5000W510W500W3500W3400W2140IX2404G/5G Outdoor CPEWL4800WL290WL280WL5000W5800W2100Outdoor Wireless APEL990EL680MEL620EL610BL5000BL90BL70BL80BL24BL20Indoor Wireless APIoT60IoT27IoT26IoT25IoT24IoT23IoT19IoT18IoT15IoT09IoT08IoT07IoT05IoT04Router ModulesAX3000MWireless RouterSD8TSD5TSD2F8T-SFPSD2F4T-SFPSD1F2T-SFPSD1F1T-SFPSL41HMSD6WF24F24TMSD4WF24TMSD4WF8TMSD2F8T-SFPGL260GL60AP Controller/PoE SwitchProduction Automation SolutionCNC Machine Monitoring SolutionIntelligent Oil Well Monitoring SolutionNatural Gas Well Station Remote Monitoring SystemSmart IndustryVending Machine SolutionsEV Charging Station Networking SolutionsSmart Express Cabinet SolutionsShared Massage Chair SolutionsSmart CitySmart PowerSmart ResidenceSmart CountrysideSmart OfficeSmart ParkSmart Venue BuildingIndustry NewsTechnical FAQProduct NewsCompany NewsComIn I210ComIn I2000ComIn I2100ComIn I2120ComIn I2200ComIn I2300ComIn I3000ComIn I2250ComIn I2350ComIn I3500ComIn I500ComIn I5100ComIn I5200ComIoT 04ComIoT 05ComIoT 08ComIoT 15ComIoT 18ComIoT 19ComIoT 23ComIoT 24ComIoT 60ComFi C16ComFi C21EComFi C22ComFi C23EComFi CG11ComFi C52ComFi CT52ComFi MG11ComFi IX240ComFi W510ComFi W5800AX3000MComIoT 27ComIoT 26Product VideoComCloud ManagementSIM Data Service地图

Device Disconnected but Still “Online”? The Five Stages Behind False MQTT Status

A field device has clearly lost power, yet the green dot on the monitoring dashboard stays lit. By the time the offline alarm finally fires, twenty minutes may have passed—long past the point of useful response.

After digging through logs, the root cause is usually one thing: the “online” status shown in the backend is never the device’s real-time state. It is a delayed judgment result. Break that judgment apart and the problem becomes clear.

From Power Loss to “Turning Red”: Five Stages in Between

A device goes through five stages before its backend status flips to offline. Any stage that stalls slows the whole detection:

  • Keepalive: the client sends periodic heartbeats to prove “I’m alive.”

  • Timeout detection: the broker waits out the timeout window before disconnecting.

  • Will message: the broker publishes the LWT (Last Will and Testament) offline notice.

  • Consumption: the backend subscribes to and parses the will message.

  • Persistence: the status is written to a database snapshot—which is what the frontend actually reads.

So the green dot reflects the value written at the last stage, not the live connection state. Troubleshooting must follow this chain.

Abrupt Power Loss: No Chance to Say Goodbye

Sudden power loss, a pulled cable, or an instant Wi-Fi drop means no TCP FIN or RST can be sent. The broker-side socket still holds the connection, completely unaware the other end is gone—this is a half-open connection.

Doesn’t TCP have its own keepalive? Two hard limitations make it unreliable: it’s off by default, and even when enabled, Linux probes only every 7,200 seconds by default. That’s why MQTT puts keepalive at the application layer: the client must send at least one PINGREQ within the keepalive period, and the broker replies with PINGRESP. Both fixed headers are just 2 bytes—negligible overhead.

But low-power devices often stretch heartbeats to save energy. In NB-IoT scenarios, intervals of ten minutes or even half an hour are common—and a device may simply “sleep to death” and stop sending heartbeats entirely.

The 1.5x Window: How Long a Device Can “Play Dead”

When heartbeats stop, the broker doesn’t declare death immediately. MQTT 3.1.1 specifies: with a non-zero keepalive, the broker waits 1.5 times the keepalive period without receiving any packet before treating the connection as failed. That 1.5 factor is headroom for network jitter.

The “playing dead” window follows:

KeepaliveBroker max waitTime still “online” after power loss
60 s90 s1.5 minutes
5 min450 s7.5 minutes
30 min2,700 s45 minutes
0 (disabled)NeverMay stay green indefinitely

Key takeaway: the alarm threshold must exceed 1.5x the keepalive period. Setting it within 1.5x causes false alarms. Different brokers apply their own grace factors, and actual waits often run slightly longer than 1.5x—so set the threshold to 2x the keepalive period.

keepalive=0: Disabling Detection, Not “No Heartbeat Needed”

Per the MQTT spec, a keepalive value of 0 means timeout detection is disabled—the broker won’t disconnect an inactive client, so the will message never fires. Some MQTT libraries default to 0, or an initialization omits the parameter, silently setting keepalive to 0 while the config page claims 60 seconds.

The most direct way to confirm the effective value is packet capture. Watch for one trap: a PINGREQ is only the two bytes C0 00, and contains no “pingreq” text, so grepping for the word finds nothing. Don’t jump to conclusions either—any MQTT control packet within the keepalive period counts as alive, and a device continuously publishing data never sends heartbeats. Check for ongoing PUBLISH first.

A Will Message Nobody Receives Is Wasted

The broker dutifully publishes the will, but if nobody subscribes or the topic doesn’t match, status never updates. The consumer side must complete receive → parse → flip status → write snapshot. Wildcard subscription across all devices is preferable to per-device subscription.

Two more pitfalls: graceful shutdowns must update status themselves (a normal DISCONNECT does not trigger the will), and duplicate ClientIDs count as anomalies (reconnecting the same ClientID elsewhere makes the broker kick the old connection and trigger the will). When device status flaps, check for duplicate ClientIDs first.

With MQTT 5.0, note that Will Delay Interval makes total latency “1.5x keepalive + will delay,” and reason code 0x04 allows a graceful disconnect to also publish the will.

Movingcomm’s Engineering View: Making Online Status Computable, Tunable, Traceable

In industrial IoT platforms and device connectivity, Movingcomm focuses not merely on “is the device connected,” but on whether the online-detection chain is observable: is the keepalive period taking effect as intended, is the will message correctly consumed, and how many seconds separate the status snapshot from the real connection.

With centralized monitoring from the cloud management platform, operators can first confirm whether heartbeats are being sent, then verify whether the alarm threshold is reasonable, and finally check whether the will-consumption chain is intact—rather than digging through logs twenty minutes after the alarm fires. Turning “false online” from folklore into a computable, shorten-able delay is what industrial device connectivity actually needs.

Still battling “device offline but shows online” on your platform? Movingcomm delivers industrial device connectivity and centralized operations. Contact our industry team for an online-detection chain assessment based on your keepalive configuration and alarm strategy.

E-Marketplace
Contact Information
Email: marketing@movingcomm.com
WhatsApp: +852 46409121
WeChat: +86-18077905372
Shenzhen Movingcomm Technology Co., Ltd. A trusted partner for network communication devices and solutions
在线表单
邮箱验证
Subscribe
*
Submit
Copyright ©2026 - Shenzhen Movingcomm Technology Co., Ltd
Download Materials