()
| 1799 | }).catch(() => {}); |
| 1800 | } |
| 1801 | |
| 1802 | function wifiZbScan() { |
| 1803 | if (_wifiState.zbBusy) return; |
| 1804 | _wifiState.zbBusy = true; |
| 1805 | const st = document.getElementById('wifi-zb-status'); |
| 1806 | if (st) st.textContent = 'Sniffing 802.15.4 (ch 11–26)…'; |
| 1807 | fetch('/api/net/zigbee/scan?duration=8').then(r => r.json()).then(d => { |
| 1808 | _wifiState.zbBusy = false; |
| 1809 | if (d.error) { if (st) st.textContent = '⚠ ' + d.error; _wifiState.zb = null; if (_wifiState.data) _wifiDrawSpectrum(); return; } |
| 1810 | _wifiState.zb = d; |
| 1811 | if (_wifiState.zbSelected && !(d.devices || []).some(v => (v.addr || v.short_addr) === _wifiState.zbSelected)) |
| 1812 | _wifiState.zbSelected = null; |
| 1813 | const i = d.interference || {}; |
| 1814 | if (st) st.textContent = `${d.device_count} device(s) · ${i.channel_count || 0} ch` + (d.warning ? ' ⚠' : ''); |
| 1815 | _wifiZbRender(); |
| 1816 | _wifiFsRenderSide(); |
| 1817 | if (_wifiState.data) _wifiDrawSpectrum(); |
| 1818 | }).catch(() => { _wifiState.zbBusy = false; if (st) st.textContent = 'Zigbee scan failed'; }); |
| 1819 | } |
| 1820 | |
| 1821 | function _wifiZbRender() { |
| 1822 | const d = _wifiState.zb; if (!d) return; |
| 1823 | const i = d.interference || {}; |
| 1824 | const sum = document.getElementById('wifi-zb-summary'); |
| 1825 | if (sum) sum.textContent = `${i.device_count || 0} device(s) · ${i.channel_count || 0} channel(s) · ${i.strong_count || 0} close`; |
| 1826 | const note = document.getElementById('wifi-zb-note'); |
| 1827 | if (note) note.textContent = (i.note || '') + ' ' + (d.companion_note || ''); |
| 1828 | const pr = document.getElementById('wifi-zb-pressure'); |
| 1829 | if (pr) pr.innerHTML = (i.wifi_channels || []).map(c => { |
| 1830 | const col = _BT_PRESSURE_COLOR[c.level] || '#64748b'; |
| 1831 | return `<span class="px-1.5 py-0.5 rounded" style="background:${col}22;color:${col};border:1px solid ${col}55" title="Estimated Zigbee pressure on Wi-Fi ch ${c.wifi_channel}">ch${c.wifi_channel}: ${c.level}</span>`; |
| 1832 | }).join(''); |
| 1833 | const tb = document.getElementById('wifi-zb-tbody'); |
| 1834 | if (!tb) return; |
| 1835 | if (!d.devices.length) { |
| 1836 | tb.innerHTML = '<tr><td colspan="6" class="py-3 text-gray-500">No Zigbee / 802.15.4 devices heard this sweep.</td></tr>'; |
nothing calls this directly
no test coverage detected