@switchbot/homebridge-switchbot 5.0.0-beta.113 → 5.0.0-beta.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/homebridge-ui/public/js/app.js +57 -0
- package/dist/homebridge-ui/public/js/app.js.map +2 -2
- package/dist/homebridge-ui/public/js/render.d.ts.map +1 -1
- package/dist/homebridge-ui/public/js/render.js +62 -0
- package/dist/homebridge-ui/public/js/render.js.map +1 -1
- package/dist/homebridge-ui/public/js/render.ts +64 -0
- package/dist/platform.js +1 -1
- package/dist/platform.js.map +1 -1
- package/docs/variables/default.html +1 -1
- package/package.json +1 -1
- package/src/homebridge-ui/public/js/render.ts +64 -0
- package/src/platform.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>default | @switchbot/homebridge-switchbot</title><meta name="description" content="Documentation for @switchbot/homebridge-switchbot"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@switchbot/homebridge-switchbot</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">default</a></li></ul><h1>Variable default</h1></div><div class="tsd-signature"><span class="tsd-kind-variable">default</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-type-declaration"><h4>Type Declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature" id="__type"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">api</span>: <span class="tsd-signature-type">API</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/blob/
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>default | @switchbot/homebridge-switchbot</title><meta name="description" content="Documentation for @switchbot/homebridge-switchbot"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@switchbot/homebridge-switchbot</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">default</a></li></ul><h1>Variable default</h1></div><div class="tsd-signature"><span class="tsd-kind-variable">default</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">void</span></div><div class="tsd-type-declaration"><h4>Type Declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature" id="__type"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">api</span>: <span class="tsd-signature-type">API</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/blob/b0491897264b9ce5fd0e169024413db3851096b2/src/index.ts#L12">index.ts:12</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@switchbot/homebridge-switchbot</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html>
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@switchbot/homebridge-switchbot",
|
|
3
3
|
"displayName": "SwitchBot",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "5.0.0-beta.
|
|
5
|
+
"version": "5.0.0-beta.114",
|
|
6
6
|
"description": "The SwitchBot plugin allows you to access your SwitchBot device(s) from HomeKit.",
|
|
7
7
|
"author": "SwitchBot <support@wondertechlabs.com> (https://github.com/SwitchBot)",
|
|
8
8
|
"contributors": [
|
|
@@ -292,6 +292,7 @@ export function renderDeviceDetailsPanel(device: any): HTMLElement {
|
|
|
292
292
|
]
|
|
293
293
|
|
|
294
294
|
|
|
295
|
+
|
|
295
296
|
for (const row of rows) {
|
|
296
297
|
const line = document.createElement('div')
|
|
297
298
|
line.style.display = 'flex'
|
|
@@ -356,6 +357,69 @@ export function renderDeviceDetailsPanel(device: any): HTMLElement {
|
|
|
356
357
|
line.appendChild(label)
|
|
357
358
|
line.appendChild(valueWrap)
|
|
358
359
|
details.appendChild(line)
|
|
360
|
+
|
|
361
|
+
// If this is the Battery row, add a sparkline chart below
|
|
362
|
+
if (row.label === 'Battery' && Array.isArray(batteryHistory) && batteryHistory.length > 1) {
|
|
363
|
+
const chart = document.createElement('div')
|
|
364
|
+
chart.style.margin = '2px 0 8px 0'
|
|
365
|
+
chart.style.width = '100%'
|
|
366
|
+
chart.style.height = '28px'
|
|
367
|
+
chart.style.display = 'flex'
|
|
368
|
+
// SVG sparkline
|
|
369
|
+
const w = 120, h = 24, pad = 2
|
|
370
|
+
const min = Math.min(...batteryHistory.map(b => b.value), 100)
|
|
371
|
+
const max = Math.max(...batteryHistory.map(b => b.value), 0)
|
|
372
|
+
const range = max - min || 1
|
|
373
|
+
const points = batteryHistory.map((b, i) => {
|
|
374
|
+
const x = pad + (i * (w - 2 * pad)) / (batteryHistory.length - 1)
|
|
375
|
+
const y = pad + (h - 2 * pad) * (1 - (b.value - min) / range)
|
|
376
|
+
return `${x},${y}`
|
|
377
|
+
}).join(' ')
|
|
378
|
+
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
|
|
379
|
+
svg.setAttribute('width', String(w))
|
|
380
|
+
svg.setAttribute('height', String(h))
|
|
381
|
+
svg.setAttribute('viewBox', `0 0 ${w} ${h}`)
|
|
382
|
+
svg.style.display = 'block'
|
|
383
|
+
svg.style.background = '#f3f4f6'
|
|
384
|
+
svg.style.borderRadius = '3px'
|
|
385
|
+
svg.style.marginTop = '2px'
|
|
386
|
+
svg.style.boxShadow = '0 1px 2px #0001'
|
|
387
|
+
// Polyline for trend
|
|
388
|
+
const polyline = document.createElementNS('http://www.w3.org/2000/svg', 'polyline')
|
|
389
|
+
polyline.setAttribute('points', points)
|
|
390
|
+
polyline.setAttribute('fill', 'none')
|
|
391
|
+
polyline.setAttribute('stroke', '#2563eb')
|
|
392
|
+
polyline.setAttribute('stroke-width', '2')
|
|
393
|
+
svg.appendChild(polyline)
|
|
394
|
+
// Dots for each point
|
|
395
|
+
batteryHistory.forEach((b, i) => {
|
|
396
|
+
const x = pad + (i * (w - 2 * pad)) / (batteryHistory.length - 1)
|
|
397
|
+
const y = pad + (h - 2 * pad) * (1 - (b.value - min) / range)
|
|
398
|
+
const circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle')
|
|
399
|
+
circle.setAttribute('cx', String(x))
|
|
400
|
+
circle.setAttribute('cy', String(y))
|
|
401
|
+
circle.setAttribute('r', '2.5')
|
|
402
|
+
circle.setAttribute('fill', '#2563eb')
|
|
403
|
+
svg.appendChild(circle)
|
|
404
|
+
})
|
|
405
|
+
// Min/max labels
|
|
406
|
+
const minLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text')
|
|
407
|
+
minLabel.setAttribute('x', '2')
|
|
408
|
+
minLabel.setAttribute('y', String(h - 2))
|
|
409
|
+
minLabel.setAttribute('font-size', '9')
|
|
410
|
+
minLabel.setAttribute('fill', '#888')
|
|
411
|
+
minLabel.textContent = `${min}%`
|
|
412
|
+
svg.appendChild(minLabel)
|
|
413
|
+
const maxLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text')
|
|
414
|
+
maxLabel.setAttribute('x', String(w - 18))
|
|
415
|
+
maxLabel.setAttribute('y', '10')
|
|
416
|
+
maxLabel.setAttribute('font-size', '9')
|
|
417
|
+
maxLabel.setAttribute('fill', '#888')
|
|
418
|
+
maxLabel.textContent = `${max}%`
|
|
419
|
+
svg.appendChild(maxLabel)
|
|
420
|
+
chart.appendChild(svg)
|
|
421
|
+
details.appendChild(chart)
|
|
422
|
+
}
|
|
359
423
|
}
|
|
360
424
|
|
|
361
425
|
// --- Expose advanced/extra features dynamically ---
|
package/src/platform.ts
CHANGED
|
@@ -97,7 +97,7 @@ export const DEVICE_MATTER_CLUSTERS: Record<string, any> = {
|
|
|
97
97
|
}, // Switch in HAP, RobotVacuumCleaner in Matter
|
|
98
98
|
curtain: {
|
|
99
99
|
windowCovering: {
|
|
100
|
-
// Use
|
|
100
|
+
// Use Rollershade (0) for lift-only/non-tilt covering to match test expectation.
|
|
101
101
|
// Drapery (4) can fail validation in some stacks when TL (tilt) is not present.
|
|
102
102
|
type: 0, // Rollershade
|
|
103
103
|
},
|