purifier-card 2.0.1 → 2.1.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 CHANGED
@@ -6,8 +6,7 @@
6
6
  "es6": true
7
7
  },
8
8
  "parserOptions": {
9
- "ecmaVersion": 2018,
9
+ "ecmaVersion": 2020,
10
10
  "sourceType": "module"
11
- },
12
- "rules": {}
11
+ }
13
12
  }
@@ -0,0 +1,14 @@
1
+ version: 2
2
+ updates:
3
+ # Maintain dependencies for GitHub Actions
4
+ - package-ecosystem: 'github-actions'
5
+ directory: '/'
6
+ schedule:
7
+ interval: 'monthly'
8
+
9
+ # Maintain dependencies for npm
10
+ - package-ecosystem: 'npm'
11
+ directory: '/'
12
+ schedule:
13
+ interval: 'monthly'
14
+ open-pull-requests-limit: 10
package/README.md CHANGED
@@ -1,26 +1,4 @@
1
- > # 🇺🇦 UKRAINE NEEDS YOUR HELP NOW!
2
- >
3
- > I'm the creator of this project and I'm Ukrainian.
4
- >
5
- > **My country, Ukraine, [is being invaded by the Russian Federation, right now](https://www.bbc.com/news/world-europe-60504334)**. I've fled Kyiv and now I'm safe with my family in the western part of Ukraine. At least for now.
6
- > Russia is hitting target all over my country by ballistic missiles.
7
- >
8
- > **Please, save me and help to save my country!**
9
- >
10
- > Ukrainian National Bank opened [an account to Raise Funds for Ukraine’s Armed Forces](https://bank.gov.ua/en/news/all/natsionalniy-bank-vidkriv-spetsrahunok-dlya-zboru-koshtiv-na-potrebi-armiyi):
11
- >
12
- > ```
13
- > SWIFT Code NBU: NBUA UA UX
14
- > JP MORGAN CHASE BANK, New York
15
- > SWIFT Code: CHASUS33
16
- > Account: 400807238
17
- > 383 Madison Avenue, New York, NY 10179, USA
18
- > IBAN: UA843000010000000047330992708
19
- > ```
20
- >
21
- > You can also donate to [charity supporting Ukrainian army](https://savelife.in.ua/en/donate/).
22
- >
23
- > **THANK YOU!**
1
+ [![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct-single.svg)](https://stand-with-ukraine.pp.ua/)
24
2
 
25
3
  # Purifier Card
26
4
 
@@ -95,6 +73,10 @@ stats:
95
73
  - attribute: motor_speed
96
74
  unit: RPM
97
75
  subtitle: Motor Speed
76
+ - value_template: >-
77
+ {{ (states('sensor.purifier_filter_life') | float(0) / 3600) | round(1) }}
78
+ unit: hours
79
+ subtitle: Filter Life
98
80
  shortcuts:
99
81
  - name: Silent
100
82
  icon: 'mdi:weather-night'
@@ -127,7 +109,7 @@ Here is what every option means:
127
109
  | `type` | `string` | **Required** | `custom:purifier-card` |
128
110
  | `entity` | `string` | **Required** | An entity_id within the `fan` domain. |
129
111
  | `show_name` | `boolean` | `true` | Show friendly name of the purifier. |
130
- | `show_status` | `boolean` | `true` | Show status of the purifier. |
112
+ | `show_state` | `boolean` | `true` | Show state of the purifier. |
131
113
  | `show_preset_mode` | `boolean` | `true` | Show preset mode of the purifier in the header. |
132
114
  | `show_toolbar` | `boolean` | `true` | Show toolbar with shortcuts. |
133
115
  | `compact_view` | `boolean` | `false` | Compact view without image. |
@@ -148,12 +130,13 @@ Here is what every option means:
148
130
 
149
131
  You can use any attribute of purifier or even any entity by `entity_id` to display by stats section:
150
132
 
151
- | Name | Type | Default | Description |
152
- | ----------- | :------: | -------- | ---------------------------------------------------- |
153
- | `entity_id` | `string` | Optional | An entity_id with state, i.e. `sensor.purifier_aqi`. |
154
- | `attribute` | `string` | Optional | Attribute name of the stat, i.e. `filter_left`. |
155
- | `unit` | `string` | Optional | Unit of measure, i.e. `hours`. |
156
- | `subtitle` | `string` | Optional | Friendly name of the stat, i.e. `Filter`. |
133
+ | Name | Type | Default | Description |
134
+ | ---------------- | :------: | -------- | ---------------------------------------------------- |
135
+ | `entity_id` | `string` | Optional | An entity_id with state, i.e. `sensor.purifier_aqi`. |
136
+ | `attribute` | `string` | Optional | Attribute name of the stat, i.e. `filter_left`. |
137
+ | `value_template` | `string` | Optional | Jinja2 template returning a value. |
138
+ | `unit` | `string` | Optional | Unit of measure, i.e. `hours`. |
139
+ | `subtitle` | `string` | Optional | Friendly name of the stat, i.e. `Filter`. |
157
140
 
158
141
  ### `shortcuts` object
159
142
 
@@ -174,6 +157,48 @@ The card will automatically try to figure out which one of shortcuts is currentl
174
157
  2. `entity`'s `percentage` attribute is equal to `shortcut`'s `percentage`.
175
158
  3. `entity`'s `preset_mode` attribute is equal to `shortcut`'s `preset_mode`.
176
159
 
160
+ ## Theming
161
+
162
+ This card can be styled by changing the values of these CSS properties (globally or per-card via [`card-mod`][card-mod]):
163
+
164
+ | Variable | Default value | Description |
165
+ | --------------------------- | ---------------------------------------------------------------- | ------------------------------------ |
166
+ | `--pc-background` | `var(--ha-card-background, var(--card-background-color, white))` | Background of the card |
167
+ | `--pc-primary-text-color` | `var(--primary-text-color)` | Vacuum name, stats values, etc |
168
+ | `--pc-secondary-text-color` | `var(--secondary-text-color)` | Status, stats units and titles, etc |
169
+ | `--pc-icon-color` | `var(--secondary-text-color)` | Colors of icons |
170
+ | `--pc-slider-path-color` | `var(--round-slider-path-color)` | Color of the slider path |
171
+ | `--pc-slider-bar-color` | `var(--round-slider-bar-color)` | Color of the slider bar |
172
+ | `--pc-toolbar-background` | `var(--vc-background)` | Background of the toolbar |
173
+ | `--pc-toolbar-text-color` | `var(--secondary-text-color)` | Color of the toolbar texts |
174
+ | `--pc-toolbar-icon-color` | `var(--secondary-text-color)` | Color of the toolbar icons |
175
+ | `--pc-divider-color` | `var(--entities-divider-color, var(--divider-color))` | Color of dividers |
176
+ | `--pc-spacing` | `10px` | Paddings and margins inside the card |
177
+
178
+ ### Styling via theme
179
+
180
+ Here is an example of customization via theme. Read more in the [Frontend documentation](https://www.home-assistant.io/integrations/frontend/).
181
+
182
+ ```yaml
183
+ my-custom-theme:
184
+ pc-background: '#17A8F4'
185
+ pc-spacing: 5px
186
+ ```
187
+
188
+ ### Styling via card-mod
189
+
190
+ You can use [`card-mod`][card-mod] to customize the card on per-card basis, like this:
191
+
192
+ ```yaml
193
+ type: 'custom:purifier-card'
194
+ style: |
195
+ ha-card {
196
+ --pc-background: #17A8F4;
197
+ --pc-spacing: 5px;
198
+ }
199
+ ...
200
+ ```
201
+
177
202
  ## Animations
178
203
 
179
204
  I've added an animation for this card to make it alive:
@@ -263,7 +288,7 @@ MIT © [Denys Dovhan][denysdovhan]
263
288
 
264
289
  [home-assistant]: https://www.home-assistant.io/
265
290
  [hacs]: https://hacs.xyz
266
- [preview-image]: https://user-images.githubusercontent.com/3459374/144429511-23d91a48-e296-4d68-a46c-48f3649bdcda.png
291
+ [preview-image]: https://user-images.githubusercontent.com/3459374/164275676-504d92aa-2c61-4451-ae9b-23dad113ce14.png
267
292
  [latest-release]: https://github.com/denysdovhan/purifier-card/releases/latest
268
293
  [ha-scripts]: https://www.home-assistant.io/docs/scripts/
269
294
  [xiaomi-miio-favorite-levels]: https://www.home-assistant.io/integrations/xiaomi_miio/#service-xiaomi_miiofan_set_favorite_level-air-purifiers-only