A simple calculator for your dashboard.
- Make sure HACS is installed
- Add this repository as a custom repository in HACS:
- Go to HACS → Frontend
- Click the three dots menu → Custom repositories
- Add repository URL with category "Lovelace"
- Install the Calculator Card
- Restart Home Assistant
- Download
calculator-card.jsfrom the latest release - Copy it to
<config>/www/calculator-card.js - Add the resource in Home Assistant:
- Go to Settings → Dashboards → Resources
- Add
/local/calculator-card.jsas a JavaScript Module
Add the card to your Lovelace dashboard:
type: custom:calculator-card
title: My Card| Name | Type | Default | Description |
|---|---|---|---|
type |
string | Required | custom:calculator-card |
title |
string | Optional | Card title |
The easiest way to develop is using the included dev container:
- Install VS Code with the Dev Containers extension
- Open the project folder in VS Code
- Press
Ctrl+Shift+P→ "Dev Containers: Reopen in Container" - Wait for the container to build (first time takes ~2-3 minutes)
yarn install # Install dependencies (automatic on container creation)
yarn start # Dev server with hot reload (http://localhost:5000)
yarn build # Lint and build
yarn lint # Check code quality
yarn rollup # Production build only- Dev Server: http://localhost:5000 - Live reload development
- Home Assistant: http://localhost:8123 - Test environment (user:
dev/ pass:dev)
- In Home Assistant, go to Settings → Dashboards
- Create a new Dashboard
- Add the card from the GUI
- Create a new release on GitHub with a semver tag (e.g.,
v1.0.0) - GitHub Actions will automatically:
- Validate the tag format
- Update version in
package.jsonandsrc/consts.ts - Build and attach the JS file to the release
MIT License - see LICENSE file for details
