3.7 KiB
3.7 KiB
Debug Guide - Understanding LCD Builder Data Structure
How to Get Debug Information
Method 1: Browser Console (Recommended)
- Open the builder page in your browser
- Open Developer Tools: F12 or Ctrl+Shift+I
- Go to Console tab
- Run these commands one by one:
Check what pages are available:
console.log('Overlay Elements:', state.builder.overlayElements);
console.log('Base Elements:', state.builder.baseElements);
Get details about Status Bar specifically:
const statusBar = state.builder.overlayElements.find(el => el.text === 'Status Bar');
console.log('Status Bar element:', JSON.stringify(statusBar, null, 2));
Check the structure:
state.builder.overlayElements.forEach((el, idx) => {
console.log(`[${idx}] Type: ${el.type}, Text: ${el.text ?? 'N/A'}, Has children: ${!!el.children}`);
if (el.children) {
console.log(` Children:`, el.children);
}
});
Get full export of current page:
console.log(JSON.stringify(state.builder.overlayElements, null, 2));
Check element at point (test selection):
console.log('Last Status Data:', state.lastStatus);
console.log('Available bindings:', Object.keys(state.lastStatus ?? {}));
Method 2: Check Backend Directly
The overlay data is stored in SPIFFS. You can check what's actually saved:
Using curl (from command line):
curl http://192.168.40.16/api/pages/overlay?base=0
This returns the JSON structure that gets loaded.
What to Look For
When you run these commands, look for:
1. Does Status Bar have children?
- ✅ YES:
"children": [...]array exists in Status Bar object - ❌ NO: No children array, all elements are flat
2. What type is Status Bar?
- Look at the
"type"field - Common types: "label", "value", "button", "group", "panel", "container"
3. Are child elements separate?
- Count total elements in overlay array
- Does the sum make sense with Status Bar + children?
- Are child elements physically positioned relative to parent?
4. Child element structure:
- If children exist, what properties do they have?
- Do they have
x,ycoordinates? - Are x/y absolute or relative to parent?
Share This Information
Once you run these debug commands, please copy/paste the output and share:
- Full structure of Status Bar element (from
JSON.stringify()) - Count of total elements vs what you see in UI
- Any errors in the browser console
- How child elements are positioned (absolute vs relative to Status Bar)
Expected Output Examples
###If Status Bar has children (hierarchical):
{
"type": "group",
"text": "Status Bar",
"x": 10,
"y": 238,
"w": 460,
"h": 24,
"children": [
{"type": "label", "text": "Status", "x": 10, "y": 238, ...},
{"type": "value", "text": "Online", "x": 100, "y": 238, ...},
...
]
}
If Status Bar is flat (all siblings):
{
"type": "label",
"text": "Status Bar",
"x": 10,
"y": 238,
"w": 460,
"h": 24
}
// Followed by separate elements at same y position
Once I Have This Info
I can properly fix:
- ✅ Canvas rendering (to show all elements)
- ✅ Element selection (to click specific children)
- ✅ Properties editing (to edit child properties)
- ✅ Nested structure UI (if needed)
Quick Check Right Now
Just do this quickly:
- Open builder in browser
- Press F12
- Go to Console tab
- Copy/paste this one line:
console.log(JSON.stringify(state.builder.overlayElements.filter(el => el.text === 'Status Bar' || el.x === 10), null, 2));
- Copy the output and send it to me
This will show me the Status Bar and nearby elements!