Repository navigation
Development
All source code is in src/, one file per topic. build.py assembles the files in a fixed order – there is no bundler and no dependency besides Python.
| File | Content |
|---|---|
src/version.js |
Version number (VERSION) |
src/i18n/<lang>.js |
Texts, one file per language (TEXT_XX, and NAMES_XX for translations of common English entity names); build.py collects all files and builds TEXT and LOCAL_NAMES
|
src/icons.js |
Device icons: path data of Material Design Icons (top level) |
src/styles.css |
Styles – becomes the constant TP_CSS; semantic colours come from COLORS as CSS variables (--c-good, --c-medium, --c-weak, --c-warn, --c-hint) |
src/markup.html |
HTML skeleton – becomes the constant TP_HTML
|
src/core.js |
Start of createThreadPulse(root, opts, host) and the state shared by all parts |
src/prefs.js |
Settings remembered by the browser: one table of keys, types and defaults; prefs.get / set / remove (first of the parts) |
src/helpers.js |
COLORS (all colours in one place), signal quality, icon images, theme, connection to Home Assistant, language |
src/data.js |
Loading the data from Home Assistant (registries, cached Matter diagnostics, border router) |
src/graph.js |
Building and drawing the map, the list below it |
src/live.js |
Routing tables, path calculation, animated messages, ticker, subscription to Home Assistant events |
src/heat.js |
Traffic heat |
src/rooms.js |
Room view |
src/panel.js |
Badges and detail panel |
src/hints.js |
Weak-spot hints |
src/search.js |
Search |
src/changes.js |
Change log |
src/response.js |
Response time |
src/battery.js |
Battery forecast |
src/wifi.js |
Matter devices on Wi-Fi / Ethernet |
src/sound.js |
Optional sound |
src/demo.js |
Demo mode |
src/ui.js |
List and legend, errors, loading, keyboard and click handling |
src/ambient.js |
Ambient mode |
src/start.js |
Start-up and the public API (destroy, theme) |
src/standalone.html |
Shell of the standalone page (iframe): reads URL parameters |
src/card.js |
Shell of the dashboard card custom:thread-pulse-card: options, visual editor, loading the graph library |
-
version.js, the language files ini18n/andicons.jsare top-level code. -
core.jsopens the functioncreateThreadPulse(). The files fromprefs.jstoambient.jsand finallystart.jsare placed inside this function, in the order listed inbuild.py;build.pyadds the closing brace. That is why the feature files are not valid JavaScript on their own – they use the shared state (network,nodeById,T…) declared incore.jsand the other parts. - Function declarations can be anywhere in these files. Code that runs immediately during start-up (not inside a function) must only use variables declared in an earlier file.
- Lines starting with
//#at the top of a file are notes for developers and are not copied into the output. - The shells (
standalone.html,card.js) callcreateThreadPulse()with a host object that tells the core how to reach Home Assistant, where the theme colours come from and how to open a page in Home Assistant.
| File | Content |
|---|---|
thread-pulse.html |
Standalone page |
dist/ha-thread-pulse.js |
Dashboard card (HACS file) |
dist/thread-pulse-vis-network.js, thread-pulse-vis-network.js
|
Graph library (vis-network 9.1.9, unmodified, readable build) |
Never edit the generated files by hand.
python3 build.pyEdit only the files in src/; never edit the generated files by hand.
- Open
thread-pulse.html?demoin a browser (served from a local web server, e.g.python3 -m http.server) – no Home Assistant needed. - In Home Assistant: copy
thread-pulse.htmlto/config/www/under another name and open it in an iframe card, or replace the card file of a manual installation.
A GitHub action runs on every pull request:
- HACS validation of the repository
-
Build check:
build.pyis run and the generated files must matchsrc/ -
Translations complete:
node tests/check-i18n.js– every language has the same keys as English - Syntax check of the card and the page
- One branch and one pull request per issue (
feature/<number>-<name>,fix/<number>-<name>); pull requests are squash-merged. - New entries go to
CHANGELOG.mdunder Unreleased. - Between releases the version is
<last release>+dev. - A release sets
VERSIONinsrc/version.js, moves the changelog section, gets a tagvX.Y.Zand a GitHub release without attachments – HACS would otherwise download the attachment instead of the card.
- Copy
src/i18n/en.jstosrc/i18n/<code>.js(two-letter code, e.g.pt.js) and renameTEXT_ENtoTEXT_PT. - Translate all values; optionally add
NAMES_PTwith translations of common English entity names (seede.js). - Run
node tests/check-i18n.jsandpython3 build.py. - Add the language to the list in
src/card.js(visual editor).
Issues and pull requests are welcome. GitHub offers forms that ask for the details needed:
| Form | Label | For |
|---|---|---|
| Bug report | bug |
Something does not work – asks for Thread Pulse and Home Assistant version, installation, border router, number of devices, browser, console errors |
| Feature request | New Feature |
New functionality |
| Translation correction | translation |
Wrong or unnatural texts in a language |
Further labels: enhancement (restructuring, maintenance, improvements of existing parts) and documentation.
Pull requests get a template with a short checklist: build, translation check, demo mode, real Home Assistant, changelog entry, documentation.
Thread Pulse · MIT License · This guide describes version 1.7.0 · Report a problem · Generated from docs/wiki in the repository – suggest changes there with a pull request
Getting started
Features
- Live data flow & traffic heat
- Detail panel
- Hints and warnings
- Mesh health
- Radio channels
- Response time
- Change log
- Offline notification
- Room view
- Search
- Saving an image
- Text report
- Network panel
- Device card
- Ambient mode
- Demo mode
Background
Links