vacuum-card 2.11.7 โ 2.12.0
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/.github/release-drafter.yml +58 -0
- package/.github/workflows/deps.yml +26 -0
- package/.github/workflows/main.yml +0 -47
- package/.github/workflows/release-drafter.yml +20 -0
- package/.github/workflows/release.yml +44 -0
- package/AGENTS.md +22 -0
- package/CONTRIBUTING.md +7 -0
- package/README.md +37 -37
- package/dist/vacuum-card.js +4 -1
- package/package.json +3 -39
- package/scripts/{lint-translations.mjs โ validate-i18n} +3 -0
- package/src/config.ts +1 -0
- package/src/editor.ts +20 -0
- package/src/styles.css +51 -13
- package/src/translations/ca.json +1 -0
- package/src/translations/cn.json +1 -0
- package/src/translations/cs.json +1 -0
- package/src/translations/da.json +1 -0
- package/src/translations/de.json +1 -0
- package/src/translations/en.json +1 -0
- package/src/translations/es.json +1 -0
- package/src/translations/fi.json +1 -0
- package/src/translations/fr.json +1 -0
- package/src/translations/he.json +1 -0
- package/src/translations/hu.json +1 -0
- package/src/translations/it.json +1 -0
- package/src/translations/ja.json +1 -0
- package/src/translations/ko.json +1 -0
- package/src/translations/lt.json +1 -0
- package/src/translations/nb.json +1 -0
- package/src/translations/nl.json +1 -0
- package/src/translations/nn.json +1 -0
- package/src/translations/pl.json +1 -0
- package/src/translations/pt-BR.json +1 -0
- package/src/translations/pt.json +1 -0
- package/src/translations/ro.json +1 -0
- package/src/translations/ru.json +1 -0
- package/src/translations/sv.json +1 -0
- package/src/translations/tw.json +1 -0
- package/src/translations/uk.json +1 -0
- package/src/translations/vi.json +1 -0
- package/src/types.ts +5 -0
- package/src/vacuum-card.ts +125 -37
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
name-template: v$RESOLVED_VERSION ๐งน
|
|
2
|
+
tag-template: v$RESOLVED_VERSION
|
|
3
|
+
exclude-contributors:
|
|
4
|
+
- github-actions[bot]
|
|
5
|
+
- github-actions
|
|
6
|
+
- dependabot[bot]
|
|
7
|
+
- dependabot
|
|
8
|
+
categories:
|
|
9
|
+
- title: โ๏ธ Breaking Changes
|
|
10
|
+
labels:
|
|
11
|
+
- breaking
|
|
12
|
+
- title: ๐ Features
|
|
13
|
+
labels:
|
|
14
|
+
- feature
|
|
15
|
+
- enhancement
|
|
16
|
+
- title: ๐ Bug Fixes
|
|
17
|
+
labels:
|
|
18
|
+
- fix
|
|
19
|
+
- bug
|
|
20
|
+
- title: ๐งฐ Maintenance
|
|
21
|
+
labels:
|
|
22
|
+
- chore
|
|
23
|
+
- dependencies
|
|
24
|
+
- documentation
|
|
25
|
+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
|
|
26
|
+
change-title-escapes: '\\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
|
|
27
|
+
version-resolver:
|
|
28
|
+
major:
|
|
29
|
+
labels:
|
|
30
|
+
- major
|
|
31
|
+
- breaking
|
|
32
|
+
minor:
|
|
33
|
+
labels:
|
|
34
|
+
- minor
|
|
35
|
+
- feature
|
|
36
|
+
- enhancement
|
|
37
|
+
patch:
|
|
38
|
+
labels:
|
|
39
|
+
- patch
|
|
40
|
+
- dependencies
|
|
41
|
+
default: patch
|
|
42
|
+
template: |
|
|
43
|
+
## What's Changed
|
|
44
|
+
|
|
45
|
+
$CHANGES
|
|
46
|
+
|
|
47
|
+
## โญ๏ธ Contributors
|
|
48
|
+
|
|
49
|
+
$CONTRIBUTORS
|
|
50
|
+
|
|
51
|
+
## Sponsorship
|
|
52
|
+
|
|
53
|
+
If you like this project, please consider supporting me:
|
|
54
|
+
|
|
55
|
+
- ๐ [Sponsor on GitHub](https://github.com/sponsors/denysdovhan)
|
|
56
|
+
- โ๏ธ [Buy Me A Coffee](https://buymeacoffee.com/denysdovhan)
|
|
57
|
+
- Bitcoin: `bc1q7lfx6de8jrqt8mcds974l6nrsguhd6u30c6sg8`
|
|
58
|
+
- Ethereum: `0x6aF39C917359897ae6969Ad682C14110afe1a0a1`
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Dependencies
|
|
2
|
+
on:
|
|
3
|
+
pull_request:
|
|
4
|
+
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write
|
|
7
|
+
pull-requests: write
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
dependabot-auto-merge:
|
|
11
|
+
name: Dependabot Auto-merge
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
if: github.event.pull_request.user.login == 'dependabot[bot]'
|
|
14
|
+
steps:
|
|
15
|
+
- name: ๐ฟ Fetch Dependabot metadata
|
|
16
|
+
id: metadata
|
|
17
|
+
uses: dependabot/fetch-metadata@v2
|
|
18
|
+
with:
|
|
19
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
20
|
+
|
|
21
|
+
- name: โ๏ธ Merge Dependabot PRs
|
|
22
|
+
if: steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch'
|
|
23
|
+
run: gh pr merge --auto --squash "$PR_URL"
|
|
24
|
+
env:
|
|
25
|
+
PR_URL: ${{ github.event.pull_request.html_url }}
|
|
26
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -4,7 +4,6 @@ on:
|
|
|
4
4
|
pull_request:
|
|
5
5
|
|
|
6
6
|
permissions:
|
|
7
|
-
id-token: write # Required for OIDC
|
|
8
7
|
contents: write
|
|
9
8
|
pull-requests: write
|
|
10
9
|
|
|
@@ -31,49 +30,3 @@ jobs:
|
|
|
31
30
|
|
|
32
31
|
- name: ๐งช Test
|
|
33
32
|
run: npm test
|
|
34
|
-
|
|
35
|
-
release:
|
|
36
|
-
name: Release
|
|
37
|
-
runs-on: ubuntu-latest
|
|
38
|
-
needs: [validate]
|
|
39
|
-
if: github.ref_name == 'main' && (github.event_name == 'push' || github.event.pull_request.merged)
|
|
40
|
-
steps:
|
|
41
|
-
- name: โฌ๏ธ Checkout Repo
|
|
42
|
-
uses: actions/checkout@v6
|
|
43
|
-
|
|
44
|
-
- name: โฌข Setup Node.js
|
|
45
|
-
uses: actions/setup-node@v6
|
|
46
|
-
with:
|
|
47
|
-
registry-url: https://registry.npmjs.org
|
|
48
|
-
node-version: latest
|
|
49
|
-
cache: npm
|
|
50
|
-
|
|
51
|
-
- name: ๐ฆ Install Packages
|
|
52
|
-
run: npm ci
|
|
53
|
-
|
|
54
|
-
- name: ๐ Build
|
|
55
|
-
run: npm run build
|
|
56
|
-
|
|
57
|
-
- name: ๐ Release
|
|
58
|
-
run: npx semantic-release
|
|
59
|
-
env:
|
|
60
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
61
|
-
|
|
62
|
-
dependabot:
|
|
63
|
-
name: Dependabot Auto-merge
|
|
64
|
-
runs-on: ubuntu-latest
|
|
65
|
-
needs: [validate]
|
|
66
|
-
if: github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'
|
|
67
|
-
steps:
|
|
68
|
-
- name: ๐ฟ Dependabot metadata
|
|
69
|
-
id: metadata
|
|
70
|
-
uses: dependabot/fetch-metadata@v2
|
|
71
|
-
with:
|
|
72
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
73
|
-
|
|
74
|
-
- name: โ๏ธ Enable Auto-merge for minor and patch Dependabot PRs
|
|
75
|
-
run: gh pr merge --auto --squash "$PR_URL"
|
|
76
|
-
if: steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch'
|
|
77
|
-
env:
|
|
78
|
-
PR_URL: ${{ github.event.pull_request.html_url }}
|
|
79
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: Release Drafter
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- main
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
pull-requests: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
update_release_draft:
|
|
14
|
+
name: Update Release Draft
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- name: ๐ Update draft
|
|
18
|
+
uses: release-drafter/release-drafter@v6
|
|
19
|
+
env:
|
|
20
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
on:
|
|
3
|
+
release:
|
|
4
|
+
types: [published]
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
contents: write
|
|
8
|
+
id-token: write
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
release:
|
|
12
|
+
name: Release
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: โฌ๏ธ Checkout Repo
|
|
16
|
+
uses: actions/checkout@v6
|
|
17
|
+
|
|
18
|
+
- name: โฌข Setup Node.js
|
|
19
|
+
uses: actions/setup-node@v6
|
|
20
|
+
with:
|
|
21
|
+
registry-url: https://registry.npmjs.org
|
|
22
|
+
node-version: latest
|
|
23
|
+
cache: npm
|
|
24
|
+
|
|
25
|
+
- name: ๐ฆ Install Packages
|
|
26
|
+
run: npm ci
|
|
27
|
+
|
|
28
|
+
- name: ๐งฎ Set version from tag
|
|
29
|
+
run: |
|
|
30
|
+
TAG="${{ github.event.release.tag_name }}"
|
|
31
|
+
npm version --no-git-tag-version "${TAG#v}"
|
|
32
|
+
|
|
33
|
+
- name: ๐ Build
|
|
34
|
+
run: npm run build
|
|
35
|
+
|
|
36
|
+
- name: ๐ Publish to npm
|
|
37
|
+
run: npm publish --provenance --access public
|
|
38
|
+
|
|
39
|
+
- name: ๐ฆ Upload release asset
|
|
40
|
+
uses: softprops/action-gh-release@v2
|
|
41
|
+
with:
|
|
42
|
+
files: dist/vacuum-card.js
|
|
43
|
+
env:
|
|
44
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
package/AGENTS.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Repository Guidelines
|
|
2
2
|
|
|
3
|
+
## Instructions
|
|
4
|
+
|
|
5
|
+
- Always refer to `home-assistant-js-websocket` library for types and functions to interact with the Home Assistant API.
|
|
6
|
+
- When interaction with Home Assistant API is needed, use `custom-card-helpers` library for helper utilities for the card lifecycle and events.
|
|
7
|
+
|
|
3
8
|
## Project Structure & Module Organization
|
|
4
9
|
|
|
5
10
|
- `src/`: TypeScript source for the custom Lovelace card (entry: `src/vacuum-card.ts`).
|
|
@@ -25,6 +30,23 @@
|
|
|
25
30
|
- Linting: ESLint (see `eslint.config.mjs`) using `@typescript-eslint` and `eslint-plugin-import`.
|
|
26
31
|
- Match existing patterns in `src/` for file naming and exports; prefer descriptive, kebab-case filenames for components.
|
|
27
32
|
|
|
33
|
+
## Technologies Used
|
|
34
|
+
|
|
35
|
+
- UI is a Home Assistant Lovelace custom card implemented as a Web Component with Lit (`LitElement`, decorators, `html` templates).
|
|
36
|
+
- Home Assistant integrations use `custom-card-helpers` for card lifecycle/events and `home-assistant-js-websocket` types for entities/services.
|
|
37
|
+
- Template rendering uses `ha-template` for dynamic text in the card.
|
|
38
|
+
- Localization is handled via JSON translation files in `src/translations/` and the `localize` helper.
|
|
39
|
+
- Build tooling is Rollup with TypeScript (`rollup-plugin-typescript2`), Babel transforms, and asset handling for JSON, images, CSS, and SVG.
|
|
40
|
+
- Styling uses PostCSS (`postcss-preset-env`) and `rollup-plugin-postcss-lit` to process component CSS.
|
|
41
|
+
- Production optimizations include HTML literal minification and Terser.
|
|
42
|
+
- Utility helpers include Lodash (`get`).
|
|
43
|
+
- Developer tooling includes ESLint, Prettier, Husky, and lint-staged.
|
|
44
|
+
|
|
45
|
+
## Documentations
|
|
46
|
+
|
|
47
|
+
- This card uses the [custom-card-helpers](https://custom-cards.github.io/custom-card-helpers/modules.html) library with helper utilities for the card lifecycle and events. Always refer to the documentation for useful functions and utilities.
|
|
48
|
+
- Use the [home-assistant-js-websocket](https://www.npmjs.com/package/home-assistant-js-websocket) library for types and functions to interact with the Home Assistant API.
|
|
49
|
+
|
|
28
50
|
## Testing Guidelines
|
|
29
51
|
|
|
30
52
|
- No dedicated test framework is configured.
|
package/CONTRIBUTING.md
CHANGED
|
@@ -34,3 +34,10 @@ Only native speaker can translate to specific language.
|
|
|
34
34
|
5. Add `http://localhost:5000/vacuum-card.js` to your Lovelace resources.
|
|
35
35
|
|
|
36
36
|
Now you can make changes to files in `src` folder. Development server will automatically rebuild on changes. Lovelace will load resource from development server. Refresh the browser to see changes. Make sure cache is cleared or disabled.
|
|
37
|
+
|
|
38
|
+
## Release process
|
|
39
|
+
|
|
40
|
+
1. Merge PRs into `main`. Release Drafter updates the draft release on each `main` push.
|
|
41
|
+
2. Edit the draft release notes if needed.
|
|
42
|
+
3. Publish the release with a tag like `vX.Y.Z`.
|
|
43
|
+
4. Publishing triggers the release workflow to build the project, publish to npm, and upload `dist/vacuum-card.js` to the GitHub release.
|
package/README.md
CHANGED
|
@@ -34,7 +34,6 @@ Just search for `Vacuum Card` in plugins tab.
|
|
|
34
34
|
1. Download `vacuum-card.js` file from the [latest-release].
|
|
35
35
|
2. Put `vacuum-card.js` file into your `config/www` folder.
|
|
36
36
|
3. Add reference to `vacuum-card.js` in Lovelace. There's two way to do that:
|
|
37
|
-
|
|
38
37
|
1. **Using UI:** _Configuration_ โ _Lovelace Dashboards_ โ _Resources Tab_ โ Click Plus button โ Set _Url_ as `/local/vacuum-card.js` โ Set _Resource type_ as `JavaScript Module`.
|
|
39
38
|
**Note:** If you do not see the Resources Tab, you will need to enable _Advanced Mode_ in your _User Profile_
|
|
40
39
|
2. **Using YAML:** Add following code to `lovelace` section.
|
|
@@ -107,20 +106,21 @@ shortcuts:
|
|
|
107
106
|
|
|
108
107
|
Here is what every option means:
|
|
109
108
|
|
|
110
|
-
| Name
|
|
111
|
-
|
|
|
112
|
-
| `type`
|
|
113
|
-
| `entity`
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
| `
|
|
120
|
-
| `
|
|
121
|
-
| `
|
|
122
|
-
| `
|
|
123
|
-
| `
|
|
109
|
+
| Name | Type | Default | Description |
|
|
110
|
+
| ---------------- | :-------: | ------------ | --------------------------------------------------------------------------------------------------------- |
|
|
111
|
+
| `type` | `string` | **Required** | `custom:vacuum-card` |
|
|
112
|
+
| `entity` | `string` | **Required** | An entity_id within the `vacuum` domain. |
|
|
113
|
+
| `battery_entity` | `string` | Optional | An entity_id within the `sensor` domain to display battery state and icon. |
|
|
114
|
+
| `map` | `string` | Optional | An entity_id within the `camera` domain, for streaming live vacuum map. |
|
|
115
|
+
| `map_refresh` | `integer` | `5` | Update interval for map camera in seconds |
|
|
116
|
+
| `image` | `string` | `default` | Path to image of your vacuum cleaner. Better to have `png` or `svg`. |
|
|
117
|
+
| `show_name` | `boolean` | `true` | Show friendly name of the vacuum. |
|
|
118
|
+
| `show_status` | `boolean` | `true` | Show status of the vacuum. |
|
|
119
|
+
| `show_toolbar` | `boolean` | `true` | Show toolbar with actions. |
|
|
120
|
+
| `compact_view` | `boolean` | `false` | Compact view without image. |
|
|
121
|
+
| `stats` | `object` | Optional | Custom per state stats for your vacuum cleaner |
|
|
122
|
+
| `actions` | `object` | Optional | Override default actions behavior with service invocations. |
|
|
123
|
+
| `shortcuts` | `array` | Optional | List of shortcuts shown at the right bottom part of the card with custom actions for your vacuum cleaner. |
|
|
124
124
|
|
|
125
125
|
### `stats` object
|
|
126
126
|
|
|
@@ -138,38 +138,38 @@ You can use any attribute of vacuum or even any entity by `entity_id` to display
|
|
|
138
138
|
|
|
139
139
|
You can defined service invocations to override default actions behavior. Available actions to override are `start`, `pause`, `resume`, `stop`, `locate` and `return_to_base`.
|
|
140
140
|
|
|
141
|
-
| Name | Type | Default
|
|
142
|
-
| -------------- | :------: |
|
|
143
|
-
| `service` | `string` | Optional
|
|
144
|
-
| `service_data` | `object` | `service_data` for `service` call
|
|
141
|
+
| Name | Type | Default | Description |
|
|
142
|
+
| -------------- | :------: | -------- | ----------------------------------------------- |
|
|
143
|
+
| `service` | `string` | Optional | A service to call, i.e. `script.clean_bedroom`. |
|
|
144
|
+
| `service_data` | `object` | Optional | `service_data` for `service` call |
|
|
145
145
|
|
|
146
146
|
### `shortcuts` object
|
|
147
147
|
|
|
148
148
|
You can defined [custom scripts][ha-scripts] for custom actions i.e cleaning specific room and add them to this card with `shortcuts` option.
|
|
149
149
|
|
|
150
|
-
| Name | Type | Default
|
|
151
|
-
| -------------- | :------: |
|
|
152
|
-
| `name` | `string` | Optional
|
|
153
|
-
| `service` | `string` | Optional
|
|
154
|
-
| `target` | `object` | Optional
|
|
155
|
-
| `icon` | `string` | Optional
|
|
156
|
-
| `service_data` | `object` | `service_data` for `service` call
|
|
150
|
+
| Name | Type | Default | Description |
|
|
151
|
+
| -------------- | :------: | -------- | ----------------------------------------------------------------------- |
|
|
152
|
+
| `name` | `string` | Optional | Friendly name of the action, i.e. `Clean bedroom`. |
|
|
153
|
+
| `service` | `string` | Optional | A service to call, i.e. `script.clean_bedroom`. |
|
|
154
|
+
| `target` | `object` | Optional | A `HassServiceTarget`, to define a target for the current service call. |
|
|
155
|
+
| `icon` | `string` | Optional | Any icon for action button. |
|
|
156
|
+
| `service_data` | `object` | Optional | `service_data` for `service` call |
|
|
157
157
|
|
|
158
158
|
## Theming
|
|
159
159
|
|
|
160
160
|
This card can be styled by changing the values of these CSS properties (globally or per-card via [`card-mod`][card-mod]):
|
|
161
161
|
|
|
162
|
-
| Variable | Default value
|
|
163
|
-
| --------------------------- |
|
|
164
|
-
| `--vc-background` | `transparent`
|
|
165
|
-
| `--vc-primary-text-color` | `var(--primary-text-color)`
|
|
166
|
-
| `--vc-secondary-text-color` | `var(--secondary-text-color)`
|
|
167
|
-
| `--vc-icon-color` | `var(--secondary-text-color)`
|
|
168
|
-
| `--vc-toolbar-background` | `
|
|
169
|
-
| `--vc-toolbar-text-color` | `var(--secondary-text-color)`
|
|
170
|
-
| `--vc-toolbar-icon-color` | `var(--secondary-text-color)`
|
|
171
|
-
| `--vc-divider-color` | `var(--entities-divider-color, var(--divider-color))`
|
|
172
|
-
| `--vc-spacing` | `10px`
|
|
162
|
+
| Variable | Default value | Description |
|
|
163
|
+
| --------------------------- | ---------------------------------------------------------------------- | --------------------------------------------------- |
|
|
164
|
+
| `--vc-background` | `var(--ha-card-background, var(--card-background-color, transparent))` | Card background. |
|
|
165
|
+
| `--vc-primary-text-color` | `var(--primary-text-color)` | Vacuum name, stats values, etc. |
|
|
166
|
+
| `--vc-secondary-text-color` | `var(--secondary-text-color)` | Status, stats units and titles, etc. |
|
|
167
|
+
| `--vc-icon-color` | `var(--secondary-text-color)` | Colors of icons. |
|
|
168
|
+
| `--vc-toolbar-background` | `transparent` | Toolbar background (transparent to avoid stacking). |
|
|
169
|
+
| `--vc-toolbar-text-color` | `var(--secondary-text-color)` | Color of the toolbar texts. |
|
|
170
|
+
| `--vc-toolbar-icon-color` | `var(--secondary-text-color)` | Color of the toolbar icons. |
|
|
171
|
+
| `--vc-divider-color` | `var(--entities-divider-color, var(--divider-color))` | Color of dividers. |
|
|
172
|
+
| `--vc-spacing` | `10px` | Paddings and margins inside the card. |
|
|
173
173
|
|
|
174
174
|
### Styling via theme
|
|
175
175
|
|