Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"format:check": "npx prettier --check src/**/*"
},
"dependencies": {
"@nabucasa/sl-web-tools": "^0.12.2",
"@nabucasa/sl-web-tools": "^0.13.0",
"improv-wifi-sdk": "^1.4.0"
},
"devDependencies": {
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed public/assets/firmwares/zbt2_zigbee_ncp_7.4.4.6.gbl
Binary file not shown.
19 changes: 2 additions & 17 deletions public/assets/manifests/zbt1.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,7 @@
"pid": 60000,
"vid": 4292
}],
"firmwares": [{
"name": "Zigbee (EZSP)",
"url": "/assets/firmwares/skyconnect_zigbee_ncp_7.4.4.3.gbl",
"type": "ncp-uart-hw",
"version": "7.4.4.3"
}, {
"name": "OpenThread (RCP)",
"url": "/assets/firmwares/skyconnect_openthread_rcp_2.4.4.0_GitHub-7074a43e4_gsdk_4.4.4.gbl",
"type": "ot-rcp",
"version": "2.4.4.0"
}, {
"name": "Multiprotocol (deprecated)",
"url": "https://raw.githubusercontent.com/NabuCasa/silabs-firmware/main/RCPMultiPAN/beta/NabuCasa_SkyConnect_RCP_v4.3.2_rcp-uart-hw-802154_460800.gbl",
"type": "rcp-uart-802154",
"version": "4.3.2"
}],
"firmwares": [],
"bootloader_reset": [],
"allow_custom_firmware_upload": true
}
}
14 changes: 2 additions & 12 deletions public/assets/manifests/zbt2.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,7 @@
"pid": 33562,
"vid": 12346
}],
"firmwares": [{
"name": "Zigbee (EZSP)",
"url": "/assets/firmwares/zbt2_zigbee_ncp_7.4.4.6.gbl",
"type": "ncp-uart-hw",
"version": "7.4.4.6"
}, {
"name": "OpenThread (RCP)",
"url": "/assets/firmwares/zbt2_openthread_rcp_2.4.4.0_GitHub-7074a43e4_gsdk_4.4.4.gbl",
"type": "ot-rcp",
"version": "2.4.4.0"
}],
"firmwares": [],
"bootloader_reset": ["rts_dtr", "baudrate"],
"allow_custom_firmware_upload": true
}
}
18 changes: 17 additions & 1 deletion src-11ty/home-assistant-connect-zbt-1/install.njk
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ hero: |
</p>

<div class="flasher-container">
<nabucasa-zigbee-flasher manifest="/assets/manifests/zbt1.json">
<nabucasa-zigbee-flasher
id="zbt1-flasher"
manifest="/assets/manifests/zbt1.json"
github-releases-api="https://api.github.com/repos/NabuCasa/silabs-firmware-builder/releases"
firmware-regex="^(skyconnect_|zbt1_)"
>
<span slot="button">Install firmware</span>
</nabucasa-zigbee-flasher>
</div>
Expand All @@ -57,4 +62,15 @@ hero: |

<script type="module">
import '@nabucasa/sl-web-tools';

document.querySelector('#zbt1-flasher').assetUrlTransformer = (url) => {
const match = url.match(
/github\.com\/([^/]+)\/([^/]+)\/releases\/download\/([^/]+)\/(.+)/,
);
if (match) {
const [, owner, repo, tag, filename] = match;
return `https://raw.githubusercontent.com/${owner}/${repo}/refs/heads/releases/${tag}/${filename}`;
}
return url;
};
</script>
18 changes: 17 additions & 1 deletion src-11ty/home-assistant-connect-zbt-2/install.njk
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ hero: |
</p>

<div class="flasher-container">
<nabucasa-zigbee-flasher manifest="/assets/manifests/zbt2.json">
<nabucasa-zigbee-flasher
id="zbt2-flasher"
manifest="/assets/manifests/zbt2.json"
github-releases-api="https://api.github.com/repos/NabuCasa/silabs-firmware-builder/releases"
firmware-regex="^zbt2_"
>
<span slot="button">Install firmware</span>
</nabucasa-zigbee-flasher>
</div>
Expand All @@ -32,4 +37,15 @@ hero: |

<script type="module">
import '@nabucasa/sl-web-tools';

document.querySelector('#zbt2-flasher').assetUrlTransformer = (url) => {
const match = url.match(
/github\.com\/([^/]+)\/([^/]+)\/releases\/download\/([^/]+)\/(.+)/,
);
if (match) {
const [, owner, repo, tag, filename] = match;
return `https://raw.githubusercontent.com/${owner}/${repo}/refs/heads/releases/${tag}/${filename}`;
}
return url;
};
</script>
29 changes: 6 additions & 23 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,12 @@ export default defineConfig({
plugins: [
{
name: 'py-raw-loader',
transform(code, id) {
if (id.endsWith('.py')) {
return { code: `export default ${JSON.stringify(code)};`, map: null };
enforce: 'pre',
load(id) {
if (id.endsWith('.py') || id.endsWith('.txt')) {
const content = fs.readFileSync(id, 'utf-8');
return { code: `export default ${JSON.stringify(content)};`, map: null };
}

if (id.endsWith('.txt')) {
if (code.startsWith('export default "data:text/plain;base64,')) {
const match = code.match(/data:text\/plain;base64,(.+?)"$/);
if (match) {
const base64Content = match[1];
const decodedContent = Buffer.from(
base64Content,
'base64'
).toString('utf-8');
return {
code: `export default ${JSON.stringify(decodedContent)};`,
map: null,
};
}
}
return { code: `export default ${JSON.stringify(code)};`, map: null };
}

return null;
},
},
{
Expand Down Expand Up @@ -69,6 +51,7 @@ export default defineConfig({
],

optimizeDeps: {
include: ['@nabucasa/sl-web-tools'],
esbuildOptions: {
loader: {
'.py': 'text',
Expand Down
Loading