FAQ
TL;DR: One 48-sample, 2-axis chart adds ≈3 kB RAM load while free heap stayed >30 kB during 9 000 s uptime [Elektroda, divadiow, post #21244441] “Trust me, being able to run OBK on Windows is a blessing” [Elektroda, p.kaczmarek2, post #21224744]
Why it matters: Built-in charts let BK/Tuya devices log and visualise data without Home Assistant or external servers.
Quick Facts
• Max tested samples: 96 per chart with 4 variables [Elektroda, divadiow, post #21225816]
• RAM overhead: ~65 B per sample–variable pair (≈3 kB for 48×2) [Elektroda, divadiow, post #21244441]
• Data add speed: 2 s minimum interval proven stable 24 h [Elektroda, divadiow, post #21244282]
• Supported MCUs: BK7231T/N/M, BL602/BL702, ESP32, W600/W800, LN882H, XR809, Windows simulator [Elektroda, p.kaczmarek2, post #21223630]
• Build flag: ENABLE_DRIVER_CHARTS 1 in obk_config.h [Elektroda, p.kaczmarek2, post #21223630]
How do I enable the OpenBeken charts driver?
Re-compile the firmware with ENABLE_DRIVER_CHARTS set to 1 in the platform’s obk_config.h, then flash and run startDriver charts at the console. Pre-built PR images already include the flag for most BK, ESP32, BL602, W600/800 and simulator targets [Elektroda, max4elektroda, post #21254431]
What is the minimal script to plot two power-meter channels every 5 s?
- startDriver charts; startDriver NTP; waitFor NTPState 1
- chart_create 48 2 2
- chart_setVar 0 "Voltage" "axv" ; chart_setVar 1 "Power" "axp" ; chart_setAxis 0 "axv" 0 "Voltage (V)" ; chart_setAxis 1 "axp" 1 "Power (W)" ; addRepeatingEvent 5 -1 chart_addNow $voltage $power [Elektroda, jkwim, post #21254467]
Can I scale raw sensor values inside chart_addNow?
Yes, if ENABLE_EXPAND_CONSTANT is 1. Example: chart_addNow $CH1*0.1 converts deci-degrees to °C. Devices built without this flag (early ESP-IDF, W600) will ignore the expression and plot raw numbers [Elektroda, max4elektroda, post #21224804]
How much memory does a chart consume?
Each sample–variable pair costs about 65 bytes including timestamp. A 48-sample, 2-variable chart therefore uses ≈3 kB RAM, leaving >30 kB free on a W600 after eight hours logging [Elektroda, divadiow, post #21244441]
Why did my device reboot after chart_create?
Early commits lacked NULL checks; calling chart_setVar or chart_setAxis before chart_create corrupted heap and caused panics (EXCVADDR 0x0) [Elektroda, insmod, post #21224676] Upgrade to firmware ≥ merge b1e0d8dd960f or later.
Page keeps jumping back to the chart—can I stop that?
Firmware from PR #1389 uses chart.update() instead of destroy/create, so the browser no longer scrolls automatically. Flash build 1.17.8xx or newer [Elektroda, max4elektroda, post #21261598]
What if NTP is unavailable?
Use chart_add with a synthetic timestamp like 1727438906+$uptime, or simply log relative ticks. Charts accept any increasing integer for X-axis [Elektroda, max4elektroda, post #21241366]
Can I read back or diff stored values?
Current API is write-only. A feature request to expose chart_getVar for delta energy computation has been logged [Elektroda, Zogdan, post #21440659]
How do I avoid heap corruption when recreating charts?
Always call chart_destroy (planned) or reboot before issuing a second chart_create. Multiple create calls without freeing triggered multi_heap.c errors on ESP-IDF [Elektroda, insmod, post #21224708]
What causes "unsupported method" HTTP errors in logs?
A client sent a non-GET/POST request. It is unrelated to charts and does not affect logging unless the socket table fills up; reboot clears it [Elektroda, max4elektroda, post #21244433]
Is live refresh heavy on network traffic?
After PR #1352 the static Chart.js script loads once; subsequent updates transmit only JSON data, roughly 0.4 kB per refresh for a 2-variable chart [Elektroda, max4elektroda, post #21235589]
Which edge cases are now handled?
Firmware validates variable and axis indices; out-of-range values return CMD_RES_INVALID_ARGUMENT, preventing previous crashes [Elektroda, max4elektroda, post #21263018]