purifier-card 2.3.1 → 2.4.1
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/.eslintrc.json +6 -1
- package/.github/workflows/release.yml +19 -8
- package/.github/workflows/stale.yml +40 -0
- package/.github/workflows/validate.yml +33 -0
- package/README.md +11 -10
- package/dist/purifier-card.js +2 -2
- package/package.json +14 -6
- package/rollup.config.js +45 -31
- package/src/config.ts +26 -0
- package/src/declarations.d.ts +5 -0
- package/src/editor.css +19 -0
- package/src/editor.ts +166 -0
- package/src/{localize.js → localize.ts} +19 -15
- package/src/{purifier-card.js → purifier-card.ts} +136 -146
- package/src/styles.css +2 -1
- package/src/translations/bg.json +4 -4
- package/src/translations/ca.json +4 -4
- package/src/translations/cs.json +4 -7
- package/src/translations/de.json +4 -4
- package/src/translations/en.json +4 -7
- package/src/translations/fr.json +4 -4
- package/src/translations/it.json +4 -4
- package/src/translations/nb.json +4 -4
- package/src/translations/nl.json +4 -7
- package/src/translations/pl.json +5 -5
- package/src/translations/ru.json +4 -4
- package/src/translations/tr.json +4 -4
- package/src/translations/uk.json +4 -4
- package/src/translations/zh-CN.json +4 -4
- package/src/translations/zh-TW.json +4 -4
- package/src/types.ts +65 -0
- package/tsconfig.json +21 -0
- package/.github/workflows/build.yml +0 -14
- package/src/purifier-card-editor.js +0 -200
package/.eslintrc.json
CHANGED
|
@@ -3,21 +3,32 @@ on:
|
|
|
3
3
|
push:
|
|
4
4
|
branches:
|
|
5
5
|
- master
|
|
6
|
+
|
|
7
|
+
concurrency:
|
|
8
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
9
|
+
cancel-in-progress: true
|
|
10
|
+
|
|
6
11
|
jobs:
|
|
7
12
|
release:
|
|
8
13
|
name: Prepare release
|
|
9
14
|
runs-on: ubuntu-latest
|
|
10
15
|
steps:
|
|
11
|
-
-
|
|
16
|
+
- name: ⬇️ Checkout Repo
|
|
17
|
+
uses: actions/checkout@v3
|
|
18
|
+
|
|
19
|
+
- name: ⬢ Setup Node.js
|
|
20
|
+
uses: actions/setup-node@v3
|
|
21
|
+
with:
|
|
22
|
+
node-version: '*'
|
|
23
|
+
cache: npm
|
|
24
|
+
|
|
25
|
+
- name: 📦 Install Packages
|
|
26
|
+
run: npm ci
|
|
12
27
|
|
|
13
|
-
- name: Build
|
|
14
|
-
run:
|
|
15
|
-
cd /home/runner/work/purifier-card/purifier-card
|
|
16
|
-
npm install
|
|
17
|
-
npm run lint
|
|
18
|
-
npm run build
|
|
28
|
+
- name: 🏗 Build
|
|
29
|
+
run: npm run build
|
|
19
30
|
|
|
20
|
-
- name: Release
|
|
31
|
+
- name: 🚀 Release
|
|
21
32
|
run: npx semantic-release
|
|
22
33
|
env:
|
|
23
34
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Stale
|
|
2
|
+
on:
|
|
3
|
+
schedule:
|
|
4
|
+
- cron: '0 * * * *'
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
issues: write # to close stale issues (actions/stale)
|
|
9
|
+
pull-requests: write # to close stale PRs (actions/stale)
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
stale:
|
|
13
|
+
name: Stale
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: 🧹 Clean stale issues and pull requests
|
|
17
|
+
uses: actions/stale@v8
|
|
18
|
+
with:
|
|
19
|
+
stale-issue-message: >
|
|
20
|
+
There hasn't been any activity on this issue recently.
|
|
21
|
+
This issue has now been marked as stale and will be closed if no further activity occurs.
|
|
22
|
+
Please, update to the latest version and check if that solves the issue.
|
|
23
|
+
Thank you for your contributions!
|
|
24
|
+
close-issue-message: >
|
|
25
|
+
This issue was closed because it has been stalled for 30 days with no activity.
|
|
26
|
+
Please open a new issue if the issue is still relevant, linking to this one.
|
|
27
|
+
stale-pr-message: >
|
|
28
|
+
This PR is stale because there hasn't been any activity for a long time.
|
|
29
|
+
close-pr-message: >
|
|
30
|
+
This PR was closed because it has been stalled for 30 days with no activity.
|
|
31
|
+
days-before-issue-stale: 60
|
|
32
|
+
days-before-pr-stale: 90
|
|
33
|
+
days-before-issue-close: 30
|
|
34
|
+
days-before-pr-close: 30
|
|
35
|
+
exempt-all-milestones: true
|
|
36
|
+
stale-issue-label: stale
|
|
37
|
+
stale-pr-label: stale
|
|
38
|
+
exempt-issue-labels: no-stale
|
|
39
|
+
exempt-pr-labels: no-stale
|
|
40
|
+
exempt-draft-pr: true
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Validate
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
pull_request:
|
|
5
|
+
|
|
6
|
+
concurrency:
|
|
7
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
8
|
+
cancel-in-progress: true
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
validate:
|
|
12
|
+
name: Validate
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: ⬇️ Checkout Repo
|
|
16
|
+
uses: actions/checkout@v3
|
|
17
|
+
|
|
18
|
+
- name: ⬢ Setup Node.js
|
|
19
|
+
uses: actions/setup-node@v3
|
|
20
|
+
with:
|
|
21
|
+
node-version: '*'
|
|
22
|
+
cache: npm
|
|
23
|
+
|
|
24
|
+
- name: 📦 Install Packages
|
|
25
|
+
run: npm ci
|
|
26
|
+
|
|
27
|
+
- name: 🧪 Test
|
|
28
|
+
run: npm test
|
|
29
|
+
|
|
30
|
+
- name: 👷 HACS validation
|
|
31
|
+
uses: hacs/action@main
|
|
32
|
+
with:
|
|
33
|
+
category: plugin
|
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[![npm version][npm-image]][npm-url]
|
|
6
6
|
[![hacs][hacs-image]][hacs-url]
|
|
7
|
+
[![GitHub Sponsors][gh-sponsors-image]][gh-sponsors-url]
|
|
7
8
|
[![Patreon][patreon-image]][patreon-url]
|
|
8
9
|
[![Buy Me A Coffee][buymeacoffee-image]][buymeacoffee-url]
|
|
9
10
|
[![Twitter][twitter-image]][twitter-url]
|
|
@@ -16,13 +17,7 @@ By default, the Home Assistant does not provide any card for controlling air pur
|
|
|
16
17
|
|
|
17
18
|
## Installing
|
|
18
19
|
|
|
19
|
-
**💡 Tip:** If you like this project ~~and want to get some stickers and postcards~~, consider
|
|
20
|
-
|
|
21
|
-
<a href="https://patreon.com/denysdovhan">
|
|
22
|
-
<img alt="Become a patron" src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="150px">
|
|
23
|
-
</a>
|
|
24
|
-
|
|
25
|
-
or just buy me a cup of ☕️ or 🥤:
|
|
20
|
+
**💡 Tip:** If you like this project ~~and want to get some stickers and postcards~~, consider giving me a tip for the time I spent building this project:
|
|
26
21
|
|
|
27
22
|
<a href="https://www.buymeacoffee.com/denysdovhan" target="_blank">
|
|
28
23
|
<img src="https://cdn.buymeacoffee.com/buttons/default-black.png" alt="Buy Me A Coffee" width="150px">
|
|
@@ -39,13 +34,16 @@ Just search for `Purifier Card` in the plugins tab.
|
|
|
39
34
|
1. Download `purifier-card.js` file from the [latest-release].
|
|
40
35
|
2. Put `purifier-card.js` file into your `config/www` folder.
|
|
41
36
|
3. Add a reference to `purifier-card.js` in Lovelace. There's two way to do that:
|
|
37
|
+
|
|
42
38
|
1. **Using UI:** _Configuration_ → _Lovelace Dashboards_ → _Resources_ → Click Plus button → Set _Url_ as `/local/purifier-card.js` → Set _Resource type_ as `JavaScript Module`.
|
|
43
39
|
2. **Using YAML:** Add the following code to `lovelace` section.
|
|
40
|
+
|
|
44
41
|
```yaml
|
|
45
42
|
resources:
|
|
46
43
|
- url: /local/purifier-card.js
|
|
47
44
|
type: module
|
|
48
45
|
```
|
|
46
|
+
|
|
49
47
|
4. Add `custom:purifier-card` to Lovelace UI as any other card (using either editor or YAML configuration).
|
|
50
48
|
|
|
51
49
|
## Using the card
|
|
@@ -114,9 +112,8 @@ Here is what every option means:
|
|
|
114
112
|
| `show_toolbar` | `boolean` | `true` | Show toolbar with shortcuts. |
|
|
115
113
|
| `compact_view` | `boolean` | `false` | Compact view without image. |
|
|
116
114
|
| `aqi` | `object` | Optional | Custom entity or attribute for AQI value. |
|
|
117
|
-
| `stats` |
|
|
115
|
+
| `stats` | `array` | Optional | Custom per state stats for your purifier cleaner |
|
|
118
116
|
| `shortcuts` | `object` | Optional | Custom shortcuts for your purifier cleaner. |
|
|
119
|
-
| `platform` | `string` | Optional | Default `xiaomi_miio_airpurifier` |
|
|
120
117
|
|
|
121
118
|
### `aqi` object
|
|
122
119
|
|
|
@@ -126,9 +123,11 @@ Here is what every option means:
|
|
|
126
123
|
| `attribute` | `string` | Optional | An attribute which should be used to get AQI value. |
|
|
127
124
|
| `unit` | `string` | Optional | An unit of measurement to display. |
|
|
128
125
|
|
|
126
|
+
You can also combine `attribute` with `entity_id` to extract an attribute value of specific entity.
|
|
127
|
+
|
|
129
128
|
### `stats` object
|
|
130
129
|
|
|
131
|
-
You can use any attribute of purifier or even any entity by `entity_id` to display by stats section:
|
|
130
|
+
You can use any attribute of purifier or even any entity by `entity_id` to display by stats section. Not only that, but you can also combine `attribute` with `entity_id` to extract an attribute value of specific entity:
|
|
132
131
|
|
|
133
132
|
| Name | Type | Default | Description |
|
|
134
133
|
| ---------------- | :------: | -------- | ---------------------------------------------------------------------------------------------------- |
|
|
@@ -282,6 +281,8 @@ MIT © [Denys Dovhan][denysdovhan]
|
|
|
282
281
|
[npm-image]: https://img.shields.io/npm/v/purifier-card.svg?style=flat-square
|
|
283
282
|
[hacs-url]: https://github.com/hacs/integration
|
|
284
283
|
[hacs-image]: https://img.shields.io/badge/hacs-default-orange.svg?style=flat-square
|
|
284
|
+
[gh-sponsors-url]: https://github.com/sponsors/denysdovhan
|
|
285
|
+
[gh-sponsors-image]: https://img.shields.io/github/sponsors/denysdovhan?style=flat-square
|
|
285
286
|
[patreon-url]: https://patreon.com/denysdovhan
|
|
286
287
|
[patreon-image]: https://img.shields.io/badge/support-patreon-F96854.svg?style=flat-square
|
|
287
288
|
[buymeacoffee-url]: https://patreon.com/denysdovhan
|