Smart Home Device Inventory

Smart Home Device Inventory

Warning: You have 0 device(s) with expired warranties.
📱 0 Total Devices
💰 $0.00 Total Investment
📡 Active Network Status

Device Breakdown by Room

No data available.

Add New Device

Device Room IP Warranty Action
No devices logged.

Data Management

Manage your inventory data below.

No data available.

'; return; } // Find max for scaling const maxVal = Math.max(...Object.values(roomCounts)); for (const [room, count] of Object.entries(roomCounts)) { const pct = (count / maxVal) * 100; const row = document.createElement('div'); row.className = 'shi-bar-row'; row.innerHTML = `
${room}
${count}
`; roomChart.appendChild(row); } } function loadSampleData() { devices = [ { id: 1, name: "Nest Thermostat", type: "Climate", room: "Hallway", ip: "192.168.1.20", cost: 249.00, warranty: "2026-01-15" }, { id: 2, name: "Philips Hue Bridge", type: "Hub", room: "Office", ip: "192.168.1.5", cost: 59.99, warranty: "2024-05-01" }, { id: 3, name: "Hue Bulb 1", type: "Lighting", room: "Living Room", ip: "Zigbee", cost: 45.00, warranty: "2025-12-01" }, { id: 4, name: "Hue Bulb 2", type: "Lighting", room: "Living Room", ip: "Zigbee", cost: 45.00, warranty: "2025-12-01" }, { id: 5, name: "Ring Doorbell", type: "Security", room: "Outdoor", ip: "192.168.1.35", cost: 199.00, warranty: "2023-11-01" }, // Expired { id: 6, name: "Sonos Arc", type: "Entertainment", room: "Living Room", ip: "192.168.1.40", cost: 899.00, warranty: "2026-06-20" } ]; renderList(); renderDashboard(); switchTab(0); // Go to dashboard alert("Sample data loaded."); } function generatePDF() { if (!window.jspdf) { alert("PDF library not loaded."); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF(); // Header doc.setFontSize(22); doc.setTextColor(6, 182, 212); // Cyan doc.text("Smart Home Inventory", 14, 20); doc.setFontSize(10); doc.setTextColor(100); doc.text(`Generated: ${new Date().toLocaleDateString('en-US')}`, 14, 28); // Summary const totalCost = devices.reduce((sum, d) => sum + d.cost, 0); doc.setFontSize(12); doc.setTextColor(0); doc.text(`Total Devices: ${devices.length}`, 14, 40); doc.text(`Total Investment: $${totalCost.toFixed(2)}`, 14, 46); // Table const tableData = devices.map(d => [ d.name, d.type, d.room, d.ip, d.warranty || "-", `$${d.cost.toFixed(2)}` ]); doc.autoTable({ startY: 55, head: [['Device Name', 'Type', 'Location', 'IP Address', 'Warranty', 'Cost']], body: tableData, theme: 'striped', headStyles: { fillColor: [6, 182, 212] }, styles: { fontSize: 10 } }); doc.save('smart-home-inventory.pdf'); } // --- Event Listeners --- // Tabs tabs.forEach((tab, idx) => tab.addEventListener('click', () => switchTab(idx))); prevBtn.addEventListener('click', () => switchTab(currentTabIndex - 1)); nextBtn.addEventListener('click', () => switchTab(currentTabIndex + 1)); // Actions btnAdd.addEventListener('click', addDevice); btnSample.addEventListener('click', loadSampleData); btnClear.addEventListener('click', () => { if(confirm("Clear all data?")) { devices = []; renderList(); renderDashboard(); switchTab(0); } }); btnPdf.addEventListener('click', generatePDF); });
Scroll to Top