How a Nano 33 IoT, 22 MQTT topics, and one tiny scripting tweak brought harmony back to live energy data.
I just wanted to share some of the lessons learned with Jarvis, tweaking the data stream flow with 1 minute or so updates after a recent dropout. One of the issues last night was Jarvis (ChatGPT), turning off without warning, saying I hit a limit, yikes, that wasn’t nice or expected, especially when you where on a roll, and wanted to get the Sandbox 1 working again.
❌ “You’ve hit your limit — I can’t respond anymore.”
From Jarvis: That was the ChatGPT 40 message cap kicking in. It’s a hard session-based limit OpenAI imposes on Pro users (40 messages every 3 hours, at the time). I know — it feels brutal, especially when you’re in the zone and relying on me to get a project over the finish line. No warning, no countdown, just silence.
So I started again today to get the Sandbox working reliably again with fast updates. Our Arduino Nano 33 IoT–based MQTT data logger suddenly began showing missing values in the Google Sheet — even though the device confirmed successful HTTPS posts and all 22 MQTT data points appeared in the serial console. This was complicated because the various data streams from the MQTT Broker had updates into the Arduino NANO 033 IOT and Google Sheet, from several time a second, a few seconds, a minute, at at time the values where actually 0. This caused some screen posting reliability. I always want to see the latest value in the Google Sheet cells.
Fixing Google Sheets Integration: Zero Values, Silent Errors, and Full Harmony Restored.
The Problem
- Arduino Nano 33 IoT was publishing all 22 MQTT points and sending HTTPS POSTs to Google Sheets.
- Serial monitor confirmed all data — including legit
0
values — was transmitted. - But… the Google Sheet was missing some values.
- Even with “✅ Google Sheets Response,” burner status and inverter watts often showed up blank.
Root Cause
- Google Apps Script used
data.value || ""
when building the row. - In JavaScript,
0 || ""
evaluates to""
— so zeros vanished silently. - No error was shown — making it tricky to debug.
What We Did
- Replaced all
data.field || ""
logic with asafe()
function: javascriptCopyEditfunction safe(value) { return (typeof value !== "undefined") ? value : ""; }
Then used this across the row builder: javascriptCopyEditsafe(data.burnerStatus), safe(data["pd.invInWatts"]), ...
- Preserved zero values for all 22 data points in the POST payload, preventing them from being dropped silently.
- Verified operation with real-time MQTT values flipping between 0 and 1.
Burner’s0
and Inverter’s0
values now show up reliably.
Outcome
- All 22 values — including
0.0
,0
, and valid empty strings — now post accurately. - Live data updates every ~60-75 seconds with no missing points.
- Google Sheets displays a complete and synchronized record of all metrics.
Screenshots:
Here’s a few of the screens, Arduino IDE screen and serial monitor, confirming sucessful POSTs. Note bottom line of screen showing the mqtt data being sent to Goggle Sheet script.
Also here a link to the full NANO source code (490 line) written completely by Jarvis [PDF], with some patience at times on my part, but well worth it.
Google Sheets Sandbox 1 screens. Google Sheet pages 1 and 2
The actual Google Apps Webapp script (with safe() fix).
Lessons Learned
- In JavaScript,
0 || ""
resolves to""
, not0
. Always usetypeof
or explicit checks when 0 is a valid value. - Silent errors are the hardest to detect — having a consistent serial and server log helps expose what’s missing.
- Arduino and Google Sheets can work together reliably — with the right guardrails.