Compare commits

..

162 Commits

Author SHA1 Message Date
Joakim Sørensen
d60639f99d Update .devcontainer.json 2023-01-29 10:14:40 +01:00
ludeeus
693b621dd5 Restructure devcontainer 2023-01-29 09:12:41 +00:00
dependabot[bot]
d96bb9cf20 Bump webpack-cli from 4.8.0 to 5.0.1 (#15181)
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.8.0 to 5.0.1.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.8.0...webpack-cli@5.0.1)

---
updated-dependencies:
- dependency-name: webpack-cli
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-29 02:01:07 -05:00
Paul Bottein
ec2d498334 Bumped version to 20230128.0 2023-01-28 13:42:07 +01:00
dependabot[bot]
c9b1b92e70 Bump webpackbar from 5.0.0-3 to 5.0.2 (#15225)
Bumps [webpackbar](https://github.com/unjs/webpackbar) from 5.0.0-3 to 5.0.2.
- [Release notes](https://github.com/unjs/webpackbar/releases)
- [Changelog](https://github.com/unjs/webpackbar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/unjs/webpackbar/compare/v5.0.0-3...v5.0.2)

---
updated-dependencies:
- dependency-name: webpackbar
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-27 10:02:58 -05:00
dependabot[bot]
a4a2e1b99e Bump @codemirror/language from 6.3.2 to 6.4.0 (#15229)
* Bump @codemirror/language from 6.3.2 to 6.4.0

Bumps [@codemirror/language](https://github.com/codemirror/language) from 6.3.2 to 6.4.0.
- [Release notes](https://github.com/codemirror/language/releases)
- [Changelog](https://github.com/codemirror/language/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/language/compare/6.3.2...6.4.0)

---
updated-dependencies:
- dependency-name: "@codemirror/language"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Deduplicate dependencies

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
2023-01-27 14:11:08 +00:00
dependabot[bot]
b31af60397 Bump @octokit/rest from 19.0.5 to 19.0.7 (#15228)
Bumps [@octokit/rest](https://github.com/octokit/rest.js) from 19.0.5 to 19.0.7.
- [Release notes](https://github.com/octokit/rest.js/releases)
- [Commits](https://github.com/octokit/rest.js/compare/v19.0.5...v19.0.7)

---
updated-dependencies:
- dependency-name: "@octokit/rest"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-27 06:35:13 +00:00
dependabot[bot]
01facc2254 Bump eslint-config-prettier from 8.5.0 to 8.6.0 (#15226)
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 8.5.0 to 8.6.0.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v8.5.0...v8.6.0)

---
updated-dependencies:
- dependency-name: eslint-config-prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-27 06:31:28 +00:00
dependabot[bot]
8b4587785c Bump fuse.js from 6.0.0 to 6.6.2 (#15209)
Bumps [fuse.js](https://github.com/krisk/Fuse) from 6.0.0 to 6.6.2.
- [Release notes](https://github.com/krisk/Fuse/releases)
- [Changelog](https://github.com/krisk/Fuse/blob/master/CHANGELOG.md)
- [Commits](https://github.com/krisk/Fuse/compare/v6.0.0...v6.6.2)

---
updated-dependencies:
- dependency-name: fuse.js
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-26 23:22:08 -05:00
Paul Bottein
89623aa7ec Fix margin and title on assist dialog (#15219) 2023-01-26 21:48:28 +01:00
dependabot[bot]
afb9e826ef Bump qrcode and @types/qrcode (#15207)
* Bump qrcode and @types/qrcode

Bumps [qrcode](https://github.com/soldair/node-qrcode) and [@types/qrcode](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/qrcode). These dependencies needed to be updated together.

Updates `qrcode` from 1.4.4 to 1.5.1
- [Release notes](https://github.com/soldair/node-qrcode/releases)
- [Changelog](https://github.com/soldair/node-qrcode/blob/master/CHANGELOG.md)
- [Commits](https://github.com/soldair/node-qrcode/compare/v1.4.4...v1.5.1)

Updates `@types/qrcode` from 1.4.2 to 1.5.0
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/qrcode)

---
updated-dependencies:
- dependency-name: qrcode
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: "@types/qrcode"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix possible null canvas context

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
2023-01-26 17:47:44 +00:00
Paul Bottein
ac075e44cc Add missing hass to chart base (#15218) 2023-01-26 15:37:51 +00:00
dependabot[bot]
fcf6bfc457 Bump intl-messageformat from 9.9.1 to 10.2.5 (#15213)
Bumps [intl-messageformat](https://github.com/formatjs/formatjs) from 9.9.1 to 10.2.5.
- [Release notes](https://github.com/formatjs/formatjs/releases)
- [Commits](https://github.com/formatjs/formatjs/compare/intl-messageformat@9.9.1...intl-messageformat@10.2.5)

---
updated-dependencies:
- dependency-name: intl-messageformat
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-26 10:17:44 -05:00
Paulus Schoutsen
3951646c7f Add link to docs in voice dialog (#15206) 2023-01-26 14:38:42 +01:00
dependabot[bot]
be6aabe23e Bump @typescript-eslint/parser from 5.44.0 to 5.49.0 (#15210)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.44.0 to 5.49.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.49.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-26 02:05:46 -05:00
dependabot[bot]
25f7a0602a Bump gulp-merge-json from 1.3.1 to 2.1.2 (#15173)
* Bump gulp-merge-json from 1.3.1 to 2.1.2

Bumps [gulp-merge-json](https://github.com/joshswan/gulp-merge-json) from 1.3.1 to 2.1.2.
- [Release notes](https://github.com/joshswan/gulp-merge-json/releases)
- [Commits](https://github.com/joshswan/gulp-merge-json/compare/1.3.1...v2.1.2)

---
updated-dependencies:
- dependency-name: gulp-merge-json
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Deduplicate dependencies

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
2023-01-26 05:52:16 +00:00
dependabot[bot]
34ed446cd2 Bump superstruct from 0.15.2 to 1.0.3 (#15190)
Bumps [superstruct](https://github.com/ianstormtaylor/superstruct) from 0.15.2 to 1.0.3.
- [Release notes](https://github.com/ianstormtaylor/superstruct/releases)
- [Changelog](https://github.com/ianstormtaylor/superstruct/blob/main/Changelog.md)
- [Commits](https://github.com/ianstormtaylor/superstruct/compare/v0.15.2...v1.0.3)

---
updated-dependencies:
- dependency-name: superstruct
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-25 11:40:00 -05:00
Paul Bottein
ffd7a0c153 Revert "New more info light" (#15203)
Revert "New more info light (#14453)"

This reverts commit 7c4a421e74.
2023-01-25 17:16:01 +01:00
Paul Bottein
b591c75377 Tile card fixes with vertical layout (#15202) 2023-01-25 17:15:12 +01:00
Bram Kragten
d2886b1ea7 Add aliases to areas (#15198)
* Add aliases to areas

* rename

* Update dialog-aliases.ts
2023-01-25 16:55:58 +01:00
Bram Kragten
a3ba8210cf Merge branch 'master' into dev 2023-01-25 16:49:25 +01:00
Bram Kragten
d1a04349a4 Bumped version to 20230125.0 2023-01-25 16:47:04 +01:00
Bram Kragten
bb273b2b54 Localize fixes (#15199) 2023-01-25 15:44:59 +00:00
karwosts
00667f1296 Vertically align history charts on left axis (#14919)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
fixes undefined
2023-01-25 15:42:20 +00:00
Florian Gareis
06368a6f0e Add vertical option for tile card (#14743) 2023-01-25 16:28:22 +01:00
Paul Bottein
7c4a421e74 New more info light (#14453) 2023-01-25 11:24:16 +01:00
karwosts
3675a2b013 Fix ha-selector-object not updating in the ui when new value is pushed from the parent (#15022)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
fixes undefined
2023-01-25 11:09:58 +01:00
Steve Repsher
0bbe6151ed Bump vaadin to 23.3.5 (#15185) 2023-01-25 11:06:28 +01:00
Paul Bottein
dace00ebf8 Fixes voice dialog border radius on safari (#15193) 2023-01-25 11:05:59 +01:00
Paul Bottein
a433ac48e9 Use device class icon for number domain (#15194) 2023-01-25 11:05:35 +01:00
Erik Montnemery
ddfaa67456 Allow overriding a sensor's precision (#15176)
* Allow overriding a sensor's precision

* use a dropdown for choosing precision

* Address review comments

* Handle undefined state

* Loose equality FTW

* Apply suggestions from code review
2023-01-25 11:04:03 +01:00
Paulus Schoutsen
8b4b19cc96 Remove onboarding support for conversation agent (#15187) 2023-01-25 10:28:43 +01:00
dependabot[bot]
c4183a9edb Bump @formatjs/intl-getcanonicallocales from 1.8.0 to 2.0.5 (#15174)
Bumps [@formatjs/intl-getcanonicallocales](https://github.com/formatjs/formatjs) from 1.8.0 to 2.0.5.
- [Release notes](https://github.com/formatjs/formatjs/releases)
- [Commits](https://github.com/formatjs/formatjs/compare/@formatjs/intl-getcanonicallocales@1.8.0...@formatjs/intl-getcanonicallocales@2.0.5)

---
updated-dependencies:
- dependency-name: "@formatjs/intl-getcanonicallocales"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-24 14:55:36 -05:00
Jan Bouwhuis
363ad369fc Fix current_humidity no shown on climate state card if also current_temperature is set (#14993)
* Also show current_humidity on climate

* Use one line

* Update src/components/ha-climate-state.ts

Co-authored-by: Paul Bottein <paul.bottein@gmail.com>

* Another blank and add import

Co-authored-by: Paul Bottein <paul.bottein@gmail.com>
2023-01-24 16:55:13 +00:00
karwosts
711286f7c0 Round battery values in device table to whole numbers (to fit in the column width) (#14927)
* Increase battery column width to fit 100.0%

* drop trailing 0s from battery decimals

* round values to whole numbers
2023-01-24 17:16:03 +01:00
holnburger
78857357f3 Add dark_mode options for image elements in picture-element-card (#15045) 2023-01-24 14:31:25 +00:00
karwosts
3c23e6a1c3 Add UI support for entities in numeric_state above/below conditions &… (#14966)
fixes undefined
2023-01-24 14:45:56 +01:00
karwosts
10369ff952 Delete weekdays key from time condition when emptied from the UI (#14992)
Co-authored-by: Paul Bottein <paul.bottein@gmail.com>
fixes undefined
2023-01-24 14:30:29 +01:00
Steve Repsher
134670604b Tell dependabot to ignore rollup (#15169) 2023-01-24 14:29:14 +01:00
cnico
8935dbac20 Allow iframe links to open on android through a parameter (#15063) 2023-01-24 13:24:11 +00:00
Adam Kapos
ccf15c7fb0 Fix button card font size on mobile (#14698) 2023-01-24 12:59:33 +00:00
Adam Kapos
5e4b673751 Fix relative time above 22 hours (#15072)
fixes https://github.com/home-assistant/frontend/issues/14815
fixes undefined
2023-01-24 12:53:57 +00:00
Paul Bottein
98e799eda0 Allow coloring inactive states in dashboard cards (#15177) 2023-01-24 13:45:47 +01:00
Erik Montnemery
5e9ae36577 Fetch number units from core (#15175) 2023-01-24 12:14:21 +01:00
karwosts
624bfbbaf1 Fix add/remove entities from map card editor (#15087) 2023-01-24 07:54:27 +01:00
dependabot[bot]
0e71eec937 Bump husky from 8.0.1 to 8.0.3 (#15171)
Bumps [husky](https://github.com/typicode/husky) from 8.0.1 to 8.0.3.
- [Release notes](https://github.com/typicode/husky/releases)
- [Commits](https://github.com/typicode/husky/compare/v8.0.1...v8.0.3)

---
updated-dependencies:
- dependency-name: husky
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-24 01:34:37 -05:00
Artem Draft
38562a42d6 Fix volume slider of assumed_state media player in entity row (#14931) 2023-01-23 20:19:11 +00:00
karwosts
e242fbe148 Sort battery level column using numeric sort (#14926)
fixes undefined
2023-01-23 21:10:01 +01:00
Karlie Meads
81e4f083f9 Fix disabling a state condition in the visual automation editor (#15027) 2023-01-23 21:08:10 +01:00
Yosi Levy
533b4ec0b4 Fix humidifier and log drop down (#14999) 2023-01-23 21:01:02 +01:00
karwosts
50a4c0f7ce Load script field default values into ha-service-control (#14949)
fixes undefined
2023-01-23 20:56:48 +01:00
karwosts
dfee6c9b5b Remove gauge card transparency on focus (#14789)
fixes undefined
2023-01-23 20:43:51 +01:00
Steve Repsher
fe2b4d9598 Remove aria-label and blur from list items (#15073) 2023-01-23 20:39:50 +01:00
Jan Bouwhuis
e6dbb1da7e Add backend translation support for selector select (#15064)
* Base for selector translations

* Allow translations for ha-selector-select

* Fetch translation for config flow and onboarding

* Get translation_key from step handler

* Add domain property to DataEntry flow

* Revert fetching translation for onboarding flow

* Leave domain for repair flows

* Use localizeValue function

* Change type

* Import selector translations in issue flow

Co-authored-by: Paul Bottein <paul.bottein@gmail.com>
2023-01-23 20:32:30 +01:00
karwosts
095ebbc903 Allow empty string as a valid conditional statement (#14918)
* Fix days missing from ha-base-time-input _valueChanged

* style change

* Allow empty string as a valid conditional check
2023-01-23 20:27:02 +01:00
Steve Repsher
9dcdf46316 Bump yarn to 3.3.1 (#15166) 2023-01-23 19:25:04 +00:00
Paul Bottein
d6e0d57744 Improve HA form default support (#14570)
* use default as placeholder if not required

* Do not force number selector to 0 or min when empty

* use undefined instead of empty string
2023-01-23 20:09:13 +01:00
karwosts
38c1112308 Prevent optional time fields in ha-service-control from auto-enabling (#15124)
* Fix select box overflowing entities-row

* Revert "Fix select box overflowing entities-row"

This reverts commit b4e668dd06.

* Fix optional time fields in service control from auto-enabling
2023-01-23 19:59:50 +01:00
Steve Repsher
88ee409987 Bump lit and lit-labs to latest (#15127)
* Bump lit and lit-labs to latest

* Resolve to same @lit/reactive-element for app-datepicker
2023-01-23 19:56:56 +01:00
Paulus Schoutsen
8073555bf9 Show Thread panel on thread config entry (#15150)
* Show Thread panel on thread config entry

* Rename data file to use right domain

* Make panel a bit more pleasant
2023-01-23 19:55:31 +01:00
dependabot[bot]
b4cd4975c1 Bump punycode from 2.1.1 to 2.3.0 (#15162)
* Bump punycode from 2.1.1 to 2.3.0

Bumps [punycode](https://github.com/mathiasbynens/punycode.js) from 2.1.1 to 2.3.0.
- [Release notes](https://github.com/mathiasbynens/punycode.js/releases)
- [Commits](https://github.com/mathiasbynens/punycode.js/commits)

---
updated-dependencies:
- dependency-name: punycode
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Deduplicate dependencies

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
2023-01-23 16:51:11 +00:00
dependabot[bot]
518d4f9c5b Bump date-fns from 2.23.0 to 2.29.3 (#15159)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-23 08:01:40 -05:00
J. Nick Koston
f991a1b819 Remove refresh interval configuration option from history graph card (#15154) 2023-01-23 09:40:59 +01:00
dependabot[bot]
6fc5fd9cc4 Bump cropperjs from 1.5.12 to 1.5.13 (#15161)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-23 09:34:21 +01:00
Paul Bottein
d15d339782 Entity state colors theming (#14831)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2023-01-23 09:28:38 +01:00
Steve Repsher
1b922e0065 Add more alternative text to various images (#14932)
* Add alt text for cast launcher images

* Hide icon with supervisor form field label

* Use attribute for iframe title for ingress view

* Hide some decorative ZWave/ZHA icons

* Hide image preload in state card configurator

* Use title for alt text  on image media

* Hide media art as decorative

* Do not allow empty string for image media
2023-01-22 22:47:12 -05:00
Steve Repsher
c8883a6a8a Bump devContainer image to python 3.10 (#15158) 2023-01-22 21:40:37 -05:00
J. Nick Koston
e14e27c01a Remove unused fetchRecent/fetchRecentWS/fetchDate history data functions (#15146)
* Add support for streaming history

* Add support for streaming history

* Add support for streaming history

* Add support for streaming history

* fixes

* cleanup

* redraw

* naming is hard

* drop cached history

* backport

* Convert history header/footer to use streaming history

needs #15112

* Update map card to use streaming history

Update map card to use streaming history

Update map card to use streaming history

Update map card to use streaming history

Update map card to use streaming history

Update map card to use streaming history

Update map card to use streaming history

* Remove unused fetchRecent/fetchRecentWS/fetchDate history data functions

These call are no longer needed after

* Update src/data/history.ts

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* Update src/data/history.ts

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* review

* review

* review

* review

* review

* review

* review

* review

* adjust

* Revert "adjust"

This reverts commit 6ba31da4a5.

* move setInterval

* Object.keys to for

* refactor

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-01-22 04:36:47 +00:00
Steve Repsher
f101bd1a54 Fix localize key errors for URL error and system log (#14909)
* Use literal type for system log level

* Fix typo in URL error title key

* Remove localize key exceptions
2023-01-21 23:29:17 -05:00
J. Nick Koston
3e14d825e3 Optimize purge of old live history data in the time window (#15153)
from https://github.com/home-assistant/frontend/pull/15112#discussion_r1083382923
2023-01-22 04:16:52 +00:00
J. Nick Koston
f34d9c3d75 Update map card to use streaming history (#15145)
* Add support for streaming history

* Add support for streaming history

* Add support for streaming history

* Add support for streaming history

* fixes

* cleanup

* redraw

* naming is hard

* drop cached history

* backport

* Convert history header/footer to use streaming history

needs #15112

* Update map card to use streaming history

Update map card to use streaming history

Update map card to use streaming history

Update map card to use streaming history

Update map card to use streaming history

Update map card to use streaming history

Update map card to use streaming history

* Update src/data/history.ts

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* Update src/data/history.ts

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* review

* review

* review

* review

* review

* review

* review

* review

* adjust

* Revert "adjust"

This reverts commit 6ba31da4a5.

* move setInterval

* Object.keys to for

* refactor

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-01-22 04:12:58 +00:00
J. Nick Koston
2b2dd74672 Convert history header/footer to use streaming history (#15136)
* Add support for streaming history

* Add support for streaming history

* Add support for streaming history

* Add support for streaming history

* fixes

* cleanup

* redraw

* naming is hard

* drop cached history

* backport

* Convert history header/footer to use streaming history

needs #15112

* Update src/data/history.ts

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* Update src/data/history.ts

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* review

* review

* review

* review

* review

* review

* review

* review

* adjust

* Revert "adjust"

This reverts commit 6ba31da4a5.

* move setInterval

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-01-22 03:58:12 +00:00
J. Nick Koston
815d4c165d Add support for streaming history (#15112)
* Add support for streaming history

* Add support for streaming history

* Add support for streaming history

* Add support for streaming history

* fixes

* cleanup

* redraw

* naming is hard

* drop cached history

* backport

* Update src/data/history.ts

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* Update src/data/history.ts

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* review

* review

* review

* review

* review

* review

* review

* review

* adjust

* Revert "adjust"

This reverts commit 6ba31da4a5.

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-01-21 22:41:41 -05:00
Steve Repsher
fd22afedd0 Fix uncaught exception in quick-bar mixin (#15061) 2023-01-21 22:23:14 -05:00
dependabot[bot]
522c7c08a9 Bump hls.js from 1.2.5 to 1.3.1 (#15128)
Bumps [hls.js](https://github.com/video-dev/hls.js) from 1.2.5 to 1.3.1.
- [Release notes](https://github.com/video-dev/hls.js/releases)
- [Changelog](https://github.com/video-dev/hls.js/blob/master/docs/release-process.md)
- [Commits](https://github.com/video-dev/hls.js/compare/v1.2.5...v1.3.1)

---
updated-dependencies:
- dependency-name: hls.js
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-21 01:48:22 -05:00
dependabot[bot]
dc140f132d Bump @types/js-yaml from 4.0.3 to 4.0.5 (#15140)
Bumps [@types/js-yaml](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/js-yaml) from 4.0.3 to 4.0.5.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/js-yaml)

---
updated-dependencies:
- dependency-name: "@types/js-yaml"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-20 10:08:16 -05:00
dependabot[bot]
4c76a2549b Bump glob and @types/glob (#15138)
Bumps [glob](https://github.com/isaacs/node-glob) and [@types/glob](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/glob). These dependencies needed to be updated together.

Updates `glob` from 7.2.0 to 8.1.0
- [Release notes](https://github.com/isaacs/node-glob/releases)
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v7.2.0...v8.1.0)

Updates `@types/glob` from 7.2.0 to 8.0.0
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/glob)

---
updated-dependencies:
- dependency-name: glob
  dependency-type: direct:development
  update-type: version-update:semver-major
- dependency-name: "@types/glob"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-20 14:39:06 +00:00
dependabot[bot]
a5c77928d2 Bump eslint-plugin-wc from 1.3.2 to 1.4.0 (#15139)
Bumps [eslint-plugin-wc](https://github.com/43081j/eslint-plugin-wc) from 1.3.2 to 1.4.0.
- [Release notes](https://github.com/43081j/eslint-plugin-wc/releases)
- [Changelog](https://github.com/43081j/eslint-plugin-wc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/43081j/eslint-plugin-wc/commits)

---
updated-dependencies:
- dependency-name: eslint-plugin-wc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-20 09:17:34 -05:00
Paulus Schoutsen
d3e20429a4 Prepare conversation agent (#15135) 2023-01-19 16:28:03 +01:00
Paul Bottein
2f1d783d22 Revert "Bump webpack from 5.55.1 to 5.75.0" (#15142)
Revert "Bump webpack from 5.55.1 to 5.75.0 (#15080)"

This reverts commit c7f4693f0a.
2023-01-19 09:48:34 +01:00
Paulus Schoutsen
558f523207 Add initial Thread panel (#15126)
* Add initial Thread panel

* Add link to Matter panel
2023-01-19 09:35:33 +01:00
dependabot[bot]
c7f4693f0a Bump webpack from 5.55.1 to 5.75.0 (#15080)
* Bump webpack from 5.55.1 to 5.75.0

Bumps [webpack](https://github.com/webpack/webpack) from 5.55.1 to 5.75.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.55.1...v5.75.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Deduplicate dependencies

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
2023-01-18 15:27:38 -05:00
dependabot[bot]
282823ee83 Bump prettier from 2.8.1 to 2.8.3 (#15129)
* Bump prettier from 2.8.1 to 2.8.3

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.1 to 2.8.3.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.1...2.8.3)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* apply rules

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Paul Bottein <paul.bottein@gmail.com>
2023-01-18 14:16:42 -05:00
dependabot[bot]
014ae06e85 Bump del from 4.1.1 to 7.0.0 (#15120)
* Bump del from 4.1.1 to 7.0.0

Bumps [del](https://github.com/sindresorhus/del) from 4.1.1 to 7.0.0.
- [Release notes](https://github.com/sindresorhus/del/releases)
- [Commits](https://github.com/sindresorhus/del/compare/v4.1.1...v7.0.0)

---
updated-dependencies:
- dependency-name: del
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Deduplicate dependencies

* Adjust to ESM-only and API changes

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
2023-01-18 18:21:41 +00:00
Paul Bottein
9e5442db18 Use ripple effect for tile card (#15007)
* Use ripple effect for tile card

* Use border for focus
2023-01-18 11:35:54 +01:00
Paul Bottein
789a69fea5 Improve slider/switch bar focus style (#15009)
Improve bar input focus style
2023-01-18 11:34:57 +01:00
Paul Bottein
c7da1a95da Exclude selected items for entities picker (#15057) 2023-01-18 11:34:23 +01:00
Paul Bottein
6d527d5ebe Add required style to required select selector (#15082) 2023-01-18 11:33:05 +01:00
dependabot[bot]
9d529d8f13 Bump sinon from 11.0.0 to 15.0.1 (#15121)
* Bump sinon from 11.0.0 to 15.0.1

Bumps [sinon](https://github.com/sinonjs/sinon) from 11.0.0 to 15.0.1.
- [Release notes](https://github.com/sinonjs/sinon/releases)
- [Changelog](https://github.com/sinonjs/sinon/blob/main/docs/changelog.md)
- [Commits](https://github.com/sinonjs/sinon/compare/v11.0.0...v15.0.1)

---
updated-dependencies:
- dependency-name: sinon
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Deduplicate dependencies

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
2023-01-18 06:11:05 +00:00
Steve Repsher
468aeda74a Bump @material components to 0.27 (#15000) 2023-01-17 15:25:43 +01:00
dependabot[bot]
f6a508683c Bump memoize-one from 5.2.1 to 6.0.0 (#15122)
Bumps [memoize-one](https://github.com/alexreardon/memoize-one) from 5.2.1 to 6.0.0.
- [Release notes](https://github.com/alexreardon/memoize-one/releases)
- [Commits](https://github.com/alexreardon/memoize-one/compare/v5.2.1...v6.0.0)

---
updated-dependencies:
- dependency-name: memoize-one
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-17 08:56:39 -05:00
dependabot[bot]
64fabbbf05 Bump follow-redirects from 1.13.0 to 1.15.2 (#15119)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.13.0 to 1.15.2.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.13.0...v1.15.2)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-17 06:03:39 +00:00
dependabot[bot]
9b95814f1b Bump webpack-dev-server from 4.3.0 to 4.11.1 (#15081)
* Bump webpack-dev-server from 4.3.0 to 4.11.1

Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server) from 4.3.0 to 4.11.1.
- [Release notes](https://github.com/webpack/webpack-dev-server/releases)
- [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-dev-server/compare/v4.3.0...v4.11.1)

---
updated-dependencies:
- dependency-name: webpack-dev-server
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Deduplicate dependencies

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
2023-01-17 00:45:58 -05:00
Paulus Schoutsen
2f2cde328c How can I assist (#15118) 2023-01-16 22:57:32 -05:00
dependabot[bot]
8294e0e271 Bump object-hash from 2.0.3 to 3.0.0 (#15114)
Bumps [object-hash](https://github.com/puleos/object-hash) from 2.0.3 to 3.0.0.
- [Release notes](https://github.com/puleos/object-hash/releases)
- [Commits](https://github.com/puleos/object-hash/compare/v2.0.3...v3.0.0)

---
updated-dependencies:
- dependency-name: object-hash
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-16 18:51:18 -05:00
karwosts
f09859ab40 Fix select box overflowing entities-row (#15105) 2023-01-16 10:35:38 +01:00
dependabot[bot]
e206e86fb3 Bump xss from 1.0.9 to 1.0.14 (#15115)
* Bump xss from 1.0.9 to 1.0.14

Bumps [xss](https://github.com/leizongmin/js-xss) from 1.0.9 to 1.0.14.
- [Release notes](https://github.com/leizongmin/js-xss/releases)
- [Changelog](https://github.com/leizongmin/js-xss/blob/master/CHANGELOG.md)
- [Commits](https://github.com/leizongmin/js-xss/compare/v1.0.9...v1.0.14)

---
updated-dependencies:
- dependency-name: xss
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Use whitelist type from package

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
2023-01-16 07:24:21 +00:00
Bram Kragten
21f3eb9103 filter disabled hardware integrations (#14964) 2023-01-16 01:10:36 -05:00
dependabot[bot]
932614e31a Bump @babel/plugin-proposal-decorators from 7.20.2 to 7.20.7 (#15053)
* Bump @babel/plugin-proposal-decorators from 7.20.2 to 7.20.7

Bumps [@babel/plugin-proposal-decorators](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-proposal-decorators) from 7.20.2 to 7.20.7.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.20.7/packages/babel-plugin-proposal-decorators)

---
updated-dependencies:
- dependency-name: "@babel/plugin-proposal-decorators"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Deduplicate dependencies

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
2023-01-16 06:05:38 +00:00
Paul Bottein
1d20d6979e Improve voice dialog (#15084)
* Improve voice dialog

* Improve scrolling and dialog size

* Align messages to bottom for better keyboard support

* Add send button

* Simplify label
2023-01-13 16:20:29 -05:00
dependabot[bot]
207380d0da Bump @octokit/rest from 19.0.4 to 19.0.5 (#15100) 2023-01-13 06:50:47 -05:00
dependabot[bot]
d2c091536e Bump rollup-plugin-visualizer from 4.0.4 to 5.9.0 (#14983)
* Bump rollup-plugin-visualizer from 4.0.4 to 5.9.0

Bumps [rollup-plugin-visualizer](https://github.com/btd/rollup-plugin-visualizer) from 4.0.4 to 5.9.0.
- [Release notes](https://github.com/btd/rollup-plugin-visualizer/releases)
- [Changelog](https://github.com/btd/rollup-plugin-visualizer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/btd/rollup-plugin-visualizer/commits/v5.9.0)

---
updated-dependencies:
- dependency-name: rollup-plugin-visualizer
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Deduplicate dependenciesWIP: 663b6e068 Bump @formatjs/intl-locale from 2.4.40 to 3.0.11 (#15077)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
2023-01-12 22:21:47 +00:00
Paul Bottein
2eb5335a68 Uses websocket to get sensor device class units (#15014)
* Uses websocket to get sensor device class units

* Only show convertible units

* Update endpoint
2023-01-12 09:49:11 -05:00
Paul Bottein
1aa23d75b0 Use backend translations for energy validation (#15069) 2023-01-12 13:01:43 +01:00
dependabot[bot]
663b6e0682 Bump @formatjs/intl-locale from 2.4.40 to 3.0.11 (#15077)
Bumps [@formatjs/intl-locale](https://github.com/formatjs/formatjs) from 2.4.40 to 3.0.11.
- [Release notes](https://github.com/formatjs/formatjs/releases)
- [Commits](https://github.com/formatjs/formatjs/compare/@formatjs/intl-locale@2.4.40...@formatjs/intl-locale@3.0.11)

---
updated-dependencies:
- dependency-name: "@formatjs/intl-locale"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-11 10:57:43 -05:00
Paul Bottein
c7f3293c1d Add close button to fullscreen conversation dialog (on mobile) (#15058)
* Add close button to fullscreen conversation dialog (on mobile)

* Remove hardcoded heading
2023-01-11 14:18:55 +01:00
Paul Bottein
c63b64cff5 Reduce label length for regex pattern input text helper (#15016)
* Reduce label length for regex pattern input text helper

* Rename key
2023-01-11 09:54:11 +01:00
Paul Bottein
7136142437 Add state color for schedule and plant domains (#15020)
* Add state color for schedule domain

* Add state color for plant domain
2023-01-11 09:53:36 +01:00
Paul Bottein
af9a8fa3e7 Fixes humidifier off icon (#15021) 2023-01-11 09:53:20 +01:00
dependabot[bot]
b74a2fd277 Bump lint-staged from 13.0.3 to 13.1.0 (#15079)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 13.0.3 to 13.1.0.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v13.0.3...v13.1.0)

---
updated-dependencies:
- dependency-name: lint-staged
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-11 06:37:00 +00:00
dependabot[bot]
e5350a4246 Bump regenerator-runtime from 0.13.8 to 0.13.11 (#15013)
* Bump regenerator-runtime from 0.13.8 to 0.13.11

Bumps [regenerator-runtime](https://github.com/facebook/regenerator) from 0.13.8 to 0.13.11.
- [Release notes](https://github.com/facebook/regenerator/releases)
- [Commits](https://github.com/facebook/regenerator/compare/regenerator-runtime@0.13.8...regenerator-runtime@0.13.11)

---
updated-dependencies:
- dependency-name: regenerator-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Deduplicate dependencies

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
2023-01-11 06:32:40 +00:00
dependabot[bot]
9e5a59fbc4 Bump @thomasloven/round-slider from 0.5.4 to 0.6.0 (#15051)
Bumps [@thomasloven/round-slider](https://github.com/thomasloven/round-slider) from 0.5.4 to 0.6.0.
- [Release notes](https://github.com/thomasloven/round-slider/releases)
- [Commits](https://github.com/thomasloven/round-slider/commits)

---
updated-dependencies:
- dependency-name: "@thomasloven/round-slider"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-10 18:04:47 -05:00
Paul Bottein
24e6b8483e 20230110.0 (#15070) 2023-01-10 19:24:17 +01:00
Paul Bottein
604c452ff4 Bumped version to 20230110.0 2023-01-10 19:04:27 +01:00
Paul Bottein
ba9551b61e Fixes weekday calendar chips toggle (#14990) 2023-01-10 18:33:29 +01:00
Paul Bottein
135af5bcaa Remove aliases configuration from alexa cloud page (#15003) 2023-01-10 18:33:16 +01:00
Allen Porter
747f47524e Fix UNTIL values to be inclusive of last event and bug in populating recurrence rules when editing calendar events (#15024)
* Fix bug in populating recurrence rules when editing calendar events

* Set UNTIL value to be inclusive of the last instance

* Fix lint errors
2023-01-10 18:32:18 +01:00
Paul Bottein
36b959dbc4 Fixes multiple domains target selector in blueprint (#15054)
* Fixes multiple domains target selector in blueprint

* Fixes lint
2023-01-10 18:31:22 +01:00
Paul Bottein
1d15f81b6c Fixes moon badge icon (#15015) 2023-01-10 18:30:21 +01:00
Paul Bottein
45e7f8ae06 Fixes multiple domains target selector in blueprint (#15054)
* Fixes multiple domains target selector in blueprint

* Fixes lint
2023-01-10 18:28:34 +01:00
Paul Bottein
dcedafaef4 Fixes moon badge icon (#15015) 2023-01-10 18:28:07 +01:00
Allen Porter
8fac5f6d75 Fix UNTIL values to be inclusive of last event and bug in populating recurrence rules when editing calendar events (#15024)
* Fix bug in populating recurrence rules when editing calendar events

* Set UNTIL value to be inclusive of the last instance

* Fix lint errors
2023-01-09 12:28:31 +01:00
dependabot[bot]
5094e8f428 Bump typescript from 4.9.3 to 4.9.4 (#15052)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.9.3 to 4.9.4.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.9.3...v4.9.4)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 12:18:45 +01:00
dependabot[bot]
74fb8b0427 Bump actions/setup-node from 3.5.1 to 3.6.0 (#15049)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 11:33:34 +01:00
dependabot[bot]
78768b1e2f Bump actions/checkout from 3.2.0 to 3.3.0 (#15050)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 10:39:28 +01:00
dependabot[bot]
d55307098a Bump @vue/web-component-wrapper from 1.2.0 to 1.3.0 (#14782)
* Bump @vue/web-component-wrapper from 1.2.0 to 1.3.0

Bumps [@vue/web-component-wrapper](https://github.com/vuejs/web-component-wrapper) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/vuejs/web-component-wrapper/releases)
- [Commits](https://github.com/vuejs/web-component-wrapper/commits)

---
updated-dependencies:
- dependency-name: "@vue/web-component-wrapper"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Correct wrap type and remove unnecessary TS ignores

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
2023-01-09 06:45:49 +00:00
dependabot[bot]
7286aa7dc4 bump open from 7.3.0 to 8.4.0 (#14776)
* dev(deps-dev): bump open from 7.3.0 to 8.4.0

Bumps [open](https://github.com/sindresorhus/open) from 7.3.0 to 8.4.0.
- [Release notes](https://github.com/sindresorhus/open/releases)
- [Commits](https://github.com/sindresorhus/open/compare/v7.3.0...v8.4.0)

---
updated-dependencies:
- dependency-name: open
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Deduplicate dependencies

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
2023-01-08 06:05:16 +00:00
dependabot[bot]
b44b22c723 Bump fs-extra from 7.0.1 to 11.1.0 (#15012)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-06 12:29:40 +01:00
Paul Bottein
dcee89caeb Display aliases in cloud page (#14989)
* Display aliases in cloud page

* Fixes ellipsis

* Improve sort

* Separate alias list and button

* Remove alexa changes

* Apply suggestions
2023-01-06 12:27:36 +01:00
Paul Bottein
d1caeed05e Remove aliases configuration from alexa cloud page (#15003) 2023-01-06 12:15:45 +01:00
Franck Nijhof
f2a67a5fa9 Add calendar domain to sensors (#15002) 2023-01-06 09:43:57 +01:00
Paul Bottein
b2d5304488 Fixes weekday calendar chips toggle (#14990) 2023-01-06 08:04:45 +01:00
Philip Allgaier
e9aded77da Bump mdi/js and mdi/svg to 7.1.96 (#15006) 2023-01-05 17:25:55 -05:00
dependabot[bot]
e1a94c679f bump workbox from 6.4.2 to 6.5.4 (#14775)
* prod(deps): bump workbox-cacheable-response from 6.4.2 to 6.5.4

Bumps [workbox-cacheable-response](https://github.com/googlechrome/workbox) from 6.4.2 to 6.5.4.
- [Release notes](https://github.com/googlechrome/workbox/releases)
- [Commits](https://github.com/googlechrome/workbox/compare/v6.4.2...v6.5.4)

---
updated-dependencies:
- dependency-name: workbox-cacheable-response
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump the rest of the workbox packages

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
2023-01-05 22:22:41 +00:00
Steve Repsher
616bced37c Bump @codemirror packages to version 6.x (#14969) 2023-01-04 17:19:00 -05:00
dependabot[bot]
1585c6bf52 Bump json5 from 1.0.1 to 1.0.2 (#14986)
Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-04 14:55:09 -05:00
Bram Kragten
caa852559f 20230104.0 (#14985) 2023-01-04 11:43:34 +01:00
Bram Kragten
f2fa433326 Bumped version to 20230104.0 2023-01-04 11:35:18 +01:00
Jan Bouwhuis
dd109b0054 Fix lokalization of MQTT config entry panel re-configure button and title (#14915) 2023-01-04 11:30:15 +01:00
puddly
9750e0e0b5 Ensure Lovelace deviceEntries lookup handles missing keys (#14980)
fixes undefined
2023-01-04 11:29:47 +01:00
Philip Allgaier
b36eba0916 Ensure calender event description can be edited (#14979) 2023-01-04 10:44:39 +01:00
Paul Bottein
18a69d633f Add padding to device action form (#14976) 2023-01-03 14:02:16 +00:00
Paul Bottein
bf6ad3d0a5 Replace ZMK by ZMW currency (#14975) 2023-01-03 14:02:10 +00:00
Paul Bottein
9836912efa Display zone name in state badge (#14974) 2023-01-03 14:58:30 +01:00
Felipe Santos
f31a7c3af0 Fix issue with reload not working sometimes (#14939)
fixes undefined
2023-01-03 11:09:18 +01:00
Bram Kragten
ebb19e4ed5 20230102.0 (#14963) 2023-01-02 21:42:03 +01:00
Bram Kragten
44d91eaa4f Bumped version to 20230102.0 2023-01-02 21:28:30 +01:00
Allen Porter
3cc1cb7893 Rollback calendar trigger day offset support (#14933) 2023-01-02 21:27:50 +01:00
Paul Bottein
e7354ed5a2 Do not close aliases dialog on enter (#14952)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2023-01-02 21:27:30 +01:00
Allen Porter
e3ac2c149d Use translations for all fields in recurrence rule editor (#14940)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2023-01-02 20:19:36 +00:00
epenet
afcd45a780 Enable unit conversion for DATA_SIZE (#14903)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2023-01-02 20:17:14 +00:00
Bram Kragten
fe87466351 Add link to aliases in cloud config entity settings (#14959) 2023-01-02 20:42:31 +01:00
epenet
bdef924426 Enable unit conversion for DATA_RATE (#14902)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2023-01-02 17:50:12 +00:00
Paul Bottein
86ea3082f7 Add aliases editor for helpers (#14951) 2023-01-02 12:10:52 +01:00
930913
0374330676 Add helper text to select slider (#14884)
* Add helper text to select slider

* Make helper text conditional

Only show if set.

Co-authored-by: Bram Kragten <mail@bramkragten.nl>

* Lint changes

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2022-12-31 15:38:21 -05:00
Bram Kragten
7cde3b66dd 20221230.0 (#14925) 2022-12-30 13:39:58 +01:00
Bram Kragten
d8a68326fb Bumped version to 20221230.0 2022-12-30 13:21:47 +01:00
Allen Porter
4901d50918 Fix All Day recurring events that end on a specific date (#14905) 2022-12-30 13:15:07 +01:00
SukramJ
a16e41a7ac Add support for unit conversion of electric current (#14916) 2022-12-30 13:06:11 +01:00
Jan Bouwhuis
f1d644ac51 Add mV as unit for sensor device_class voltage (#14921) 2022-12-30 13:05:44 +01:00
karwosts
a9378abe31 Fix days missing from ha-base-time-input _valueChanged (#14910)
* Fix days missing from ha-base-time-input _valueChanged

* style change
2022-12-29 00:06:48 -05:00
Gia Ferrari
5c2fcd7f9b Add alt attribute to various images (#14405)
* ha-config-area-page: Add alt tag for area-picture

* dialog-tag-detail: Add alt tag for generated QR code image.

* ha-config-hardware: Blank alt tag for hardware pic, info already elsewhere

* dialog-energy-solar-settings: Blank alt tag for brand icon.

* ha-energy-grid-settings: Blank alt tag for co2signal brand icon.

* Add a few more appropriately-blank alt texts.

* ha-config-device-page: Logo alt text set to name of device domain.

* ha-config-repairs: Logo alt text set to name of issue domain.

* hui-picture-card(-editor): Alternate Text via config (blank default)

* hui-picture-entity-card(-editor): Alternate Text via config (blank default)

* ha-long-lived-access-token-dialog: Alt text for QR code.

* hui-picture-header-footer: Support alt text via optional property.

* A few more blank alt attributes.

* ha-tile-image: Support alt tag (but it is blank in current usage).

* prod cla-bot

* Lint. Fix whitespace.

* Add missing alt text properties to TS types.

* Fix my silly typo in picture-entity-card-editor's SCHEMA (+ minor reformat)

* Add alt_text to Picture(Entity)CardConfig TypeScript types.

* Format with prettier.

* Revise alt text for tag QR

* Revise alt text for token QR

* Revise alternate to alternative

* Add alt to logo in gallery

* Add alt text to crop image

* Use ifDefined for tile image alt

* Change area picture alt to area name

* Remove entry from entities config struct

* Revert altText changes for Picture Entity Card (to revisit in future PR)

See:
https://github.com/home-assistant/frontend/pull/14405#discussion_r1032735871

* Revert changes to hui-image and picture entity editor

Co-authored-by: Steve Repsher <steverep@users.noreply.github.com>
2022-12-29 01:16:05 +00:00
241 changed files with 6651 additions and 5001 deletions

View File

@@ -1,13 +1,20 @@
{
"name": "Home Assistant Frontend",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"image": "mcr.microsoft.com/devcontainers/python:0-3.10",
"appPort": "8124:8123",
"postCreateCommand": "script/bootstrap",
"containerEnv": {
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}"
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}",
"DEVCONTAINER": "true"
},
"remoteUser": "vscode",
"remoteEnv": {
"PATH": "${containerEnv:PATH}:${containerWorkspaceFolder}/node_modules/.bin:/home/vscode/.local/bin"
},
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "16"
}
},
"customizations": {
"vscode": {

View File

@@ -1,13 +0,0 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.148.1/containers/python-3/.devcontainer/base.Dockerfile
FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.9
ENV \
DEBIAN_FRONTEND=noninteractive \
DEVCONTAINER=true \
PATH=$PATH:./node_modules/.bin
# Install nvm
COPY .nvmrc /tmp/.nvmrc
RUN \
su vscode -c \
"source /usr/local/share/nvm/nvm.sh && nvm install $(cat /tmp/.nvmrc) 2>&1"

View File

@@ -12,3 +12,7 @@ updates:
interval: "daily"
time: "06:00"
open-pull-requests-limit: 5
ignore:
# Ignore rollup and plugins until everything else is updated
- dependency-name: "*rollup*"
- dependency-name: "@rollup/*"

View File

@@ -22,12 +22,12 @@ jobs:
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
steps:
- name: Check out files from GitHub
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
with:
ref: dev
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.6.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
@@ -60,12 +60,12 @@ jobs:
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
steps:
- name: Check out files from GitHub
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
with:
ref: master
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.6.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn

View File

@@ -20,9 +20,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out files from GitHub
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.6.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
@@ -44,9 +44,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out files from GitHub
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.6.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
@@ -63,9 +63,9 @@ jobs:
needs: [lint, test]
steps:
- name: Check out files from GitHub
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.6.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
@@ -82,9 +82,9 @@ jobs:
needs: [lint, test]
steps:
- name: Check out files from GitHub
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.6.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn

View File

@@ -23,7 +23,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.

View File

@@ -23,12 +23,12 @@ jobs:
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
steps:
- name: Check out files from GitHub
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
with:
ref: dev
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.6.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
@@ -61,12 +61,12 @@ jobs:
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
steps:
- name: Check out files from GitHub
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
with:
ref: master
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.6.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn

View File

@@ -17,10 +17,10 @@ jobs:
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
steps:
- name: Check out files from GitHub
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.6.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn

View File

@@ -22,10 +22,10 @@ jobs:
if: github.repository == 'home-assistant/frontend' && contains(github.event.pull_request.labels.*.name, 'needs design preview')
steps:
- name: Check out files from GitHub
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.6.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn

View File

@@ -21,7 +21,7 @@ jobs:
contents: write
steps:
- name: Checkout the repository
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
@@ -29,7 +29,7 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.6.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn

View File

@@ -24,7 +24,7 @@ jobs:
contents: write # Required to upload release assets
steps:
- name: Checkout the repository
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
- name: Verify version
uses: home-assistant/actions/helpers/verify-version@master
@@ -35,7 +35,7 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.6.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn

View File

@@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
- name: Upload Translations
run: |

4
.gitignore vendored
View File

@@ -8,7 +8,7 @@ dist/
/translations/
# yarn
.yarn/**
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
@@ -31,7 +31,7 @@ pip-selfcheck.json
.venv
# vscode
.vscode/**
.vscode/*
!.vscode/extensions.json
!.vscode/launch.json
!.vscode/tasks.json

View File

@@ -1,29 +0,0 @@
diff --git a/polyfillLoaders/EventTarget.js b/polyfillLoaders/EventTarget.js
index 4e18ade7ba485849f17f28c94c42f0e0e01ac387..8f34f4f646c7f7becc208fb5a546c96034fc74dc 100644
--- a/polyfillLoaders/EventTarget.js
+++ b/polyfillLoaders/EventTarget.js
@@ -6,16 +6,15 @@
let _ET;
let ET;
export default async function EventTarget() {
- return ET || init();
+ return ET || init();
}
async function init() {
- _ET = window.EventTarget;
- try {
- new _ET();
- }
- catch (_a) {
- _ET = (await import('event-target-shim')).EventTarget;
- }
- return (ET = _ET);
+ _ET = window.EventTarget;
+ try {
+ new _ET();
+ } catch (_a) {
+ _ET = (await import("event-target-shim")).default.EventTarget;
+ }
+ return (ET = _ET);
}
//# sourceMappingURL=EventTarget.js.map

View File

@@ -1,12 +0,0 @@
diff --git a/mwc-icon-button-base.js b/mwc-icon-button-base.js
index 45cdaab93ccc0a6daaaaabc01266dcdc32e46bfd..b3ea5b541597308d85f86ce6c23fd00785fda835 100644
--- a/mwc-icon-button-base.js
+++ b/mwc-icon-button-base.js
@@ -63,7 +63,6 @@ export class IconButtonBase extends LitElement {
@touchend="${this.handleRippleDeactivate}"
@touchcancel="${this.handleRippleDeactivate}"
>${this.renderRipple()}
- <i class="material-icons">${this.icon}</i>
<span
><slot></slot
></span>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

823
.yarn/releases/yarn-3.3.1.cjs vendored Executable file

File diff suppressed because one or more lines are too long

View File

@@ -6,4 +6,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
yarnPath: .yarn/releases/yarn-3.2.3.cjs
yarnPath: .yarn/releases/yarn-3.3.1.cjs

View File

@@ -1,36 +1,40 @@
const del = require("del");
const del = import("del");
const gulp = require("gulp");
const paths = require("../paths");
require("./translations");
gulp.task(
"clean",
gulp.parallel("clean-translations", () =>
del([paths.app_output_root, paths.build_dir])
gulp.parallel("clean-translations", async () =>
(await del).deleteSync([paths.app_output_root, paths.build_dir])
)
);
gulp.task(
"clean-demo",
gulp.parallel("clean-translations", () =>
del([paths.demo_output_root, paths.build_dir])
gulp.parallel("clean-translations", async () =>
(await del).deleteSync([paths.demo_output_root, paths.build_dir])
)
);
gulp.task(
"clean-cast",
gulp.parallel("clean-translations", () =>
del([paths.cast_output_root, paths.build_dir])
gulp.parallel("clean-translations", async () =>
(await del).deleteSync([paths.cast_output_root, paths.build_dir])
)
);
gulp.task("clean-hassio", () =>
del([paths.hassio_output_root, paths.build_dir])
gulp.task("clean-hassio", async () =>
(await del).deleteSync([paths.hassio_output_root, paths.build_dir])
);
gulp.task(
"clean-gallery",
gulp.parallel("clean-translations", () =>
del([paths.gallery_output_root, paths.gallery_build, paths.build_dir])
gulp.parallel("clean-translations", async () =>
(await del).deleteSync([
paths.gallery_output_root,
paths.gallery_build,
paths.build_dir,
])
)
);

View File

@@ -1,9 +1,9 @@
// Task to download the latest Lokalise translations from the nightly workflow artifacts
const del = import("del");
const fs = require("fs/promises");
const path = require("path");
const process = require("process");
const del = require("del");
const gulp = require("gulp");
const jszip = require("jszip");
const tar = require("tar");
@@ -17,8 +17,8 @@ const WORKFLOW_NAME = "nightly.yaml";
const ARTIFACT_NAME = "translations";
const CLIENT_ID = "Iv1.3914e28cb27834d1";
const EXTRACT_DIR = "translations";
const TOKEN_FILE = path.join(EXTRACT_DIR, "token.json");
const ARTIFACT_FILE = path.join(EXTRACT_DIR, "artifact.json");
const TOKEN_FILE = path.posix.join(EXTRACT_DIR, "token.json");
const ARTIFACT_FILE = path.posix.join(EXTRACT_DIR, "artifact.json");
let allowTokenSetup = false;
gulp.task("allow-setup-fetch-nightly-translations", (done) => {
@@ -137,7 +137,11 @@ gulp.task("fetch-nightly-translations", async function () {
// Remove the current translations
const deleteCurrent = Promise.all(writings).then(
del([`${EXTRACT_DIR}/*`, `!${ARTIFACT_FILE}`, `!${TOKEN_FILE}`])
(await del).deleteAsync([
`${EXTRACT_DIR}/*`,
`!${ARTIFACT_FILE}`,
`!${TOKEN_FILE}`,
])
);
// Get the download URL and follow the redirect to download (stored as ArrayBuffer)

View File

@@ -1,4 +1,4 @@
const del = require("del");
const del = import("del");
const path = require("path");
const gulp = require("gulp");
const fs = require("fs");
@@ -6,7 +6,7 @@ const paths = require("../paths");
const outDir = "build/locale-data";
gulp.task("clean-locale-data", () => del([outDir]));
gulp.task("clean-locale-data", async () => (await del).deleteSync([outDir]));
gulp.task("ensure-locale-data-build-dir", (done) => {
if (!fs.existsSync(outDir)) {

View File

@@ -1,5 +1,5 @@
const del = import("del");
const crypto = require("crypto");
const del = require("del");
const path = require("path");
const source = require("vinyl-source-stream");
const vinylBuffer = require("vinyl-buffer");
@@ -13,7 +13,7 @@ const { mapFiles } = require("../util");
const env = require("../env");
const paths = require("../paths");
require("./fetch-nightly_translations");
require("./fetch-nightly-translations");
const inFrontendDir = "translations/frontend";
const inBackendDir = "translations/backend";
@@ -120,7 +120,7 @@ function lokaliseTransform(data, original, file) {
return output;
}
gulp.task("clean-translations", () => del([workDir]));
gulp.task("clean-translations", async () => (await del).deleteSync([workDir]));
gulp.task("ensure-translations-build-dir", (done) => {
if (!fs.existsSync(workDir)) {

View File

@@ -22,7 +22,11 @@ class HcLayout extends LitElement {
return html`
<ha-card>
<div class="layout">
<img class="hero" src="/images/google-nest-hub.png" />
<img
class="hero"
alt="A Google Nest Hub with a Home Assistant dashboard on its screen"
src="/images/google-nest-hub.png"
/>
<h1 class="card-header">
Home Assistant Cast${this.subtitle ? ` ${this.subtitle}` : ""}
${this.auth

View File

@@ -12,6 +12,7 @@ class HcLaunchScreen extends LitElement {
return html`
<div class="container">
<img
alt="Home Assistant logo on left, Nabu Casa logo on right, and red heart in center"
src="https://www.home-assistant.io/images/blog/2018-09-thinking-big/social.png"
/>
<div class="status">

View File

@@ -71,7 +71,6 @@ class HaDemo extends HomeAssistantAppEl {
entity_category: null,
has_entity_name: false,
unique_id: "co2_intensity",
aliases: [],
},
{
config_entry_id: "co2signal",
@@ -87,7 +86,6 @@ class HaDemo extends HomeAssistantAppEl {
entity_category: null,
has_entity_name: false,
unique_id: "grid_fossil_fuel_percentage",
aliases: [],
},
]);

View File

@@ -98,7 +98,9 @@ const alerts: {
description: "Alert with slotted image",
type: "warning",
iconSlot: html`<span slot="icon" class="image"
><img src="https://www.home-assistant.io/images/home-assistant-logo.svg"
><img
alt="Home Assistant logo"
src="https://www.home-assistant.io/images/home-assistant-logo.svg"
/></span>`,
},
{

View File

@@ -115,8 +115,8 @@ export class DemoHaBarSwitch extends LitElement {
font-weight: 600;
}
.custom {
--switch-bar-on-color: rgb(var(--rgb-green-color));
--switch-bar-off-color: rgb(var(--rgb-red-color));
--switch-bar-on-color: var(--green-color);
--switch-bar-off-color: var(--red-color);
--switch-bar-thickness: 100px;
--switch-bar-border-radius: 24px;
--switch-bar-padding: 6px;

View File

@@ -99,16 +99,19 @@ const AREAS = [
area_id: "backyard",
name: "Backyard",
picture: null,
aliases: [],
},
{
area_id: "bedroom",
name: "Bedroom",
picture: null,
aliases: [],
},
{
area_id: "livingroom",
name: "Livingroom",
picture: null,
aliases: [],
},
];

View File

@@ -95,16 +95,19 @@ const AREAS = [
area_id: "backyard",
name: "Backyard",
picture: null,
aliases: [],
},
{
area_id: "bedroom",
name: "Bedroom",
picture: null,
aliases: [],
},
{
area_id: "livingroom",
name: "Livingroom",
picture: null,
aliases: [],
},
];

View File

@@ -104,16 +104,17 @@ const ENTITIES: HassEntity[] = [
createEntity("alarm_control_panel.disarming", "disarming"),
createEntity("alarm_control_panel.triggered", "triggered"),
// Alert
createEntity("alert.idle", "idle"),
createEntity("alert.off", "off"),
createEntity("alert.on", "on"),
createEntity("alert.idle", "idle"),
// Automation
createEntity("automation.off", "off"),
createEntity("automation.on", "on"),
// Binary Sensor
...BINARY_SENSOR_DEVICE_CLASSES.map((dc) =>
createEntity(`binary_sensor.${dc}`, "on", dc)
),
...BINARY_SENSOR_DEVICE_CLASSES.map((dc) => [
createEntity(`binary_sensor.${dc}`, "off", dc),
createEntity(`binary_sensor.${dc}`, "on", dc),
]).reduce((arr, item) => [...arr, ...item], []),
// Button
createEntity("button.restart", "unknown", "restart"),
createEntity("button.update", "unknown", "update"),
@@ -142,6 +143,9 @@ const ENTITIES: HassEntity[] = [
createEntity("climate.auto_dry", "auto", undefined, {
hvac_action: "drying",
}),
createEntity("climate.auto_fan", "auto", undefined, {
hvac_action: "fan",
}),
// Cover
createEntity("cover.closing", "closing"),
createEntity("cover.closed", "closed"),
@@ -180,8 +184,8 @@ const ENTITIES: HassEntity[] = [
createEntity("light.off", "off"),
createEntity("light.on", "on"),
// Locks
createEntity("lock.unlocked", "unlocked"),
createEntity("lock.locked", "locked"),
createEntity("lock.unlocked", "unlocked"),
createEntity("lock.locking", "locking"),
createEntity("lock.unlocking", "unlocking"),
createEntity("lock.jammed", "jammed"),
@@ -205,17 +209,24 @@ const ENTITIES: HassEntity[] = [
createEntity("media_player.speaker_playing", "playing", "speaker"),
createEntity("media_player.speaker_paused", "paused", "speaker"),
createEntity("media_player.speaker_standby", "standby", "speaker"),
// Plant
createEntity("plant.ok", "ok"),
createEntity("plant.problem", "problem"),
// Remote
createEntity("remote.off", "off"),
createEntity("remote.on", "on"),
// Schedule
createEntity("schedule.off", "off"),
createEntity("schedule.on", "on"),
// Script
createEntity("script.off", "off"),
createEntity("script.on", "on"),
// Sensor
...SENSOR_DEVICE_CLASSES.map((dc) => createEntity(`sensor.${dc}`, "10", dc)),
// Battery sensor
...[0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100].map((value) =>
createEntity(`sensor.battery_${value}`, value.toString(), "battery")
...[0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, "unknown", "not_valid"].map(
(value) =>
createEntity(`sensor.battery_${value}`, value.toString(), "battery")
),
// Siren
createEntity("siren.off", "off"),

View File

@@ -197,7 +197,6 @@ const createEntityRegistryEntries = (
platform: "updater",
has_entity_name: false,
unique_id: "updater",
aliases: [],
},
];

View File

@@ -404,6 +404,7 @@ class HassioAddonInfo extends LitElement {
? html`
<img
class="logo"
alt=""
src="/api/hassio/addons/${this.addon.slug}/logo"
/>
`

View File

@@ -15,7 +15,7 @@ class SupervisorFormfieldLabel extends LitElement {
protected render(): TemplateResult {
return html`
${this.imageUrl
? html`<img loading="lazy" .src=${this.imageUrl} class="icon" />`
? html`<img loading="lazy" alt="" src=${this.imageUrl} class="icon" />`
: this.iconPath
? html`<ha-svg-icon .path=${this.iconPath} class="icon"></ha-svg-icon>`
: ""}

View File

@@ -60,8 +60,8 @@ class HassioIngressView extends LitElement {
}
const iframe = html`<iframe
.title=${this._addon.name}
.src=${this._addon.ingress_url!}
title=${this._addon.name}
src=${this._addon.ingress_url!}
>
</iframe>`;

View File

@@ -25,21 +25,16 @@
"license": "Apache-2.0",
"dependencies": {
"@braintree/sanitize-url": "^6.0.0",
"@codemirror/autocomplete": "^0.19.12",
"@codemirror/commands": "^0.19.8",
"@codemirror/gutter": "^0.19.9",
"@codemirror/highlight": "^0.19.7",
"@codemirror/history": "^0.19.2",
"@codemirror/legacy-modes": "^0.19.0",
"@codemirror/rectangular-selection": "^0.19.1",
"@codemirror/search": "^0.19.6",
"@codemirror/state": "^0.19.6",
"@codemirror/stream-parser": "^0.19.5",
"@codemirror/text": "^0.19.6",
"@codemirror/view": "^0.19.40",
"@codemirror/autocomplete": "^6.4.0",
"@codemirror/commands": "^6.1.3",
"@codemirror/language": "^6.4.0",
"@codemirror/legacy-modes": "^6.3.1",
"@codemirror/search": "^6.2.3",
"@codemirror/state": "^6.2.0",
"@codemirror/view": "^6.7.1",
"@formatjs/intl-datetimeformat": "^4.2.5",
"@formatjs/intl-getcanonicallocales": "^1.8.0",
"@formatjs/intl-locale": "^2.4.40",
"@formatjs/intl-getcanonicallocales": "^2.0.5",
"@formatjs/intl-locale": "^3.0.11",
"@formatjs/intl-numberformat": "^7.2.5",
"@formatjs/intl-pluralrules": "^4.1.5",
"@formatjs/intl-relativetimeformat": "^9.3.2",
@@ -49,34 +44,35 @@
"@fullcalendar/interaction": "5.9.0",
"@fullcalendar/list": "5.9.0",
"@fullcalendar/timegrid": "5.9.0",
"@lit-labs/motion": "^1.0.2",
"@lit-labs/virtualizer": "patch:@lit-labs/virtualizer@0.7.0-pre.2#./.yarn/patches/@lit-labs/virtualizer/event-target-shim.patch",
"@material/chips": "14.0.0-canary.261f2db59.0",
"@material/data-table": "14.0.0-canary.261f2db59.0",
"@material/mwc-button": "0.25.3",
"@material/mwc-checkbox": "0.25.3",
"@material/mwc-circular-progress": "0.25.3",
"@material/mwc-dialog": "0.25.3",
"@material/mwc-drawer": "^0.25.3",
"@material/mwc-fab": "0.25.3",
"@material/mwc-formfield": "0.25.3",
"@material/mwc-icon-button": "patch:@material/mwc-icon-button@0.25.3#./.yarn/patches/@material/mwc-icon-button/remove-icon.patch",
"@material/mwc-linear-progress": "0.25.3",
"@material/mwc-list": "^0.25.3",
"@material/mwc-menu": "0.25.3",
"@material/mwc-radio": "0.25.3",
"@material/mwc-ripple": "0.25.3",
"@material/mwc-select": "0.25.3",
"@material/mwc-slider": "0.25.3",
"@material/mwc-switch": "0.25.3",
"@material/mwc-tab": "0.25.3",
"@material/mwc-tab-bar": "0.25.3",
"@material/mwc-textarea": "^0.25.3",
"@material/mwc-textfield": "0.25.3",
"@material/mwc-top-app-bar-fixed": "^0.25.3",
"@material/top-app-bar": "14.0.0-canary.261f2db59.0",
"@mdi/js": "7.0.96",
"@mdi/svg": "7.0.96",
"@lezer/highlight": "^1.1.3",
"@lit-labs/motion": "^1.0.3",
"@lit-labs/virtualizer": "^1.0.1",
"@material/chips": "=14.0.0-canary.53b3cad2f.0",
"@material/data-table": "=14.0.0-canary.53b3cad2f.0",
"@material/mwc-button": "^0.27.0",
"@material/mwc-checkbox": "^0.27.0",
"@material/mwc-circular-progress": "^0.27.0",
"@material/mwc-dialog": "^0.27.0",
"@material/mwc-drawer": "^0.27.0",
"@material/mwc-fab": "^0.27.0",
"@material/mwc-formfield": "^0.27.0",
"@material/mwc-icon-button": "^0.27.0",
"@material/mwc-linear-progress": "^0.27.0",
"@material/mwc-list": "^0.27.0",
"@material/mwc-menu": "^0.27.0",
"@material/mwc-radio": "^0.27.0",
"@material/mwc-ripple": "^0.27.0",
"@material/mwc-select": "^0.27.0",
"@material/mwc-slider": "^0.27.0",
"@material/mwc-switch": "^0.27.0",
"@material/mwc-tab": "^0.27.0",
"@material/mwc-tab-bar": "^0.27.0",
"@material/mwc-textarea": "^0.27.0",
"@material/mwc-textfield": "^0.27.0",
"@material/mwc-top-app-bar-fixed": "^0.27.0",
"@material/top-app-bar": "=14.0.0-canary.53b3cad2f.0",
"@mdi/js": "7.1.96",
"@mdi/svg": "7.1.96",
"@polymer/app-layout": "^3.1.0",
"@polymer/iron-flex-layout": "^3.0.1",
"@polymer/iron-icon": "^3.0.1",
@@ -91,48 +87,48 @@
"@polymer/paper-toast": "^3.0.1",
"@polymer/paper-tooltip": "^3.0.1",
"@polymer/polymer": "3.4.1",
"@thomasloven/round-slider": "0.5.4",
"@vaadin/combo-box": "^23.2.9",
"@vaadin/vaadin-themable-mixin": "^23.2.9",
"@thomasloven/round-slider": "0.6.0",
"@vaadin/combo-box": "^23.3.5",
"@vaadin/vaadin-themable-mixin": "^23.3.5",
"@vibrant/color": "^3.2.1-alpha.1",
"@vibrant/core": "^3.2.1-alpha.1",
"@vibrant/quantizer-mmcq": "^3.2.1-alpha.1",
"@vue/web-component-wrapper": "^1.2.0",
"@vue/web-component-wrapper": "^1.3.0",
"@webcomponents/scoped-custom-element-registry": "^0.0.5",
"@webcomponents/webcomponentsjs": "^2.2.10",
"app-datepicker": "^5.1.0",
"chart.js": "^3.3.2",
"comlink": "^4.3.1",
"core-js": "^3.15.2",
"cropperjs": "^1.5.12",
"date-fns": "^2.23.0",
"cropperjs": "^1.5.13",
"date-fns": "^2.29.3",
"date-fns-tz": "^1.3.7",
"deep-clone-simple": "^1.1.1",
"deep-freeze": "^0.0.1",
"fuse.js": "^6.0.0",
"fuse.js": "^6.6.2",
"google-timezones-json": "^1.0.2",
"hammerjs": "^2.0.8",
"hls.js": "^1.2.5",
"hls.js": "^1.3.1",
"home-assistant-js-websocket": "^8.0.1",
"idb-keyval": "^5.1.3",
"intl-messageformat": "^9.9.1",
"intl-messageformat": "^10.2.5",
"js-yaml": "^4.1.0",
"leaflet": "^1.7.1",
"leaflet-draw": "^1.0.4",
"lit": "^2.1.2",
"lit": "^2.6.1",
"marked": "^4.0.12",
"memoize-one": "^5.2.1",
"memoize-one": "^6.0.0",
"node-vibrant": "3.2.1-alpha.1",
"proxy-polyfill": "^0.3.2",
"punycode": "^2.1.1",
"punycode": "^2.3.0",
"qr-scanner": "^1.3.0",
"qrcode": "^1.4.4",
"regenerator-runtime": "^0.13.8",
"qrcode": "^1.5.1",
"regenerator-runtime": "^0.13.11",
"resize-observer-polyfill": "^1.5.1",
"roboto-fontface": "^0.10.0",
"rrule": "^2.7.1",
"sortablejs": "^1.14.0",
"superstruct": "^0.15.2",
"superstruct": "^1.0.3",
"tinykeys": "^1.1.3",
"tsparticles": "^1.34.0",
"unfetch": "^4.1.0",
@@ -141,19 +137,19 @@
"vue": "^2.6.12",
"vue2-daterange-picker": "^0.5.1",
"weekstart": "^1.1.0",
"workbox-cacheable-response": "^6.4.2",
"workbox-core": "^6.4.2",
"workbox-expiration": "^6.4.2",
"workbox-precaching": "^6.4.2",
"workbox-routing": "^6.4.2",
"workbox-strategies": "^6.4.2",
"xss": "^1.0.9"
"workbox-cacheable-response": "^6.5.4",
"workbox-core": "^6.5.4",
"workbox-expiration": "^6.5.4",
"workbox-precaching": "^6.5.4",
"workbox-routing": "^6.5.4",
"workbox-strategies": "^6.5.4",
"xss": "^1.0.14"
},
"devDependencies": {
"@babel/core": "^7.20.2",
"@babel/plugin-external-helpers": "^7.18.6",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.20.2",
"@babel/plugin-proposal-decorators": "^7.20.7",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.20.2",
"@babel/plugin-proposal-optional-chaining": "^7.18.9",
@@ -164,7 +160,7 @@
"@babel/preset-typescript": "^7.18.6",
"@koa/cors": "^3.1.0",
"@octokit/auth-oauth-device": "^4.0.2",
"@octokit/rest": "^19.0.4",
"@octokit/rest": "^19.0.7",
"@open-wc/dev-server-hmr": "^0.0.2",
"@rollup/plugin-babel": "^5.2.1",
"@rollup/plugin-commonjs": "^11.1.0",
@@ -173,93 +169,89 @@
"@rollup/plugin-replace": "^2.3.2",
"@types/chromecast-caf-receiver": "5.0.12",
"@types/chromecast-caf-sender": "^1.0.3",
"@types/glob": "^7",
"@types/glob": "^8",
"@types/hammerjs": "^2.0.41",
"@types/js-yaml": "^4",
"@types/leaflet": "^1",
"@types/leaflet-draw": "^1",
"@types/marked": "^4",
"@types/mocha": "^8",
"@types/qrcode": "^1.4.2",
"@types/qrcode": "^1.5.0",
"@types/sortablejs": "^1",
"@types/tar": "^6",
"@types/webspeechapi": "^0.0.29",
"@typescript-eslint/eslint-plugin": "^5.46.1",
"@typescript-eslint/parser": "^5.44.0",
"@typescript-eslint/parser": "^5.49.0",
"@web/dev-server": "^0.0.24",
"@web/dev-server-rollup": "^0.2.11",
"babel-loader": "^9.1.0",
"chai": "^4.3.4",
"del": "^4.0.0",
"del": "^7.0.0",
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-airbnb-typescript": "^14.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-prettier": "^8.6.0",
"eslint-import-resolver-webpack": "^0.13.1",
"eslint-plugin-disable": "^2.0.1",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-lit": "^1.6.1",
"eslint-plugin-unused-imports": "^1.1.5",
"eslint-plugin-wc": "^1.3.2",
"eslint-plugin-wc": "^1.4.0",
"fancy-log": "^2.0.0",
"fs-extra": "^7.0.1",
"glob": "^7.2.0",
"fs-extra": "^11.1.0",
"glob": "^8.1.0",
"gulp": "^4.0.2",
"gulp-flatmap": "^1.0.2",
"gulp-json-transform": "^0.4.6",
"gulp-merge-json": "^1.3.1",
"gulp-merge-json": "^2.1.2",
"gulp-rename": "^2.0.0",
"gulp-zopfli-green": "^3.0.1",
"html-minifier": "^4.0.0",
"husky": "^8.0.1",
"husky": "^8.0.3",
"instant-mocha": "^1.3.1",
"jszip": "^3.10.1",
"lint-staged": "^13.0.3",
"lint-staged": "^13.1.0",
"lit-analyzer": "^1.2.1",
"lodash.template": "^4.5.0",
"magic-string": "^0.25.7",
"map-stream": "^0.0.7",
"merge-stream": "^1.0.1",
"mocha": "^8.4.0",
"object-hash": "^2.0.3",
"open": "^7.0.4",
"object-hash": "^3.0.0",
"open": "^8.4.0",
"pinst": "^3.0.0",
"prettier": "^2.8.1",
"prettier": "^2.8.3",
"require-dir": "^1.2.0",
"rollup": "^2.8.2",
"rollup-plugin-string": "^3.0.0",
"rollup-plugin-terser": "^5.3.0",
"rollup-plugin-visualizer": "^4.0.4",
"rollup-plugin-visualizer": "^5.9.0",
"serve": "^11.3.2",
"sinon": "^11.0.0",
"sinon": "^15.0.1",
"source-map-url": "^0.4.0",
"systemjs": "^6.3.2",
"tar": "^6.1.11",
"terser-webpack-plugin": "^5.2.4",
"ts-lit-plugin": "^1.2.1",
"typescript": "^4.9.3",
"typescript": "^4.9.4",
"vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0",
"webpack": "^5.55.1",
"webpack-cli": "^4.8.0",
"webpack-dev-server": "^4.3.0",
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.11.1",
"webpack-manifest-plugin": "^4.0.2",
"webpackbar": "^5.0.0-3",
"workbox-build": "^6.4.2"
"webpackbar": "^5.0.2",
"workbox-build": "^6.5.4"
},
"_comment": "Polymer 3.2 contained a bug, fixed in https://github.com/Polymer/polymer/pull/5569, add as patch",
"resolutions": {
"@polymer/polymer": "patch:@polymer/polymer@3.4.1#./.yarn/patches/@polymer/polymer/pr-5569.patch",
"@webcomponents/webcomponentsjs": "^2.2.10",
"lit": "^2.1.2",
"lit-html": "2.1.2",
"lit-element": "3.1.2",
"@lit/reactive-element": "1.2.1"
"@webcomponents/webcomponentsjs": "^2.2.10"
},
"main": "src/home-assistant.js",
"prettier": {
"trailingComma": "es5",
"arrowParens": "always"
},
"packageManager": "yarn@3.2.3"
"packageManager": "yarn@3.3.1"
}

View File

@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "home-assistant-frontend"
version = "20221228.0"
version = "20230128.0"
license = {text = "Apache-2.0"}
description = "The Home Assistant frontend"
readme = "README.md"

View File

@@ -19,7 +19,9 @@ export const THEME_COLORS = new Set([
"orange",
"deep-orange",
"brown",
"light-grey",
"grey",
"dark-grey",
"blue-grey",
"black",
"white",
@@ -27,7 +29,7 @@ export const THEME_COLORS = new Set([
export function computeCssColor(color: string): string {
if (THEME_COLORS.has(color)) {
return `rgb(var(--rgb-${color}-color))`;
return `var(--${color}-color)`;
}
return color;
}

View File

@@ -201,6 +201,7 @@ export const DOMAINS_WITH_CARD = [
export const SENSOR_ENTITIES = [
"sensor",
"binary_sensor",
"calendar",
"camera",
"device_tracker",
"weather",

View File

@@ -18,7 +18,7 @@ export const relativeTime = (
to?: Date,
includeTense = true
): string => {
const diff = selectUnit(from, to);
const diff = selectUnit(from, to, locale);
if (includeTense) {
return formatRelTimeMem(locale).format(diff.value, diff.unit);
}

View File

@@ -39,5 +39,5 @@ export default function scrollToTarget(element, target) {
);
requestAnimationFrame(updateFrame.bind(element));
}
}.call(element));
}).call(element);
}

View File

@@ -1,21 +0,0 @@
export const alarmControlPanelColor = (state?: string): string | undefined => {
switch (state) {
case "armed_away":
case "armed_vacation":
case "armed_home":
case "armed_night":
case "armed_custom_bypass":
return "alarm-armed";
case "pending":
return "alarm-pending";
case "arming":
case "disarming":
return "alarm-arming";
case "triggered":
return "alarm-triggered";
case "disarmed":
return "alarm-disarmed";
default:
return undefined;
}
};

View File

@@ -1,10 +0,0 @@
export const alertColor = (state?: string): string | undefined => {
switch (state) {
case "on":
return "alert";
case "off":
return "alert-off";
default:
return undefined;
}
};

View File

@@ -1,13 +1,15 @@
export const batteryStateColor = (state: string) => {
export const batteryStateColorProperty = (
state: string
): string | undefined => {
const value = Number(state);
if (isNaN(value)) {
return undefined;
}
if (value >= 70) {
return "sensor-battery-high";
return "--state-sensor-battery-high-color";
}
if (value >= 30) {
return "sensor-battery-medium";
return "--state-sensor-battery-medium-color";
}
return "sensor-battery-low";
return "--state-sensor-battery-low-color";
};

View File

@@ -1,29 +0,0 @@
import { HassEntity } from "home-assistant-js-websocket";
import { stateActive } from "../state_active";
const ALERTING_DEVICE_CLASSES = new Set([
"battery",
"carbon_monoxide",
"gas",
"heat",
"lock",
"moisture",
"problem",
"safety",
"smoke",
"tamper",
]);
export const binarySensorColor = (
stateObj: HassEntity,
state: string
): string | undefined => {
const deviceClass = stateObj?.attributes.device_class;
if (!stateActive(stateObj, state)) {
return undefined;
}
return deviceClass && ALERTING_DEVICE_CLASSES.has(deviceClass)
? "binary-sensor-alerting"
: "binary-sensor";
};

View File

@@ -1,29 +0,0 @@
import { HvacAction } from "../../../data/climate";
export const CLIMATE_HVAC_ACTION_COLORS: Record<HvacAction, string> = {
cooling: "var(--rgb-state-climate-cool-color)",
drying: "var(--rgb-state-climate-dry-color)",
fan: "var(--rgb-state-climate-fan-only-color)",
heating: "var(--rgb-state-climate-heat-color)",
idle: "var(--rgb-state-climate-idle-color)",
off: "var(--rgb-state-climate-off-color)",
};
export const climateColor = (state: string): string | undefined => {
switch (state) {
case "auto":
return "climate-auto";
case "cool":
return "climate-cool";
case "dry":
return "climate-dry";
case "fan_only":
return "climate-fan-only";
case "heat":
return "climate-heat";
case "heat_cool":
return "climate-heat-cool";
default:
return undefined;
}
};

View File

@@ -1,15 +0,0 @@
export const lockColor = (state?: string): string | undefined => {
switch (state) {
case "unlocked":
return "lock-unlocked";
case "locked":
return "lock-locked";
case "jammed":
return "lock-jammed";
case "locking":
case "unlocking":
return "lock-pending";
default:
return undefined;
}
};

View File

@@ -1,10 +0,0 @@
export const personColor = (state: string): string | undefined => {
switch (state) {
case "home":
return "person-home";
case "not_home":
return "person-not-home";
default:
return "person-zone";
}
};

View File

@@ -1,15 +0,0 @@
import { HassEntity } from "home-assistant-js-websocket";
import { batteryStateColor } from "./battery_color";
export const sensorColor = (
stateObj: HassEntity,
state: string
): string | undefined => {
const deviceClass = stateObj?.attributes.device_class;
if (deviceClass === "battery") {
return batteryStateColor(state);
}
return undefined;
};

View File

@@ -1,15 +0,0 @@
import { HassEntity } from "home-assistant-js-websocket";
import { UpdateEntity, updateIsInstalling } from "../../../data/update";
import { stateActive } from "../state_active";
export const updateColor = (
stateObj: HassEntity,
state: string
): string | undefined => {
if (!stateActive(stateObj, state)) {
return undefined;
}
return updateIsInstalling(stateObj as UpdateEntity)
? "update-installing"
: "update";
};

View File

@@ -3,6 +3,8 @@ import {
mdiAccountArrowRight,
mdiAirHumidifier,
mdiAirHumidifierOff,
mdiAudioVideo,
mdiAudioVideoOff,
mdiBluetooth,
mdiBluetoothConnect,
mdiCalendar,
@@ -25,8 +27,6 @@ import {
mdiPackageUp,
mdiPowerPlug,
mdiPowerPlugOff,
mdiAudioVideo,
mdiAudioVideoOff,
mdiRestart,
mdiSpeaker,
mdiSpeakerOff,
@@ -53,6 +53,7 @@ import { DEFAULT_DOMAIN_ICON, FIXED_DOMAIN_ICONS } from "../const";
import { alarmPanelIcon } from "./alarm_panel_icon";
import { binarySensorIcon } from "./binary_sensor_icon";
import { coverIcon } from "./cover_icon";
import { numberIcon } from "./number_icon";
import { sensorIcon } from "./sensor_icon";
export const domainIcon = (
@@ -108,7 +109,7 @@ export const domainIconWithoutDefault = (
return compareState === "not_home" ? mdiAccountArrowRight : mdiAccount;
case "humidifier":
return state && state === "off" ? mdiAirHumidifierOff : mdiAirHumidifier;
return compareState === "off" ? mdiAirHumidifierOff : mdiAirHumidifier;
case "input_boolean":
return compareState === "on"
@@ -180,6 +181,15 @@ export const domainIconWithoutDefault = (
}
}
case "number": {
const icon = numberIcon(stateObj);
if (icon) {
return icon;
}
break;
}
case "person":
return compareState === "not_home" ? mdiAccountArrowRight : mdiAccount;

View File

@@ -0,0 +1,13 @@
/** Return an icon representing a number state. */
import { HassEntity } from "home-assistant-js-websocket";
import { FIXED_DEVICE_CLASS_ICONS } from "../const";
export const numberIcon = (stateObj?: HassEntity): string | undefined => {
const dclass = stateObj?.attributes.device_class;
if (dclass && dclass in FIXED_DEVICE_CLASS_ICONS) {
return FIXED_DEVICE_CLASS_ICONS[dclass];
}
return undefined;
};

View File

@@ -1,94 +1,102 @@
/** Return an color representing a state. */
import { HassEntity } from "home-assistant-js-websocket";
import { UNAVAILABLE } from "../../data/entity";
import { alarmControlPanelColor } from "./color/alarm_control_panel_color";
import { alertColor } from "./color/alert_color";
import { binarySensorColor } from "./color/binary_sensor_color";
import { climateColor } from "./color/climate_color";
import { lockColor } from "./color/lock_color";
import { personColor } from "./color/person_color";
import { sensorColor } from "./color/sensor_color";
import { updateColor } from "./color/update_color";
import { computeCssVariable } from "../../resources/css-variables";
import { slugify } from "../string/slugify";
import { batteryStateColorProperty } from "./color/battery_color";
import { computeDomain } from "./compute_domain";
import { stateActive } from "./state_active";
const STATIC_ACTIVE_COLORED_DOMAIN = new Set([
const STATE_COLORED_DOMAIN = new Set([
"alarm_control_panel",
"alert",
"automation",
"binary_sensor",
"calendar",
"camera",
"climate",
"cover",
"device_tracker",
"fan",
"group",
"humidifier",
"input_boolean",
"light",
"lock",
"media_player",
"person",
"plant",
"remote",
"schedule",
"script",
"siren",
"sun",
"switch",
"timer",
"update",
"vacuum",
]);
export const stateColorCss = (stateObj: HassEntity, state?: string) => {
const compareState = state !== undefined ? state : stateObj?.state;
if (compareState === UNAVAILABLE) {
return `var(--rgb-state-unavailable-color)`;
return `var(--state-unavailable-color)`;
}
const domainColor = stateColor(stateObj, state);
if (domainColor) {
return `var(--rgb-state-${domainColor}-color)`;
}
if (!stateActive(stateObj, state)) {
return `var(--rgb-state-inactive-color)`;
const properties = stateColorProperties(stateObj, state);
if (properties) {
return computeCssVariable(properties);
}
return undefined;
};
export const stateColor = (stateObj: HassEntity, state?: string) => {
export const domainStateColorProperties = (
stateObj: HassEntity,
state?: string
): string[] => {
const compareState = state !== undefined ? state : stateObj.state;
const domain = computeDomain(stateObj.entity_id);
const active = stateActive(stateObj, state);
const properties: string[] = [];
const stateKey = slugify(compareState, "_");
const activeKey = active ? "active" : "inactive";
const dc = stateObj.attributes.device_class;
if (dc) {
properties.push(`--state-${domain}-${dc}-${stateKey}-color`);
}
properties.push(
`--state-${domain}-${stateKey}-color`,
`--state-${domain}-${activeKey}-color`,
`--state-${activeKey}-color`
);
return properties;
};
export const stateColorProperties = (
stateObj: HassEntity,
state?: string
): string[] | undefined => {
const compareState = state !== undefined ? state : stateObj?.state;
const domain = computeDomain(stateObj.entity_id);
const dc = stateObj.attributes.device_class;
if (
STATIC_ACTIVE_COLORED_DOMAIN.has(domain) &&
stateActive(stateObj, state)
) {
return domain.replace("_", "-");
// Special rules for battery coloring
if (domain === "sensor" && dc === "battery") {
const property = batteryStateColorProperty(compareState);
if (property) {
return [property];
}
}
switch (domain) {
case "alarm_control_panel":
return alarmControlPanelColor(compareState);
case "alert":
return alertColor(compareState);
case "binary_sensor":
return binarySensorColor(stateObj, compareState);
case "climate":
return climateColor(compareState);
case "lock":
return lockColor(compareState);
case "person":
case "device_tracker":
return personColor(compareState);
case "sensor":
return sensorColor(stateObj, compareState);
case "sun":
return compareState === "above_horizon" ? "sun-day" : "sun-night";
case "update":
return updateColor(stateObj, compareState);
if (STATE_COLORED_DOMAIN.has(domain)) {
return domainStateColorProperties(stateObj, state);
}
return undefined;

View File

@@ -22,6 +22,6 @@ export const iconColorCSS = css`
/* Color the icon if unavailable */
ha-state-icon[data-state="unavailable"] {
color: rgb(var(--rgb-state-unavailable-color));
color: var(--state-unavailable-color);
}
`;

View File

@@ -29,11 +29,9 @@ export type LocalizeKeys =
| `ui.panel.config.devices.${string}`
| `ui.panel.config.energy.${string}`
| `ui.panel.config.info.${string}`
| `ui.panel.config.logs.${string}`
| `ui.panel.config.lovelace.${string}`
| `ui.panel.config.network.${string}`
| `ui.panel.config.scene.${string}`
| `ui.panel.config.url.${string}`
| `ui.panel.config.zha.${string}`
| `ui.panel.config.zwave_js.${string}`
| `ui.panel.lovelace.card.${string}`

View File

@@ -1,3 +1,7 @@
import { differenceInDays, differenceInWeeks, startOfWeek } from "date-fns/esm";
import { FrontendLocaleData } from "../../data/translation";
import { firstWeekdayIndex } from "../datetime/first_weekday";
export type Unit =
| "second"
| "minute"
@@ -11,13 +15,12 @@ export type Unit =
const MS_PER_SECOND = 1e3;
const SECS_PER_MIN = 60;
const SECS_PER_HOUR = SECS_PER_MIN * 60;
const SECS_PER_DAY = SECS_PER_HOUR * 24;
const SECS_PER_WEEK = SECS_PER_DAY * 7;
// Adapted from https://github.com/formatjs/formatjs/blob/186cef62f980ec66252ee232f438a42d0b51b9f9/packages/intl-utils/src/diff.ts
export function selectUnit(
from: Date | number,
to: Date | number = Date.now(),
locale: FrontendLocaleData,
thresholds: Partial<Thresholds> = {}
): { value: number; unit: Unit } {
const resolvedThresholds: Thresholds = {
@@ -49,29 +52,56 @@ export function selectUnit(
};
}
const days = secs / SECS_PER_DAY;
const fromDate = new Date(from);
const toDate = new Date(to);
// Set time component to zero, which allows us to compare only the days
fromDate.setHours(0, 0, 0, 0);
toDate.setHours(0, 0, 0, 0);
const days = differenceInDays(fromDate, toDate);
if (days === 0) {
return {
value: Math.round(hours),
unit: "hour",
};
}
if (Math.abs(days) < resolvedThresholds.day) {
return {
value: Math.round(days),
value: days,
unit: "day",
};
}
const weeks = secs / SECS_PER_WEEK;
const firstWeekday = firstWeekdayIndex(locale);
const fromWeek = startOfWeek(fromDate, { weekStartsOn: firstWeekday });
const toWeek = startOfWeek(toDate, { weekStartsOn: firstWeekday });
const weeks = differenceInWeeks(fromWeek, toWeek);
if (weeks === 0) {
return {
value: days,
unit: "day",
};
}
if (Math.abs(weeks) < resolvedThresholds.week) {
return {
value: Math.round(weeks),
value: weeks,
unit: "week",
};
}
const fromDate = new Date(from);
const toDate = new Date(to);
const years = fromDate.getFullYear() - toDate.getFullYear();
const months = years * 12 + fromDate.getMonth() - toDate.getMonth();
if (Math.round(Math.abs(months)) < resolvedThresholds.month) {
if (months === 0) {
return {
value: Math.round(months),
value: weeks,
unit: "week",
};
}
if (Math.abs(months) < resolvedThresholds.month || years === 0) {
return {
value: months,
unit: "month",
};
}

View File

@@ -10,6 +10,8 @@ import { customElement, property, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map";
import { styleMap } from "lit/directives/style-map";
import { clamp } from "../../common/number/clamp";
import { computeRTL } from "../../common/util/compute_rtl";
import { HomeAssistant } from "../../types";
export const MIN_TIME_BETWEEN_UPDATES = 60 * 5 * 1000;
@@ -22,6 +24,8 @@ interface Tooltip extends TooltipModel<any> {
export default class HaChartBase extends LitElement {
public chart?: Chart;
@property({ attribute: false }) public hass!: HomeAssistant;
@property({ attribute: "chart-type", reflect: true })
public chartType: ChartType = "line";
@@ -33,6 +37,8 @@ export default class HaChartBase extends LitElement {
@property({ type: Number }) public height?: number;
@property({ type: Number }) public paddingYAxis = 0;
@state() private _chartHeight?: number;
@state() private _tooltip?: Tooltip;
@@ -128,6 +134,8 @@ export default class HaChartBase extends LitElement {
style=${styleMap({
height: `${this.height ?? this._chartHeight}px`,
overflow: this._chartHeight ? "initial" : "hidden",
"padding-left": `${computeRTL(this.hass) ? 0 : this.paddingYAxis}px`,
"padding-right": `${computeRTL(this.hass) ? this.paddingYAxis : 0}px`,
})}
>
<canvas></canvas>

View File

@@ -2,6 +2,8 @@ import type { ChartData, ChartDataset, ChartOptions } from "chart.js";
import { html, LitElement, PropertyValues } from "lit";
import { property, state } from "lit/decorators";
import { getGraphColorByIndex } from "../../common/color/colors";
import { fireEvent } from "../../common/dom/fire_event";
import { computeRTL } from "../../common/util/compute_rtl";
import {
formatNumber,
numberFormatToLocale,
@@ -30,17 +32,25 @@ class StateHistoryChartLine extends LitElement {
@property({ attribute: false }) public endTime!: Date;
@property({ type: Number }) public paddingYAxis = 0;
@property({ type: Number }) public chartIndex?;
@state() private _chartData?: ChartData<"line">;
@state() private _chartOptions?: ChartOptions;
@state() private _yWidth = 0;
private _chartTime: Date = new Date();
protected render() {
return html`
<ha-chart-base
.hass=${this.hass}
.data=${this._chartData}
.options=${this._chartOptions}
.paddingYAxis=${this.paddingYAxis - this._yWidth}
chart-type="line"
></ha-chart-base>
`;
@@ -84,6 +94,16 @@ class StateHistoryChartLine extends LitElement {
display: true,
text: this.unit,
},
afterUpdate: (y) => {
if (this._yWidth !== Math.floor(y.width)) {
this._yWidth = Math.floor(y.width);
fireEvent(this, "y-width-changed", {
value: this._yWidth,
chartIndex: this.chartIndex,
});
}
},
position: computeRTL(this.hass) ? "right" : "left",
},
},
plugins: {

View File

@@ -2,6 +2,7 @@ import type { ChartData, ChartDataset, ChartOptions } from "chart.js";
import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit";
import { customElement, property, state } from "lit/decorators";
import { formatDateTimeWithSeconds } from "../../common/datetime/format_date_time";
import { fireEvent } from "../../common/dom/fire_event";
import { numberFormatToLocale } from "../../common/number/format_number";
import { computeRTL } from "../../common/util/compute_rtl";
import { TimelineEntity } from "../../data/history";
@@ -32,18 +33,26 @@ export class StateHistoryChartTimeline extends LitElement {
@property({ attribute: false }) public endTime!: Date;
@property({ type: Number }) public paddingYAxis = 0;
@property({ type: Number }) public chartIndex?;
@state() private _chartData?: ChartData<"timeline">;
@state() private _chartOptions?: ChartOptions<"timeline">;
@state() private _yWidth = 0;
private _chartTime: Date = new Date();
protected render() {
return html`
<ha-chart-base
.hass=${this.hass}
.data=${this._chartData}
.options=${this._chartOptions}
.height=${this.data.length * 30 + 30}
.paddingYAxis=${this.paddingYAxis - this._yWidth}
chart-type="timeline"
></ha-chart-base>
`;
@@ -131,6 +140,15 @@ export class StateHistoryChartTimeline extends LitElement {
scaleInstance.width = narrow ? 105 : 185;
}
},
afterUpdate: (y) => {
if (this._yWidth !== Math.floor(y.width)) {
this._yWidth = Math.floor(y.width);
fireEvent(this, "y-width-changed", {
value: this._yWidth,
chartIndex: this.chartIndex,
});
}
},
position: computeRTL(this.hass) ? "right" : "left",
},
},

View File

@@ -31,6 +31,12 @@ const chunkData = (inputArray: any[], chunks: number) =>
return results;
}, []);
declare global {
interface HASSDomEvents {
"y-width-changed": { value: number; chartIndex: number };
}
}
@customElement("state-history-charts")
class StateHistoryCharts extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@@ -56,6 +62,12 @@ class StateHistoryCharts extends LitElement {
@state() private _computedEndTime!: Date;
@state() private _maxYWidth = 0;
@state() private _childYWidths: number[] = [];
@state() private _chartCount = 0;
// @ts-ignore
@restoreScroll(".container") private _savedScrollPos?: number;
@@ -99,6 +111,8 @@ class StateHistoryCharts extends LitElement {
).concat(this.historyData.line)
: this.historyData.line;
this._chartCount = combinedItems.length;
return this.virtualize
? html`<div class="container ha-scrollbar" @scroll=${this._saveScrollPos}>
<lit-virtualizer
@@ -130,7 +144,10 @@ class StateHistoryCharts extends LitElement {
.identifier=${item.identifier}
.showNames=${this.showNames}
.endTime=${this._computedEndTime}
.paddingYAxis=${this._maxYWidth}
.names=${this.names}
.chartIndex=${index}
@y-width-changed=${this._yWidthChanged}
></state-history-chart-line>
</div> `;
}
@@ -144,6 +161,9 @@ class StateHistoryCharts extends LitElement {
.names=${this.names}
.narrow=${this.narrow}
.chunked=${this.virtualize}
.paddingYAxis=${this._maxYWidth}
.chartIndex=${index}
@y-width-changed=${this._yWidthChanged}
></state-history-chart-timeline>
</div> `;
};
@@ -152,6 +172,21 @@ class StateHistoryCharts extends LitElement {
return !(changedProps.size === 1 && changedProps.has("hass"));
}
protected updated(changedProps: PropertyValues) {
if (changedProps.has("_chartCount")) {
if (this._chartCount < this._childYWidths.length) {
this._childYWidths.length = this._chartCount;
this._maxYWidth =
this._childYWidths.length === 0 ? 0 : Math.max(...this._childYWidths);
}
}
}
private _yWidthChanged(e: CustomEvent<HASSDomEvents["y-width-changed"]>) {
this._childYWidths[e.detail.chartIndex] = e.detail.value;
this._maxYWidth = Math.max(...this._childYWidths);
}
private _isHistoryEmpty(): boolean {
const historyDataEmpty =
!this.historyData ||

View File

@@ -133,6 +133,7 @@ class StatisticsChart extends LitElement {
return html`
<ha-chart-base
.hass=${this.hass}
.data=${this._chartData}
.options=${this._chartOptions}
.chartType=${this.chartType}

View File

@@ -1,11 +1,11 @@
import { HassEntity } from "home-assistant-js-websocket";
import { getGraphColorByIndex } from "../../../common/color/colors";
import { lab2hex, rgb2hex, rgb2lab } from "../../../common/color/convert-color";
import { hex2rgb, lab2hex, rgb2lab } from "../../../common/color/convert-color";
import { labBrighten } from "../../../common/color/lab";
import { computeDomain } from "../../../common/entity/compute_domain";
import { stateActive } from "../../../common/entity/state_active";
import { stateColor } from "../../../common/entity/state_color";
import { UNAVAILABLE } from "../../../data/entity";
import { stateColorProperties } from "../../../common/entity/state_color";
import { UNAVAILABLE, UNKNOWN } from "../../../data/entity";
import { computeCssValue } from "../../../resources/css-variables";
const DOMAIN_STATE_SHADES: Record<string, Record<string, number>> = {
media_player: {
@@ -17,61 +17,35 @@ const DOMAIN_STATE_SHADES: Record<string, Record<string, number>> = {
},
};
const cssColorMap: Map<string, [number, number, number]> = new Map();
function cssToRgb(
cssVariable: string,
computedStyles: CSSStyleDeclaration
): [number, number, number] | undefined {
if (!cssVariable.startsWith("--rgb")) {
return undefined;
}
if (cssColorMap.has(cssVariable)) {
return cssColorMap.get(cssVariable)!;
}
const value = computedStyles.getPropertyValue(cssVariable);
if (!value) return undefined;
const rgb = value.split(",").map((v) => Number(v)) as [
number,
number,
number
];
cssColorMap.set(cssVariable, rgb);
return rgb;
}
function computeTimelineStateColor(
state: string,
computedStyles: CSSStyleDeclaration,
stateObj?: HassEntity
): string | undefined {
if (!stateObj || state === UNAVAILABLE) {
return "transparent";
return computeCssValue("--history-unavailable-color", computedStyles);
}
const color = stateColor(stateObj, state);
if (!color && !stateActive(stateObj, state)) {
const rgb = cssToRgb("--rgb-state-inactive-color", computedStyles);
if (!rgb) return undefined;
return rgb2hex(rgb);
if (state === UNKNOWN) {
return computeCssValue("--history-unknown-color", computedStyles);
}
const rgb = cssToRgb(`--rgb-state-${color}-color`, computedStyles);
const properties = stateColorProperties(stateObj, state);
if (!properties) {
return undefined;
}
const rgb = computeCssValue(properties, computedStyles);
if (!rgb) return undefined;
const domain = computeDomain(stateObj.entity_id);
const shade = DOMAIN_STATE_SHADES[domain]?.[state] as number | number;
if (!shade) {
return rgb2hex(rgb);
return rgb;
}
return lab2hex(labBrighten(rgb2lab(rgb), shade));
return lab2hex(labBrighten(rgb2lab(hex2rgb(rgb)), shade));
}
let colorIndex = 0;

View File

@@ -157,7 +157,7 @@ export const CURRENCIES = [
"XPF",
"YER",
"ZAR",
"ZMK",
"ZMW",
"ZWL",
];

View File

@@ -200,7 +200,6 @@ export class HaDataTable extends LitElement {
Object.values(clonedColumns).forEach(
(column: ClonedDataTableColumnData) => {
delete column.title;
delete column.type;
delete column.template;
}
);

View File

@@ -55,11 +55,16 @@ const sortData = (
? b[column.valueColumn || sortColumn][column.filterKey]
: b[column.valueColumn || sortColumn];
if (typeof valA === "string") {
valA = valA.toUpperCase();
}
if (typeof valB === "string") {
valB = valB.toUpperCase();
if (column.type === "numeric") {
valA = isNaN(valA) ? undefined : Number(valA);
valB = isNaN(valB) ? undefined : Number(valB);
} else {
if (typeof valA === "string") {
valA = valA.toUpperCase();
}
if (typeof valB === "string") {
valB = valB.toUpperCase();
}
}
// Ensure "undefined" is always sorted to the bottom

View File

@@ -5,7 +5,6 @@ import DateRangePicker from "vue2-daterange-picker";
// @ts-ignore
import dateRangePickerStyles from "vue2-daterange-picker/dist/vue2-daterange-picker.css";
import { fireEvent } from "../common/dom/fire_event";
import { Constructor } from "../types";
const Component = Vue.extend({
props: {
@@ -47,35 +46,26 @@ const Component = Vue.extend({
},
},
render(createElement) {
// @ts-ignore
// @ts-expect-error
return createElement(DateRangePicker, {
props: {
// @ts-ignore
"time-picker": this.timePicker,
// @ts-ignore
"auto-apply": this.autoApply,
opens: "right",
"show-dropdowns": false,
// @ts-ignore
"time-picker24-hour": this.twentyfourHours,
// @ts-ignore
disabled: this.disabled,
// @ts-ignore
ranges: this.ranges ? {} : false,
"locale-data": {
// @ts-ignore
firstDay: this.firstDay,
},
},
model: {
value: {
// @ts-ignore
startDate: this.startDate,
// @ts-ignore
endDate: this.endDate,
},
callback: (value) => {
// @ts-ignore
fireEvent(this.$el as HTMLElement, "change", value);
},
expression: "dateRange",
@@ -106,7 +96,11 @@ const Component = Vue.extend({
},
});
const WrappedElement: Constructor<HTMLElement> = wrap(Vue, Component);
// Assertion corrects HTMLElement type from package
const WrappedElement = wrap(
Vue,
Component
) as unknown as CustomElementConstructor;
@customElement("date-range-picker")
class DateRangePickerElement extends WrappedElement {

View File

@@ -1,6 +1,7 @@
import type { HassEntity } from "home-assistant-js-websocket";
import { css, html, LitElement, TemplateResult } from "lit";
import { customElement, property } from "lit/decorators";
import memoizeOne from "memoize-one";
import { fireEvent } from "../../common/dom/fire_event";
import { isValidEntityId } from "../../common/entity/valid_entity_id";
import type { PolymerChangedEvent } from "../../polymer-types";
@@ -95,7 +96,10 @@ class HaEntitiesPickerLight extends LitElement {
.excludeEntities=${this.excludeEntities}
.includeDeviceClasses=${this.includeDeviceClasses}
.includeUnitOfMeasurement=${this.includeUnitOfMeasurement}
.entityFilter=${this._entityFilter}
.entityFilter=${this._getEntityFilter(
this.value,
this.entityFilter
)}
.value=${entityId}
.label=${this.pickedEntityLabel}
.disabled=${this.disabled}
@@ -114,7 +118,7 @@ class HaEntitiesPickerLight extends LitElement {
.excludeEntities=${this.excludeEntities}
.includeDeviceClasses=${this.includeDeviceClasses}
.includeUnitOfMeasurement=${this.includeUnitOfMeasurement}
.entityFilter=${this._entityFilter}
.entityFilter=${this._getEntityFilter(this.value, this.entityFilter)}
.label=${this.pickEntityLabel}
.helper=${this.helper}
.disabled=${this.disabled}
@@ -125,11 +129,15 @@ class HaEntitiesPickerLight extends LitElement {
`;
}
private _entityFilter: HaEntityPickerEntityFilterFunc = (
stateObj: HassEntity
) =>
(!this.value || !this.value.includes(stateObj.entity_id)) &&
(!this.entityFilter || this.entityFilter(stateObj));
private _getEntityFilter = memoizeOne(
(
value: string[] | undefined,
entityFilter: HaEntityPickerEntityFilterFunc | undefined
): HaEntityPickerEntityFilterFunc =>
(stateObj: HassEntity) =>
(!value || !value.includes(stateObj.entity_id)) &&
(!entityFilter || entityFilter(stateObj))
);
private get _currentEntities() {
return this.value || [];

View File

@@ -22,6 +22,7 @@ import {
isNumericState,
} from "../../common/number/format_number";
import { isUnavailableState, UNAVAILABLE, UNKNOWN } from "../../data/entity";
import { EntityRegistryEntry } from "../../data/entity_registry";
import { timerTimeRemaining } from "../../data/timer";
import { HomeAssistant } from "../../types";
import "../ha-label-badge";
@@ -34,9 +35,9 @@ const TRUNCATED_DOMAINS = [
"person",
] as const satisfies ReadonlyArray<keyof typeof FIXED_DOMAIN_STATES>;
type TruncatedDomain = typeof TRUNCATED_DOMAINS[number];
type TruncatedDomain = (typeof TRUNCATED_DOMAINS)[number];
type TruncatedKey = {
[T in TruncatedDomain]: `${T}.${typeof FIXED_DOMAIN_STATES[T][number]}`;
[T in TruncatedDomain]: `${T}.${(typeof FIXED_DOMAIN_STATES)[T][number]}`;
}[TruncatedDomain];
const getTruncatedKey = (domainKey: string, stateKey: string) => {
@@ -103,8 +104,10 @@ export class HaStateLabelBadge extends LitElement {
// 4. Icon determined via entity state
// 5. Value string as fallback
const domain = computeStateDomain(entityState);
const entry = this.hass?.entities[entityState.entity_id];
const showIcon = this.icon || this._computeShowIcon(domain, entityState);
const showIcon =
this.icon || this._computeShowIcon(domain, entityState, entry);
const image = this.icon
? ""
: this.image
@@ -112,7 +115,9 @@ export class HaStateLabelBadge extends LitElement {
: entityState.attributes.entity_picture_local ||
entityState.attributes.entity_picture;
const value =
!image && !showIcon ? this._computeValue(domain, entityState) : undefined;
!image && !showIcon
? this._computeValue(domain, entityState, entry)
: undefined;
return html`
<ha-label-badge
@@ -152,7 +157,11 @@ export class HaStateLabelBadge extends LitElement {
}
}
private _computeValue(domain: string, entityState: HassEntity) {
private _computeValue(
domain: string,
entityState: HassEntity,
entry?: EntityRegistryEntry
) {
switch (domain) {
case "alarm_control_panel":
case "binary_sensor":
@@ -165,7 +174,7 @@ export class HaStateLabelBadge extends LitElement {
return null;
// @ts-expect-error we don't break and go to default
case "sensor":
if (entityState.attributes.device_class === "moon__phase") {
if (entry?.platform === "moon") {
return null;
}
// eslint-disable-next-line: disable=no-fallthrough
@@ -188,7 +197,11 @@ export class HaStateLabelBadge extends LitElement {
}
}
private _computeShowIcon(domain: string, entityState: HassEntity): boolean {
private _computeShowIcon(
domain: string,
entityState: HassEntity,
entry?: EntityRegistryEntry
): boolean {
if (entityState.state === UNAVAILABLE) {
return false;
}
@@ -204,7 +217,7 @@ export class HaStateLabelBadge extends LitElement {
case "timer":
return true;
case "sensor":
return entityState.attributes.device_class === "moon__phase";
return entry?.platform === "moon";
default:
return false;
}
@@ -223,6 +236,10 @@ export class HaStateLabelBadge extends LitElement {
if (domainStateKey) {
return this.hass!.localize(`state_badge.${domainStateKey}`);
}
// Person and device tracker state can be zone name
if (domain === "person" || domain === "device_tracker") {
return entityState.state;
}
if (domain === "timer") {
return secondsToDuration(_timerTimeRemaining);
}

View File

@@ -11,13 +11,12 @@ import {
import { property, state } from "lit/decorators";
import { ifDefined } from "lit/directives/if-defined";
import { styleMap } from "lit/directives/style-map";
import { CLIMATE_HVAC_ACTION_COLORS } from "../../common/entity/color/climate_color";
import { computeDomain } from "../../common/entity/compute_domain";
import { computeStateDomain } from "../../common/entity/compute_state_domain";
import { stateActive } from "../../common/entity/state_active";
import { stateColorCss } from "../../common/entity/state_color";
import { iconColorCSS } from "../../common/style/icon_color_css";
import { cameraUrlWithWidthHeight } from "../../data/camera";
import { HVAC_ACTION_TO_MODE } from "../../data/climate";
import type { HomeAssistant } from "../../types";
import "../ha-state-icon";
@@ -112,10 +111,10 @@ export class StateBadge extends LitElement {
} else if (this.color) {
// Externally provided overriding color wins over state color
iconStyle.color = this.color;
} else if (this._stateColor && stateActive(stateObj)) {
} else if (this._stateColor) {
const color = stateColorCss(stateObj);
if (color) {
iconStyle.color = `rgb(${color})`;
iconStyle.color = color;
}
if (stateObj.attributes.rgb_color) {
iconStyle.color = `rgb(${stateObj.attributes.rgb_color.join(",")})`;
@@ -134,8 +133,11 @@ export class StateBadge extends LitElement {
}
if (stateObj.attributes.hvac_action) {
const hvacAction = stateObj.attributes.hvac_action;
if (["heating", "cooling", "drying"].includes(hvacAction)) {
iconStyle.color = `rgb(${CLIMATE_HVAC_ACTION_COLORS[hvacAction]})`;
if (["heating", "cooling", "drying", "fan"].includes(hvacAction)) {
iconStyle.color = stateColorCss(
stateObj,
HVAC_ACTION_TO_MODE[hvacAction]
)!;
} else {
delete iconStyle.color;
}
@@ -170,6 +172,7 @@ export class StateBadge extends LitElement {
line-height: 40px;
vertical-align: middle;
box-sizing: border-box;
--state-inactive-color: initial;
}
:host(:focus) {
outline: none;

View File

@@ -28,7 +28,7 @@ class StateInfo extends LitElement {
const name = computeStateName(this.stateObj);
return html` <state-badge
return html`<state-badge
.stateObj=${this.stateObj}
.stateColor=${true}
.color=${this.color}

View File

@@ -16,7 +16,11 @@ const rowRenderer: ComboBoxLitRenderer<HassioAddonInfo> = (
<span>${item.name}</span>
<span slot="secondary">${item.slug}</span>
${item.icon
? html`<img slot="graphic" .src="/api/hassio/addons/${item.slug}/icon" />`
? html`<img
alt=""
slot="graphic"
.src="/api/hassio/addons/${item.slug}/icon"
/>`
: ""}
</mwc-list-item>`;

View File

@@ -126,6 +126,7 @@ export class HaAreaPicker extends LitElement {
area_id: "no_areas",
name: this.hass.localize("ui.components.area-picker.no_areas"),
picture: null,
aliases: [],
},
];
}
@@ -256,6 +257,7 @@ export class HaAreaPicker extends LitElement {
area_id: "no_areas",
name: this.hass.localize("ui.components.area-picker.no_match"),
picture: null,
aliases: [],
},
];
}
@@ -268,6 +270,7 @@ export class HaAreaPicker extends LitElement {
area_id: "add_new",
name: this.hass.localize("ui.components.area-picker.add_new"),
picture: null,
aliases: [],
},
];
}

View File

@@ -271,13 +271,18 @@ export class HaBarSlider extends LitElement {
return css`
:host {
display: block;
--slider-bar-color: rgb(var(--rgb-primary-color));
--slider-bar-background: rgb(var(--rgb-disabled-color));
--slider-bar-color: var(--primary-color);
--slider-bar-background: var(--disabled-color);
--slider-bar-background-opacity: 0.2;
--slider-bar-thickness: 40px;
--slider-bar-border-radius: 10px;
height: var(--slider-bar-thickness);
width: 100%;
border-radius: var(--slider-bar-border-radius);
outline: none;
}
:host(:focus-visible) {
box-shadow: 0 0 0 2px var(--slider-bar-color);
}
:host([vertical]) {
width: var(--slider-bar-thickness);
@@ -396,7 +401,7 @@ export class HaBarSlider extends LitElement {
.slider .slider-track-cursor:after {
display: block;
content: "";
background-color: rgb(var(--rgb-secondary-text-color));
background-color: var(--secondary-text-color);
position: absolute;
top: 0;
left: 0;

View File

@@ -92,8 +92,8 @@ export class HaBarSwitch extends LitElement {
return css`
:host {
display: block;
--switch-bar-on-color: rgb(var(--rgb-primary-color));
--switch-bar-off-color: rgb(var(--rgb-disabled-color));
--switch-bar-on-color: var(--primary-color);
--switch-bar-off-color: var(--disabled-color);
--switch-bar-background-opacity: 0.2;
--switch-bar-thickness: 40px;
--switch-bar-border-radius: 12px;
@@ -104,6 +104,14 @@ export class HaBarSwitch extends LitElement {
box-sizing: border-box;
user-select: none;
cursor: pointer;
border-radius: var(--switch-bar-border-radius);
outline: none;
}
:host(:focus-visible) {
box-shadow: 0 0 0 2px var(--switch-bar-off-color);
}
:host([checked]:focus-visible) {
box-shadow: 0 0 0 2px var(--switch-bar-on-color);
}
.switch {
box-sizing: border-box;

View File

@@ -266,6 +266,9 @@ export class HaBaseTimeInput extends LitElement {
seconds: this.seconds,
milliseconds: this.milliseconds,
};
if (this.enableDay) {
value.days = this.days;
}
if (this.format === 12) {
value.amPm = this.amPm;
}

View File

@@ -3,6 +3,7 @@ import { customElement, property } from "lit/decorators";
import { computeAttributeValueDisplay } from "../common/entity/compute_attribute_display";
import { computeStateDisplay } from "../common/entity/compute_state_display";
import { formatNumber } from "../common/number/format_number";
import { blankBeforePercent } from "../common/translations/blank_before_percent";
import { ClimateEntity, CLIMATE_PRESET_NONE } from "../data/climate";
import { isUnavailableState } from "../data/entity";
import type { HomeAssistant } from "../types";
@@ -47,6 +48,19 @@ class HaClimateState extends LitElement {
if (!this.hass || !this.stateObj) {
return undefined;
}
if (
this.stateObj.attributes.current_temperature != null &&
this.stateObj.attributes.current_humidity != null
) {
return `${formatNumber(
this.stateObj.attributes.current_temperature,
this.hass.locale
)} ${this.hass.config.unit_system.temperature}/
${formatNumber(
this.stateObj.attributes.current_humidity,
this.hass.locale
)}${blankBeforePercent(this.hass.locale)}%`;
}
if (this.stateObj.attributes.current_temperature != null) {
return `${formatNumber(
@@ -59,7 +73,7 @@ class HaClimateState extends LitElement {
return `${formatNumber(
this.stateObj.attributes.current_humidity,
this.hass.locale
)} %`;
)}${blankBeforePercent(this.hass.locale)}%`;
}
return undefined;

View File

@@ -4,6 +4,7 @@ import type {
CompletionResult,
CompletionSource,
} from "@codemirror/autocomplete";
import type { Extension } from "@codemirror/state";
import type { EditorView, KeyBinding, ViewUpdate } from "@codemirror/view";
import { HassEntities } from "home-assistant-js-websocket";
import { css, CSSResultGroup, PropertyValues, ReactiveElement } from "lit";
@@ -72,9 +73,9 @@ export class HaCodeEditor extends ReactiveElement {
if (!this.codemirror || !this._loadedCodeMirror) {
return false;
}
const className = this._loadedCodeMirror.HighlightStyle.get(
const className = this._loadedCodeMirror.highlightingFor(
this.codemirror.state,
this._loadedCodeMirror.tags.comment
[this._loadedCodeMirror.tags.comment]
);
return !!this.shadowRoot!.querySelector(`span.${className}`);
}
@@ -136,7 +137,7 @@ export class HaCodeEditor extends ReactiveElement {
private async _load(): Promise<void> {
this._loadedCodeMirror = await loadCodeMirror();
const extensions = [
const extensions: Extension[] = [
this._loadedCodeMirror.lineNumbers(),
this._loadedCodeMirror.EditorState.allowMultipleSelections.of(true),
this._loadedCodeMirror.history(),
@@ -152,10 +153,8 @@ export class HaCodeEditor extends ReactiveElement {
saveKeyBinding,
] as KeyBinding[]),
this._loadedCodeMirror.langCompartment.of(this._mode),
this._loadedCodeMirror.theme,
this._loadedCodeMirror.Prec.fallback(
this._loadedCodeMirror.highlightStyle
),
this._loadedCodeMirror.haTheme,
this._loadedCodeMirror.haSyntaxHighlighting,
this._loadedCodeMirror.readonlyCompartment.of(
this._loadedCodeMirror.EditorView.editable.of(!this.readOnly)
),
@@ -227,7 +226,7 @@ export class HaCodeEditor extends ReactiveElement {
return {
from: Number(entityWord.from),
options: states,
span: /^[a-z_]{3,}\.\w*$/,
validFor: /^[a-z_]{3,}\.\w*$/,
};
}
@@ -268,7 +267,7 @@ export class HaCodeEditor extends ReactiveElement {
return {
from: Number(match.from),
options: iconItems,
span: /^mdi:\S*$/,
validFor: /^mdi:\S*$/,
};
}

View File

@@ -59,6 +59,7 @@ class HaConfigEntryPicker extends LitElement {
>
<span slot="secondary">${item.localized_domain_name}</span>
<img
alt=""
slot="graphic"
src=${brandsUrl({
domain: item.domain,

View File

@@ -3,10 +3,12 @@ import { styles } from "@material/mwc-dialog/mwc-dialog.css";
import { mdiClose } from "@mdi/js";
import { css, html, TemplateResult } from "lit";
import { customElement } from "lit/decorators";
import type { HomeAssistant } from "../types";
import { FOCUS_TARGET } from "../dialogs/make-dialog-manager";
import type { HomeAssistant } from "../types";
import "./ha-icon-button";
const SUPPRESS_DEFAULT_PRESS_SELECTOR = ["button"];
export const createCloseHeading = (
hass: HomeAssistant,
title: string | TemplateResult
@@ -32,6 +34,14 @@ export class HaDialog extends DialogBase {
return html`<slot name="heading"> ${super.renderHeading()} </slot>`;
}
protected firstUpdated(): void {
super.firstUpdated();
this.suppressDefaultPressSelector = [
this.suppressDefaultPressSelector,
SUPPRESS_DEFAULT_PRESS_SELECTOR,
].join(", ");
}
static override styles = [
styles,
css`

View File

@@ -67,6 +67,9 @@ export class HaFormInteger extends LitElement implements HaFormElement {
@change=${this._valueChanged}
></ha-slider>
</div>
${this.helper
? html`<ha-input-helper-text>${this.helper}</ha-input-helper-text>`
: ""}
</div>
`;
}

View File

@@ -43,6 +43,8 @@ export class HaForm extends LitElement implements HaFormElement {
@property() public computeHelper?: (schema: any) => string | undefined;
@property() public localizeValue?: (key: string) => string;
public focus() {
const root = this.shadowRoot?.querySelector(".root");
if (!root) {
@@ -86,7 +88,9 @@ export class HaForm extends LitElement implements HaFormElement {
.value=${getValue(this.data, item)}
.label=${this._computeLabel(item, this.data)}
.disabled=${item.disabled || this.disabled || false}
.placeholder=${item.required ? "" : item.default}
.helper=${this._computeHelper(item)}
.localizeValue=${this.localizeValue}
.required=${item.required || false}
.context=${this._generateContext(item)}
></ha-selector>`

View File

@@ -39,7 +39,7 @@ export class HaNumberSelector extends LitElement {
<ha-slider
.min=${this.selector.number?.min}
.max=${this.selector.number?.max}
.value=${this._value}
.value=${this.value ?? ""}
.step=${this.selector.number?.step ?? 1}
.disabled=${this.disabled}
.required=${this.required}
@@ -81,17 +81,11 @@ export class HaNumberSelector extends LitElement {
`;
}
private get _value() {
return this.value ?? (this.selector.number?.min || 0);
}
private _handleInputChange(ev) {
ev.stopPropagation();
const value =
ev.target.value === "" || isNaN(ev.target.value)
? this.required
? this.selector.number?.min || 0
: undefined
? undefined
: Number(ev.target.value);
if (this.value === value) {
return;

View File

@@ -1,9 +1,10 @@
import { html, LitElement } from "lit";
import { customElement, property } from "lit/decorators";
import { html, LitElement, PropertyValues } from "lit";
import { customElement, property, query } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
import { HomeAssistant } from "../../types";
import "../ha-yaml-editor";
import "../ha-input-helper-text";
import type { HaYamlEditor } from "../ha-yaml-editor";
@customElement("ha-selector-object")
export class HaObjectSelector extends LitElement {
@@ -21,6 +22,10 @@ export class HaObjectSelector extends LitElement {
@property({ type: Boolean }) public required = true;
@query("ha-yaml-editor", true) private _yamlEditor!: HaYamlEditor;
private _valueChangedFromChild = false;
protected render() {
return html`<ha-yaml-editor
.hass=${this.hass}
@@ -36,7 +41,16 @@ export class HaObjectSelector extends LitElement {
: ""} `;
}
protected updated(changedProps: PropertyValues) {
super.updated(changedProps);
if (changedProps.has("value") && !this._valueChangedFromChild) {
this._yamlEditor.setValue(this.value);
}
this._valueChangedFromChild = false;
}
private _handleChange(ev) {
this._valueChangedFromChild = true;
const value = ev.target.value;
if (!ev.target.isValid) {
return;

View File

@@ -28,6 +28,8 @@ export class HaSelectSelector extends LitElement {
@property() public helper?: string;
@property() public localizeValue?: (key: string) => string;
@property({ type: Boolean }) public disabled = false;
@property({ type: Boolean }) public required = true;
@@ -39,9 +41,21 @@ export class HaSelectSelector extends LitElement {
protected render() {
const options =
this.selector.select?.options.map((option) =>
typeof option === "object" ? option : { value: option, label: option }
typeof option === "object"
? (option as SelectOption)
: ({ value: option, label: option } as SelectOption)
) || [];
const translationKey = this.selector.select?.translation_key;
if (this.localizeValue && translationKey) {
options.forEach((option) => {
option.label =
this.localizeValue!(`${translationKey}.options.${option.value}`) ||
option.label;
});
}
if (!this.selector.select?.custom_value && this._mode === "list") {
if (!this.selector.select?.multiple) {
return html`
@@ -164,10 +178,11 @@ export class HaSelectSelector extends LitElement {
<ha-select
fixedMenuPosition
naturalMenuWidth
.label=${this.label}
.value=${this.value}
.helper=${this.helper}
.label=${this.label ?? ""}
.value=${this.value ?? ""}
.helper=${this.helper ?? ""}
.disabled=${this.disabled}
.required=${this.required}
@closed=${stopPropagation}
@selected=${this._valueChanged}
>

View File

@@ -9,6 +9,7 @@ import {
} from "lit";
import { customElement, property, state } from "lit/decorators";
import memoizeOne from "memoize-one";
import { ensureArray } from "../../common/array/ensure-array";
import {
DeviceRegistryEntry,
getDeviceIntegrationLookup,
@@ -78,7 +79,7 @@ export class HaTargetSelector extends LitElement {
? [this.selector.target?.entity.device_class]
: undefined}
.includeDomains=${this.selector.target?.entity?.domain
? [this.selector.target?.entity.domain]
? ensureArray(this.selector.target.entity.domain as string | string[])
: undefined}
.disabled=${this.disabled}
></ha-target-picker>`;

View File

@@ -51,6 +51,8 @@ export class HaSelector extends LitElement {
@property() public helper?: string;
@property() public localizeValue?: (key: string) => string;
@property() public placeholder?: any;
@property({ type: Boolean }) public disabled = false;
@@ -86,6 +88,7 @@ export class HaSelector extends LitElement {
required: this.required,
helper: this.helper,
context: this.context,
localizeValue: this.localizeValue,
id: "selector",
})}
`;

View File

@@ -151,6 +151,14 @@ export class HaServiceControl extends LitElement {
updatedDefaultValue = true;
this._value!.data![field.key] = false;
}
if (
field.selector &&
field.default !== undefined &&
this._value!.data![field.key] === undefined
) {
updatedDefaultValue = true;
this._value!.data![field.key] = field.default;
}
});
}
if (updatedDefaultValue) {

View File

@@ -58,20 +58,32 @@ export class HaTimeInput extends LitElement {
const eventValue = ev.detail.value;
const useAMPM = useAmPm(this.locale);
let hours = eventValue.hours || 0;
if (eventValue && useAMPM) {
if (eventValue.amPm === "PM" && hours < 12) {
hours += 12;
}
if (eventValue.amPm === "AM" && hours === 12) {
hours = 0;
let value;
if (
!isNaN(eventValue.hours) ||
!isNaN(eventValue.minutes) ||
!isNaN(eventValue.seconds)
) {
let hours = eventValue.hours || 0;
if (eventValue && useAMPM) {
if (eventValue.amPm === "PM" && hours < 12) {
hours += 12;
}
if (eventValue.amPm === "AM" && hours === 12) {
hours = 0;
}
}
value = `${hours.toString().padStart(2, "0")}:${
eventValue.minutes
? eventValue.minutes.toString().padStart(2, "0")
: "00"
}:${
eventValue.seconds
? eventValue.seconds.toString().padStart(2, "0")
: "00"
}`;
}
const value = `${hours.toString().padStart(2, "0")}:${
eventValue.minutes ? eventValue.minutes.toString().padStart(2, "0") : "00"
}:${
eventValue.seconds ? eventValue.seconds.toString().padStart(2, "0") : "00"
}`;
if (value === this.value) {
return;

View File

@@ -21,8 +21,8 @@ export class HaTileBadge extends LitElement {
static get styles(): CSSResultGroup {
return css`
:host {
--tile-badge-background-color: rgb(var(--rgb-primary-color));
--tile-badge-icon-color: rgb(var(--rgb-white-color));
--tile-badge-background-color: var(--primary-color);
--tile-badge-icon-color: var(--white-color);
--mdc-icon-size: 12px;
}
.badge {

View File

@@ -82,9 +82,8 @@ export class HaTileButton extends LitElement {
return css`
:host {
--tile-button-icon-color: var(--primary-text-color);
--tile-button-background-color: rgb(var(--rgb-disabled-color));
--tile-button-background-color: var(--disabled-color);
--tile-button-background-opacity: 0.2;
--mdc-ripple-color: var(--tile-button-background-color);
width: 40px;
height: 40px;
-webkit-tap-highlight-color: transparent;
@@ -107,6 +106,7 @@ export class HaTileButton extends LitElement {
outline: none;
overflow: hidden;
background: none;
--mdc-ripple-color: var(--tile-button-background-color);
}
.button::before {
content: "";
@@ -128,7 +128,7 @@ export class HaTileButton extends LitElement {
}
.button:disabled {
cursor: not-allowed;
--tile-button-background-color: rgb(var(--rgb-disabled-color));
--tile-button-background-color: var(--disabled-color);
--tile-button-icon-color: var(--disabled-text-color);
--tile-button-background-opacity: 0.2;
}

View File

@@ -22,7 +22,7 @@ export class HaTileIcon extends LitElement {
static get styles(): CSSResultGroup {
return css`
:host {
--tile-icon-color: rgb(var(--rgb-disabled-color));
--tile-icon-color: var(--disabled-color);
--mdc-icon-size: 24px;
}
.shape::before {

View File

@@ -1,14 +1,19 @@
import { CSSResultGroup, html, css, LitElement, TemplateResult } from "lit";
import { customElement, property } from "lit/decorators";
import { ifDefined } from "lit/directives/if-defined";
@customElement("ha-tile-image")
export class HaTileImage extends LitElement {
@property() public imageUrl?: string;
@property() public imageAlt?: string;
protected render(): TemplateResult {
return html`
<div class="image">
${this.imageUrl ? html`<img src=${this.imageUrl} />` : null}
${this.imageUrl
? html`<img alt=${ifDefined(this.imageAlt)} src=${this.imageUrl} />`
: null}
</div>
`;
}

View File

@@ -47,13 +47,10 @@ export class HaTileSlider extends LitElement {
static get styles(): CSSResultGroup {
return css`
ha-bar-slider {
--slider-bar-color: var(
--tile-slider-color,
rgb(var(--rgb-primary-color))
);
--slider-bar-color: var(--tile-slider-color, var(--primary-color));
--slider-bar-background: var(
--tile-slider-background,
rgb(var(--rgb-disabled-color))
var(--disabled-color)
);
--slider-bar-background-opacity: var(
--tile-slider-background-opacity,

View File

@@ -10,6 +10,7 @@ export interface AreaRegistryEntry {
area_id: string;
name: string;
picture: string | null;
aliases: string[];
}
export interface AreaEntityLookup {
@@ -23,6 +24,7 @@ export interface AreaDeviceLookup {
export interface AreaRegistryEntryMutableParams {
name: string;
picture?: string | null;
aliases?: string[];
}
export const createAreaRegistryEntry = (

View File

@@ -8,7 +8,7 @@ import { BlueprintInput } from "./blueprint";
import { DeviceCondition, DeviceTrigger } from "./device_automation";
import { Action, MODES } from "./script";
export const AUTOMATION_DEFAULT_MODE: typeof MODES[number] = "single";
export const AUTOMATION_DEFAULT_MODE: (typeof MODES)[number] = "single";
export const AUTOMATION_DEFAULT_MAX = 10;
export interface AutomationEntity extends HassEntityBase {
@@ -29,7 +29,7 @@ export interface ManualAutomationConfig {
trigger: Trigger | Trigger[];
condition?: Condition | Condition[];
action: Action | Action[];
mode?: typeof MODES[number];
mode?: (typeof MODES)[number];
max?: number;
max_exceeded?:
| "silent"

View File

@@ -1,200 +0,0 @@
import { LocalizeFunc } from "../common/translations/localize";
import { HomeAssistant } from "../types";
import {
computeHistory,
HistoryStates,
HistoryResult,
LineChartUnit,
TimelineEntity,
entityIdHistoryNeedsAttributes,
fetchRecentWS,
} from "./history";
export interface CacheConfig {
cacheKey: string;
hoursToShow: number;
}
interface CachedResults {
prom: Promise<HistoryResult>;
startTime: Date;
endTime: Date;
language: string;
data: HistoryResult;
}
const stateHistoryCache: { [cacheKey: string]: CachedResults } = {};
// Cache type 2 functionality
function getEmptyCache(
language: string,
startTime: Date,
endTime: Date
): CachedResults {
return {
prom: Promise.resolve({ line: [], timeline: [] }),
language,
startTime,
endTime,
data: { line: [], timeline: [] },
};
}
export const getRecentWithCache = (
hass: HomeAssistant,
entityIds: string[],
cacheConfig: CacheConfig,
localize: LocalizeFunc,
language: string
) => {
const cacheKey = cacheConfig.cacheKey;
const fullCacheKey = cacheKey + `_${cacheConfig.hoursToShow}`;
const endTime = new Date();
const startTime = new Date(endTime);
startTime.setHours(startTime.getHours() - cacheConfig.hoursToShow);
let toFetchStartTime = startTime;
let appendingToCache = false;
let cache = stateHistoryCache[fullCacheKey];
if (
cache &&
toFetchStartTime >= cache.startTime &&
toFetchStartTime <= cache.endTime &&
cache.language === language
) {
toFetchStartTime = cache.endTime;
appendingToCache = true;
// This pretty much never happens as endTime is usually set to now
if (endTime <= cache.endTime) {
return cache.prom;
}
} else {
cache = stateHistoryCache[fullCacheKey] = getEmptyCache(
language,
startTime,
endTime
);
}
const curCacheProm = cache.prom;
const noAttributes = !entityIds.some((entityId) =>
entityIdHistoryNeedsAttributes(hass, entityId)
);
const genProm = async () => {
let fetchedHistory: HistoryStates;
try {
const results = await Promise.all([
curCacheProm,
fetchRecentWS(
hass,
entityIds,
toFetchStartTime,
endTime,
appendingToCache,
undefined,
true,
noAttributes
),
]);
fetchedHistory = results[1];
} catch (err: any) {
delete stateHistoryCache[fullCacheKey];
throw err;
}
const stateHistory = computeHistory(hass, fetchedHistory, localize);
if (appendingToCache) {
if (stateHistory.line.length) {
mergeLine(stateHistory.line, cache.data.line);
}
if (stateHistory.timeline.length) {
mergeTimeline(stateHistory.timeline, cache.data.timeline);
// Replace the timeline array to force an update
cache.data.timeline = [...cache.data.timeline];
}
pruneStartTime(startTime, cache.data);
} else {
cache.data = stateHistory;
}
return cache.data;
};
cache.prom = genProm();
cache.startTime = startTime;
cache.endTime = endTime;
return cache.prom;
};
const mergeLine = (
historyLines: LineChartUnit[],
cacheLines: LineChartUnit[]
) => {
historyLines.forEach((line) => {
const unit = line.unit;
const oldLine = cacheLines.find((cacheLine) => cacheLine.unit === unit);
if (oldLine) {
line.data.forEach((entity) => {
const oldEntity = oldLine.data.find(
(cacheEntity) => entity.entity_id === cacheEntity.entity_id
);
if (oldEntity) {
oldEntity.states = oldEntity.states.concat(entity.states);
} else {
oldLine.data.push(entity);
}
});
// Replace the cached line data to force an update
oldLine.data = [...oldLine.data];
} else {
cacheLines.push(line);
}
});
};
const mergeTimeline = (
historyTimelines: TimelineEntity[],
cacheTimelines: TimelineEntity[]
) => {
historyTimelines.forEach((timeline) => {
const oldTimeline = cacheTimelines.find(
(cacheTimeline) => cacheTimeline.entity_id === timeline.entity_id
);
if (oldTimeline) {
oldTimeline.data = oldTimeline.data.concat(timeline.data);
} else {
cacheTimelines.push(timeline);
}
});
};
const pruneArray = (originalStartTime: Date, arr) => {
if (arr.length === 0) {
return arr;
}
const changedAfterStartTime = arr.findIndex(
(state) => new Date(state.last_changed) > originalStartTime
);
if (changedAfterStartTime === 0) {
// If all changes happened after originalStartTime then we are done.
return arr;
}
// If all changes happened at or before originalStartTime. Use last index.
const updateIndex =
changedAfterStartTime === -1 ? arr.length - 1 : changedAfterStartTime - 1;
arr[updateIndex].last_changed = originalStartTime;
return arr.slice(updateIndex);
};
const pruneStartTime = (originalStartTime: Date, cacheData: HistoryResult) => {
cacheData.line.forEach((line) => {
line.data.forEach((entity) => {
entity.states = pruneArray(originalStartTime, entity.states);
});
});
cacheData.timeline.forEach((timeline) => {
timeline.data = pruneArray(originalStartTime, timeline.data);
});
};

View File

@@ -72,3 +72,12 @@ const hvacModeOrdering: { [key in HvacMode]: number } = {
export const compareClimateHvacModes = (mode1: HvacMode, mode2: HvacMode) =>
hvacModeOrdering[mode1] - hvacModeOrdering[mode2];
export const HVAC_ACTION_TO_MODE: Record<HvacAction, HvacMode> = {
cooling: "cool",
drying: "dry",
fan: "fan_only",
heating: "heat",
idle: "off",
off: "off",
};

View File

@@ -54,7 +54,6 @@ interface ConversationResult {
export interface AgentInfo {
attribution?: { name: string; url: string };
onboarding?: { text: string; url: string };
}
export const processConversationInput = (
@@ -76,11 +75,11 @@ export const getAgentInfo = (hass: HomeAssistant): Promise<AgentInfo> =>
type: "conversation/agent/info",
});
export const setConversationOnboarding = (
export const prepareConversation = (
hass: HomeAssistant,
value: boolean
): Promise<boolean> =>
language?: string
): Promise<void> =>
hass.callWS({
type: "conversation/onboarding/set",
shown: value,
type: "conversation/prepare",
language,
});

View File

@@ -186,8 +186,8 @@ export interface EnergyInfo {
export interface EnergyValidationIssue {
type: string;
identifier: string;
value?: unknown;
affected_entities: [string, unknown][];
translation_placeholders: Record<string, string>;
}
export interface EnergyPreferencesValidation {
@@ -200,10 +200,12 @@ export const getEnergyInfo = (hass: HomeAssistant) =>
type: "energy/info",
});
export const getEnergyPreferenceValidation = (hass: HomeAssistant) =>
hass.callWS<EnergyPreferencesValidation>({
export const getEnergyPreferenceValidation = async (hass: HomeAssistant) => {
await hass.loadBackendTranslation("issues", "energy");
return hass.callWS<EnergyPreferencesValidation>({
type: "energy/validate",
});
};
export const getEnergyPreferences = (hass: HomeAssistant) =>
hass.callWS<EnergyPreferences>({
@@ -669,7 +671,7 @@ export const getEnergySolarForecasts = (hass: HomeAssistant) =>
});
const energyGasUnitClass = ["volume", "energy"] as const;
export type EnergyGasUnitClass = typeof energyGasUnitClass[number];
export type EnergyGasUnitClass = (typeof energyGasUnitClass)[number];
export const getEnergyGasUnitClass = (
prefs: EnergyPreferences,

Some files were not shown because too many files have changed in this diff Show More