mirror of
https://github.com/home-assistant/core.git
synced 2026-04-21 09:01:10 +02:00
Compare commits
426 Commits
2025.5.3
...
epenet-202
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0dd090ba20 | ||
|
|
864882750d | ||
|
|
594769aa95 | ||
|
|
9729f1f38b | ||
|
|
6bc6733c40 | ||
|
|
b1ffcb4245 | ||
|
|
f0c5fbfb8a | ||
|
|
c76239806d | ||
|
|
6d809b0b5a | ||
|
|
de2cbb7f5c | ||
|
|
cd61f37df7 | ||
|
|
26796f87cd | ||
|
|
e2dd897ac7 | ||
|
|
3bbe4baaf7 | ||
|
|
d409b86217 | ||
|
|
7928c15849 | ||
|
|
d197debbc0 | ||
|
|
55b9dee448 | ||
|
|
5c6984d326 | ||
|
|
a7787d6080 | ||
|
|
2db60340c2 | ||
|
|
c121631fef | ||
|
|
b0fb16d48d | ||
|
|
3e07f6543e | ||
|
|
d4c2356c70 | ||
|
|
eec617b391 | ||
|
|
b15c9ad130 | ||
|
|
0128d85999 | ||
|
|
e69ca0cf80 | ||
|
|
0719753be3 | ||
|
|
ba3181d4e7 | ||
|
|
e58750555e | ||
|
|
026687299d | ||
|
|
3eed552c56 | ||
|
|
15a4514c7d | ||
|
|
b5445c0061 | ||
|
|
1d0584a90d | ||
|
|
158b795c70 | ||
|
|
4994229215 | ||
|
|
c022c32d2f | ||
|
|
d2ef3ca100 | ||
|
|
00faadcfea | ||
|
|
a6ff52b300 | ||
|
|
da0d65ca5b | ||
|
|
2266e97417 | ||
|
|
d471de5645 | ||
|
|
38674f0dc2 | ||
|
|
b192ca4bad | ||
|
|
73a59523f5 | ||
|
|
05324dedd0 | ||
|
|
f1e5f73d7e | ||
|
|
7b23f21712 | ||
|
|
4dde314338 | ||
|
|
cba12fb598 | ||
|
|
63e38b4d8d | ||
|
|
7eded95315 | ||
|
|
e493fe1105 | ||
|
|
646c230940 | ||
|
|
5276a3688e | ||
|
|
0616bf16f4 | ||
|
|
fbe1811e2b | ||
|
|
2333c10915 | ||
|
|
77e9142722 | ||
|
|
943998e57e | ||
|
|
58802b71c4 | ||
|
|
ca89aa7a94 | ||
|
|
4faa920318 | ||
|
|
b394c07a3d | ||
|
|
554cb27703 | ||
|
|
80a04314fc | ||
|
|
6516cd388f | ||
|
|
4f6141581e | ||
|
|
597c386bc2 | ||
|
|
494c7aa3da | ||
|
|
8840970d64 | ||
|
|
867624fc59 | ||
|
|
ea4120a7d4 | ||
|
|
158bbf1f52 | ||
|
|
61f8970aca | ||
|
|
6f41fbeb22 | ||
|
|
a540c62594 | ||
|
|
3e6a216806 | ||
|
|
85535b2cbd | ||
|
|
05796dcd51 | ||
|
|
40e2c7b9b7 | ||
|
|
d0fe7de501 | ||
|
|
0dadd31221 | ||
|
|
09515bf174 | ||
|
|
773a2a9db6 | ||
|
|
31a576b206 | ||
|
|
58161b5fa2 | ||
|
|
ebb61caa53 | ||
|
|
54a7691a80 | ||
|
|
996839cb67 | ||
|
|
e065f1e097 | ||
|
|
882565a8e5 | ||
|
|
4501303beb | ||
|
|
1416580f8b | ||
|
|
5e58032745 | ||
|
|
86cf01a901 | ||
|
|
45c0a19a68 | ||
|
|
35ab2a21d6 | ||
|
|
977d2fe8b3 | ||
|
|
626f8a9166 | ||
|
|
1654249dab | ||
|
|
5fadc56475 | ||
|
|
2bce697aa7 | ||
|
|
970edbed40 | ||
|
|
131ba3cdef | ||
|
|
85f1c89808 | ||
|
|
2940cb0fa0 | ||
|
|
ba8d40f7d3 | ||
|
|
cac0e0f6e8 | ||
|
|
ad7cfe49c8 | ||
|
|
e29fc37bb1 | ||
|
|
e892744328 | ||
|
|
356775c19b | ||
|
|
87bd6e3ca0 | ||
|
|
ad6f66c945 | ||
|
|
9537229c92 | ||
|
|
c18b6d736a | ||
|
|
a7afeb078c | ||
|
|
9a2f17c2b2 | ||
|
|
4cecb6c851 | ||
|
|
b6c4b06fc7 | ||
|
|
3e0e807c96 | ||
|
|
7dad6ebe67 | ||
|
|
75b8cb19cf | ||
|
|
bd28452807 | ||
|
|
ed6cfa42f0 | ||
|
|
763f2bcfcc | ||
|
|
9e3684b001 | ||
|
|
93fd82d1fa | ||
|
|
9757009d8f | ||
|
|
920d281d45 | ||
|
|
d2bdc85a7b | ||
|
|
1f84c5e1f1 | ||
|
|
a93bf3c150 | ||
|
|
7bad07ac10 | ||
|
|
af019144e5 | ||
|
|
e69b3ebf1e | ||
|
|
4271d3f32f | ||
|
|
d6e5fdceb7 | ||
|
|
c4ceb4759a | ||
|
|
6350ed3415 | ||
|
|
031b25cd1e | ||
|
|
47455fee41 | ||
|
|
9abb4ffc97 | ||
|
|
90a7ecdce3 | ||
|
|
a84b8b49f3 | ||
|
|
ff6f213664 | ||
|
|
e4b686bc43 | ||
|
|
307bb05653 | ||
|
|
b4ae08f83d | ||
|
|
21e2bbd066 | ||
|
|
0d85cec770 | ||
|
|
a1e6f596d7 | ||
|
|
eab1d5717f | ||
|
|
19b1dc8d65 | ||
|
|
2c8e33558e | ||
|
|
7287f302f6 | ||
|
|
1342dc142c | ||
|
|
96a8902365 | ||
|
|
d1b85cd452 | ||
|
|
8977458e48 | ||
|
|
a37f8b1f4e | ||
|
|
bdf4a21976 | ||
|
|
1322d54371 | ||
|
|
fbe63e8d03 | ||
|
|
6b2a4c975c | ||
|
|
b1392e1fc8 | ||
|
|
7100481abc | ||
|
|
4c43640d0d | ||
|
|
42f53ff917 | ||
|
|
e0fb612e82 | ||
|
|
d13f9be9d8 | ||
|
|
2396b1e73c | ||
|
|
374b3ac6c6 | ||
|
|
5df09c4f13 | ||
|
|
337c64d69d | ||
|
|
34dbd1fb10 | ||
|
|
7ee9f0af2d | ||
|
|
cb6847b64c | ||
|
|
04867f6ecc | ||
|
|
9e94e94075 | ||
|
|
014c5dc764 | ||
|
|
a1599d5f7d | ||
|
|
2fd678bb59 | ||
|
|
3c4c3dc08e | ||
|
|
bbc3862fec | ||
|
|
678e25d0b1 | ||
|
|
a6f91177b6 | ||
|
|
ff637ef046 | ||
|
|
1cb813e0c5 | ||
|
|
ce4e51078f | ||
|
|
066d0f4143 | ||
|
|
1294918f5b | ||
|
|
4a556f89aa | ||
|
|
e74a29c87a | ||
|
|
50d57852a6 | ||
|
|
744d5f7bd4 | ||
|
|
0b0a239ed4 | ||
|
|
4cc538b5ae | ||
|
|
f5c67e2fd1 | ||
|
|
9ec5d90f4d | ||
|
|
e1344fca6c | ||
|
|
e290829bc0 | ||
|
|
dc0998d95d | ||
|
|
5456cd0ac1 | ||
|
|
1ce44800ab | ||
|
|
c26b3f519a | ||
|
|
2f7fcb4f5e | ||
|
|
c4e4c52c6c | ||
|
|
e6912b94df | ||
|
|
704e4221f7 | ||
|
|
48a2dde16b | ||
|
|
293e01f2e9 | ||
|
|
e2820787bf | ||
|
|
ed1eea9b50 | ||
|
|
f7d8e4e7b9 | ||
|
|
a2ab28286f | ||
|
|
99f55665a5 | ||
|
|
0aa817e300 | ||
|
|
4cdb7a9887 | ||
|
|
92a19357d3 | ||
|
|
dded1305ec | ||
|
|
d6e85eef48 | ||
|
|
0b1875de14 | ||
|
|
c5ef8659a7 | ||
|
|
9a332f19c2 | ||
|
|
65ad39f5be | ||
|
|
358d904c2c | ||
|
|
65278100a0 | ||
|
|
dbffd8c0ff | ||
|
|
2a25dcd44e | ||
|
|
6e7f57383a | ||
|
|
946172d530 | ||
|
|
2791329460 | ||
|
|
320df710a4 | ||
|
|
76df7de0cf | ||
|
|
da7e9f3ab6 | ||
|
|
a673bd7a91 | ||
|
|
121e9e4e7f | ||
|
|
452e946509 | ||
|
|
c3ce82d874 | ||
|
|
253217958b | ||
|
|
1447392847 | ||
|
|
32a6b8a0f8 | ||
|
|
0ec7dc5654 | ||
|
|
bdf6f7f590 | ||
|
|
fbae79fab2 | ||
|
|
2c34712069 | ||
|
|
40e3038775 | ||
|
|
e2c02706a0 | ||
|
|
313be7b30a | ||
|
|
d0ed8b67c4 | ||
|
|
deaaf2f082 | ||
|
|
ce95876d03 | ||
|
|
5475d7ef58 | ||
|
|
687c74ee4c | ||
|
|
c9a9488ff5 | ||
|
|
57217b46ed | ||
|
|
5a01521ff8 | ||
|
|
19a0a16915 | ||
|
|
62877c2c58 | ||
|
|
9479874bb4 | ||
|
|
241b6a0170 | ||
|
|
babc183834 | ||
|
|
f3371bcf39 | ||
|
|
33da5465bd | ||
|
|
5df3a9d76d | ||
|
|
ec4f4a4a1f | ||
|
|
46df29b390 | ||
|
|
60846434d3 | ||
|
|
66c86c0461 | ||
|
|
73996fb916 | ||
|
|
0edfbded23 | ||
|
|
212c3ddcca | ||
|
|
edcb090209 | ||
|
|
92010e1fca | ||
|
|
12f9a11716 | ||
|
|
0dd21f4c89 | ||
|
|
14f967cdd0 | ||
|
|
f3b23afc92 | ||
|
|
0bf807b96e | ||
|
|
1879b8c27f | ||
|
|
e3ed9fac78 | ||
|
|
b98a27d3d0 | ||
|
|
c73383ded3 | ||
|
|
36a08d04c5 | ||
|
|
8a95fffbab | ||
|
|
633c770a48 | ||
|
|
826d28974b | ||
|
|
135df5a24e | ||
|
|
2e8e13bffb | ||
|
|
5e8def837e | ||
|
|
14735cce26 | ||
|
|
d775e443f8 | ||
|
|
aa8dfa760d | ||
|
|
0043b18135 | ||
|
|
c14ddedfae | ||
|
|
a073a6b01e | ||
|
|
0713ac4977 | ||
|
|
3390dc0dbb | ||
|
|
445b38f25d | ||
|
|
9e4a20c267 | ||
|
|
d88cd72d13 | ||
|
|
66b2e06cd3 | ||
|
|
58906008b9 | ||
|
|
aa062515b8 | ||
|
|
65da1e79b9 | ||
|
|
41ecb24135 | ||
|
|
e3b3c32751 | ||
|
|
e2a8137140 | ||
|
|
fa6a2f08ab | ||
|
|
68d62ab58e | ||
|
|
c6b9a40234 | ||
|
|
e0916fdd26 | ||
|
|
cad2d72ed9 | ||
|
|
8eaddbf2b2 | ||
|
|
9b30f32cad | ||
|
|
c2a69bcb20 | ||
|
|
2e7b60c3ca | ||
|
|
eca811d0d4 | ||
|
|
8e202bc202 | ||
|
|
429682cecd | ||
|
|
9cd2080de2 | ||
|
|
2960271b81 | ||
|
|
8048d2bfb8 | ||
|
|
490bb46a82 | ||
|
|
1199353204 | ||
|
|
2c368c79d1 | ||
|
|
095318114b | ||
|
|
9e388f5b13 | ||
|
|
87fab1fa14 | ||
|
|
8046684179 | ||
|
|
5a475ec7ea | ||
|
|
8c6edd8b81 | ||
|
|
de496c693e | ||
|
|
cb37d4d36a | ||
|
|
2aa82da615 | ||
|
|
04982f5e12 | ||
|
|
b9e11b0f45 | ||
|
|
1e0d1c46ab | ||
|
|
b5d499dda8 | ||
|
|
d1615f9a6e | ||
|
|
516a3c0504 | ||
|
|
2a5c0d9b88 | ||
|
|
a15a3c12d5 | ||
|
|
a6131b3ebf | ||
|
|
b9aadb252f | ||
|
|
1264c2cbfa | ||
|
|
716b559e5d | ||
|
|
30e4264aa9 | ||
|
|
fb94f8ea18 | ||
|
|
aea5760424 | ||
|
|
debec3bfbc | ||
|
|
4122f94fb6 | ||
|
|
b48a2cf2b5 | ||
|
|
0ca9ad1cc0 | ||
|
|
ee555a3700 | ||
|
|
a2bc3e3908 | ||
|
|
64b7f2c285 | ||
|
|
db2435dc36 | ||
|
|
1d500fda67 | ||
|
|
558b0ec3b1 | ||
|
|
9780db1c22 | ||
|
|
5e39fb6da1 | ||
|
|
4450f919c3 | ||
|
|
3183bb78ff | ||
|
|
e74f918382 | ||
|
|
247d2e7efd | ||
|
|
32b7edb608 | ||
|
|
df4297be62 | ||
|
|
4c2e9fc759 | ||
|
|
2890fc7dd2 | ||
|
|
97be2c4ac9 | ||
|
|
762d284102 | ||
|
|
4967c287f8 | ||
|
|
5e463d6af4 | ||
|
|
cbf4676ae4 | ||
|
|
81444c8f4a | ||
|
|
9861bd88b9 | ||
|
|
b0f1c71129 | ||
|
|
86b845f04a | ||
|
|
3af0d6e484 | ||
|
|
fca62f1ae8 | ||
|
|
4e8d68a2ef | ||
|
|
883ab44437 | ||
|
|
abd17d9af9 | ||
|
|
a906a1754e | ||
|
|
255beafe08 | ||
|
|
e2679004a1 | ||
|
|
06bb692522 | ||
|
|
71599b8e75 | ||
|
|
79f8bea48d | ||
|
|
82b335a2c1 | ||
|
|
361d93eb96 | ||
|
|
bab699eb0c | ||
|
|
b8881ed85b | ||
|
|
4013b418dd | ||
|
|
80d714b865 | ||
|
|
7fcad580cb | ||
|
|
60b6ff4064 | ||
|
|
24252edf38 | ||
|
|
79aa7aacec | ||
|
|
92944fa509 | ||
|
|
c0f0a4a1ac | ||
|
|
a084b9fdde | ||
|
|
83b9b8b032 | ||
|
|
bc47049d42 | ||
|
|
17360ede28 | ||
|
|
f441f4d7c0 | ||
|
|
5ddc449247 | ||
|
|
dd8d714c94 | ||
|
|
c2079ddf6f | ||
|
|
5250590b17 | ||
|
|
93f4f14b2a | ||
|
|
ba712ed514 | ||
|
|
6e76ca0fb3 | ||
|
|
b0345cce68 | ||
|
|
c4eddc8d11 | ||
|
|
7d89804a87 | ||
|
|
b92f718e08 | ||
|
|
ad0209a4a0 | ||
|
|
d23d25c6b7 |
60
.github/workflows/ci.yaml
vendored
60
.github/workflows/ci.yaml
vendored
@@ -37,10 +37,10 @@ on:
|
||||
type: boolean
|
||||
|
||||
env:
|
||||
CACHE_VERSION: 12
|
||||
CACHE_VERSION: 2
|
||||
UV_CACHE_VERSION: 1
|
||||
MYPY_CACHE_VERSION: 9
|
||||
HA_SHORT_VERSION: "2025.5"
|
||||
MYPY_CACHE_VERSION: 1
|
||||
HA_SHORT_VERSION: "2025.6"
|
||||
DEFAULT_PYTHON: "3.13"
|
||||
ALL_PYTHON_VERSIONS: "['3.13']"
|
||||
# 10.3 is the oldest supported version
|
||||
@@ -259,7 +259,7 @@ jobs:
|
||||
with:
|
||||
path: venv
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-venv-${{
|
||||
needs.info.outputs.pre-commit_cache_key }}
|
||||
- name: Create Python virtual environment
|
||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||
@@ -276,7 +276,7 @@ jobs:
|
||||
path: ${{ env.PRE_COMMIT_CACHE }}
|
||||
lookup-only: true
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-${{
|
||||
needs.info.outputs.pre-commit_cache_key }}
|
||||
- name: Install pre-commit dependencies
|
||||
if: steps.cache-precommit.outputs.cache-hit != 'true'
|
||||
@@ -306,7 +306,7 @@ jobs:
|
||||
path: venv
|
||||
fail-on-cache-miss: true
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-venv-${{
|
||||
needs.info.outputs.pre-commit_cache_key }}
|
||||
- name: Restore pre-commit environment from cache
|
||||
id: cache-precommit
|
||||
@@ -315,7 +315,7 @@ jobs:
|
||||
path: ${{ env.PRE_COMMIT_CACHE }}
|
||||
fail-on-cache-miss: true
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-${{
|
||||
needs.info.outputs.pre-commit_cache_key }}
|
||||
- name: Run ruff-format
|
||||
run: |
|
||||
@@ -346,7 +346,7 @@ jobs:
|
||||
path: venv
|
||||
fail-on-cache-miss: true
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-venv-${{
|
||||
needs.info.outputs.pre-commit_cache_key }}
|
||||
- name: Restore pre-commit environment from cache
|
||||
id: cache-precommit
|
||||
@@ -355,7 +355,7 @@ jobs:
|
||||
path: ${{ env.PRE_COMMIT_CACHE }}
|
||||
fail-on-cache-miss: true
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-${{
|
||||
needs.info.outputs.pre-commit_cache_key }}
|
||||
- name: Run ruff
|
||||
run: |
|
||||
@@ -386,7 +386,7 @@ jobs:
|
||||
path: venv
|
||||
fail-on-cache-miss: true
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-venv-${{
|
||||
needs.info.outputs.pre-commit_cache_key }}
|
||||
- name: Restore pre-commit environment from cache
|
||||
id: cache-precommit
|
||||
@@ -395,7 +395,7 @@ jobs:
|
||||
path: ${{ env.PRE_COMMIT_CACHE }}
|
||||
fail-on-cache-miss: true
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-${{
|
||||
needs.info.outputs.pre-commit_cache_key }}
|
||||
|
||||
- name: Register yamllint problem matcher
|
||||
@@ -501,7 +501,7 @@ jobs:
|
||||
with:
|
||||
path: venv
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-${{
|
||||
needs.info.outputs.python_cache_key }}
|
||||
- name: Restore uv wheel cache
|
||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||
@@ -509,10 +509,10 @@ jobs:
|
||||
with:
|
||||
path: ${{ env.UV_CACHE_DIR }}
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-${{
|
||||
steps.generate-uv-key.outputs.key }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-uv-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-uv-${{
|
||||
env.UV_CACHE_VERSION }}-${{ steps.generate-uv-key.outputs.version }}-${{
|
||||
env.HA_SHORT_VERSION }}-
|
||||
- name: Install additional OS dependencies
|
||||
@@ -598,7 +598,7 @@ jobs:
|
||||
path: venv
|
||||
fail-on-cache-miss: true
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-${{
|
||||
needs.info.outputs.python_cache_key }}
|
||||
- name: Run hassfest
|
||||
run: |
|
||||
@@ -631,7 +631,7 @@ jobs:
|
||||
path: venv
|
||||
fail-on-cache-miss: true
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-${{
|
||||
needs.info.outputs.python_cache_key }}
|
||||
- name: Run gen_requirements_all.py
|
||||
run: |
|
||||
@@ -653,7 +653,7 @@ jobs:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.2.2
|
||||
- name: Dependency review
|
||||
uses: actions/dependency-review-action@v4.6.0
|
||||
uses: actions/dependency-review-action@v4.7.0
|
||||
with:
|
||||
license-check: false # We use our own license audit checks
|
||||
|
||||
@@ -688,7 +688,7 @@ jobs:
|
||||
path: venv
|
||||
fail-on-cache-miss: true
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-${{
|
||||
needs.info.outputs.python_cache_key }}
|
||||
- name: Extract license data
|
||||
run: |
|
||||
@@ -731,7 +731,7 @@ jobs:
|
||||
path: venv
|
||||
fail-on-cache-miss: true
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-${{
|
||||
needs.info.outputs.python_cache_key }}
|
||||
- name: Register pylint problem matcher
|
||||
run: |
|
||||
@@ -778,7 +778,7 @@ jobs:
|
||||
path: venv
|
||||
fail-on-cache-miss: true
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-${{
|
||||
needs.info.outputs.python_cache_key }}
|
||||
- name: Register pylint problem matcher
|
||||
run: |
|
||||
@@ -830,17 +830,17 @@ jobs:
|
||||
path: venv
|
||||
fail-on-cache-miss: true
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-${{
|
||||
needs.info.outputs.python_cache_key }}
|
||||
- name: Restore mypy cache
|
||||
uses: actions/cache@v4.2.3
|
||||
with:
|
||||
path: .mypy_cache
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-${{
|
||||
steps.generate-mypy-key.outputs.key }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-mypy-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-mypy-${{
|
||||
env.MYPY_CACHE_VERSION }}-${{ steps.generate-mypy-key.outputs.version }}-${{
|
||||
env.HA_SHORT_VERSION }}-
|
||||
- name: Register mypy problem matcher
|
||||
@@ -900,7 +900,7 @@ jobs:
|
||||
path: venv
|
||||
fail-on-cache-miss: true
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-${{
|
||||
needs.info.outputs.python_cache_key }}
|
||||
- name: Run split_tests.py
|
||||
run: |
|
||||
@@ -959,7 +959,8 @@ jobs:
|
||||
with:
|
||||
path: venv
|
||||
fail-on-cache-miss: true
|
||||
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
key: >-
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-${{
|
||||
needs.info.outputs.python_cache_key }}
|
||||
- name: Register Python problem matcher
|
||||
run: |
|
||||
@@ -1084,7 +1085,8 @@ jobs:
|
||||
with:
|
||||
path: venv
|
||||
fail-on-cache-miss: true
|
||||
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
key: >-
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-${{
|
||||
needs.info.outputs.python_cache_key }}
|
||||
- name: Register Python problem matcher
|
||||
run: |
|
||||
@@ -1218,7 +1220,8 @@ jobs:
|
||||
with:
|
||||
path: venv
|
||||
fail-on-cache-miss: true
|
||||
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
key: >-
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-${{
|
||||
needs.info.outputs.python_cache_key }}
|
||||
- name: Register Python problem matcher
|
||||
run: |
|
||||
@@ -1369,7 +1372,8 @@ jobs:
|
||||
with:
|
||||
path: venv
|
||||
fail-on-cache-miss: true
|
||||
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
key: >-
|
||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.python.outputs.python-version }}-${{
|
||||
needs.info.outputs.python_cache_key }}
|
||||
- name: Register Python problem matcher
|
||||
run: |
|
||||
|
||||
4
.github/workflows/codeql.yml
vendored
4
.github/workflows/codeql.yml
vendored
@@ -24,11 +24,11 @@ jobs:
|
||||
uses: actions/checkout@v4.2.2
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3.28.16
|
||||
uses: github/codeql-action/init@v3.28.17
|
||||
with:
|
||||
languages: python
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3.28.16
|
||||
uses: github/codeql-action/analyze@v3.28.17
|
||||
with:
|
||||
category: "/language:python"
|
||||
|
||||
@@ -332,6 +332,7 @@ homeassistant.components.media_player.*
|
||||
homeassistant.components.media_source.*
|
||||
homeassistant.components.met_eireann.*
|
||||
homeassistant.components.metoffice.*
|
||||
homeassistant.components.miele.*
|
||||
homeassistant.components.mikrotik.*
|
||||
homeassistant.components.min_max.*
|
||||
homeassistant.components.minecraft_server.*
|
||||
@@ -433,7 +434,6 @@ homeassistant.components.roku.*
|
||||
homeassistant.components.romy.*
|
||||
homeassistant.components.rpi_power.*
|
||||
homeassistant.components.rss_feed_template.*
|
||||
homeassistant.components.rtsp_to_webrtc.*
|
||||
homeassistant.components.russound_rio.*
|
||||
homeassistant.components.ruuvi_gateway.*
|
||||
homeassistant.components.ruuvitag_ble.*
|
||||
|
||||
20
CODEOWNERS
generated
20
CODEOWNERS
generated
@@ -46,8 +46,8 @@ build.json @home-assistant/supervisor
|
||||
/tests/components/accuweather/ @bieniu
|
||||
/homeassistant/components/acmeda/ @atmurray
|
||||
/tests/components/acmeda/ @atmurray
|
||||
/homeassistant/components/adax/ @danielhiversen
|
||||
/tests/components/adax/ @danielhiversen
|
||||
/homeassistant/components/adax/ @danielhiversen @lazytarget
|
||||
/tests/components/adax/ @danielhiversen @lazytarget
|
||||
/homeassistant/components/adguard/ @frenck
|
||||
/tests/components/adguard/ @frenck
|
||||
/homeassistant/components/ads/ @mrpasztoradam
|
||||
@@ -455,8 +455,8 @@ build.json @home-assistant/supervisor
|
||||
/tests/components/evil_genius_labs/ @balloob
|
||||
/homeassistant/components/evohome/ @zxdavb
|
||||
/tests/components/evohome/ @zxdavb
|
||||
/homeassistant/components/ezviz/ @RenierM26 @baqs
|
||||
/tests/components/ezviz/ @RenierM26 @baqs
|
||||
/homeassistant/components/ezviz/ @RenierM26
|
||||
/tests/components/ezviz/ @RenierM26
|
||||
/homeassistant/components/faa_delays/ @ntilley905
|
||||
/tests/components/faa_delays/ @ntilley905
|
||||
/homeassistant/components/fan/ @home-assistant/core
|
||||
@@ -1111,8 +1111,8 @@ build.json @home-assistant/supervisor
|
||||
/tests/components/opentherm_gw/ @mvn23
|
||||
/homeassistant/components/openuv/ @bachya
|
||||
/tests/components/openuv/ @bachya
|
||||
/homeassistant/components/openweathermap/ @fabaff @freekode @nzapponi
|
||||
/tests/components/openweathermap/ @fabaff @freekode @nzapponi
|
||||
/homeassistant/components/openweathermap/ @fabaff @freekode @nzapponi @wittypluck
|
||||
/tests/components/openweathermap/ @fabaff @freekode @nzapponi @wittypluck
|
||||
/homeassistant/components/opnsense/ @mtreinish
|
||||
/tests/components/opnsense/ @mtreinish
|
||||
/homeassistant/components/opower/ @tronikos
|
||||
@@ -1307,8 +1307,6 @@ build.json @home-assistant/supervisor
|
||||
/tests/components/rpi_power/ @shenxn @swetoast
|
||||
/homeassistant/components/rss_feed_template/ @home-assistant/core
|
||||
/tests/components/rss_feed_template/ @home-assistant/core
|
||||
/homeassistant/components/rtsp_to_webrtc/ @allenporter
|
||||
/tests/components/rtsp_to_webrtc/ @allenporter
|
||||
/homeassistant/components/ruckus_unleashed/ @lanrat @ms264556 @gabe565
|
||||
/tests/components/ruckus_unleashed/ @lanrat @ms264556 @gabe565
|
||||
/homeassistant/components/russound_rio/ @noahhusby
|
||||
@@ -1500,8 +1498,8 @@ build.json @home-assistant/supervisor
|
||||
/tests/components/switch_as_x/ @home-assistant/core
|
||||
/homeassistant/components/switchbee/ @jafar-atili
|
||||
/tests/components/switchbee/ @jafar-atili
|
||||
/homeassistant/components/switchbot/ @danielhiversen @RenierM26 @murtas @Eloston @dsypniewski
|
||||
/tests/components/switchbot/ @danielhiversen @RenierM26 @murtas @Eloston @dsypniewski
|
||||
/homeassistant/components/switchbot/ @danielhiversen @RenierM26 @murtas @Eloston @dsypniewski @zerzhang
|
||||
/tests/components/switchbot/ @danielhiversen @RenierM26 @murtas @Eloston @dsypniewski @zerzhang
|
||||
/homeassistant/components/switchbot_cloud/ @SeraphicRav @laurence-presland @Gigatrappeur
|
||||
/tests/components/switchbot_cloud/ @SeraphicRav @laurence-presland @Gigatrappeur
|
||||
/homeassistant/components/switcher_kis/ @thecode @YogevBokobza
|
||||
@@ -1796,6 +1794,8 @@ build.json @home-assistant/supervisor
|
||||
/tests/components/zeversolar/ @kvanzuijlen
|
||||
/homeassistant/components/zha/ @dmulcahey @adminiuga @puddly @TheJulianJES
|
||||
/tests/components/zha/ @dmulcahey @adminiuga @puddly @TheJulianJES
|
||||
/homeassistant/components/zimi/ @markhannon
|
||||
/tests/components/zimi/ @markhannon
|
||||
/homeassistant/components/zodiac/ @JulienTant
|
||||
/tests/components/zodiac/ @JulienTant
|
||||
/homeassistant/components/zone/ @home-assistant/core
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"domain": "adax",
|
||||
"name": "Adax",
|
||||
"codeowners": ["@danielhiversen"],
|
||||
"codeowners": ["@danielhiversen", "@lazytarget"],
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/adax",
|
||||
"iot_class": "local_polling",
|
||||
|
||||
@@ -8,7 +8,7 @@ from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import AdvantageAirDataConfigEntry
|
||||
from .const import ADVANTAGE_AIR_STATE_ON, DOMAIN as ADVANTAGE_AIR_DOMAIN
|
||||
from .const import ADVANTAGE_AIR_STATE_ON, DOMAIN
|
||||
from .entity import AdvantageAirEntity, AdvantageAirThingEntity
|
||||
from .models import AdvantageAirData
|
||||
|
||||
@@ -52,8 +52,8 @@ class AdvantageAirLight(AdvantageAirEntity, LightEntity):
|
||||
self._id: str = light["id"]
|
||||
self._attr_unique_id += f"-{self._id}"
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(ADVANTAGE_AIR_DOMAIN, self._attr_unique_id)},
|
||||
via_device=(ADVANTAGE_AIR_DOMAIN, self.coordinator.data["system"]["rid"]),
|
||||
identifiers={(DOMAIN, self._attr_unique_id)},
|
||||
via_device=(DOMAIN, self.coordinator.data["system"]["rid"]),
|
||||
manufacturer="Advantage Air",
|
||||
model=light.get("moduleType"),
|
||||
name=light["name"],
|
||||
|
||||
@@ -6,7 +6,7 @@ from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import AdvantageAirDataConfigEntry
|
||||
from .const import DOMAIN as ADVANTAGE_AIR_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .entity import AdvantageAirEntity
|
||||
from .models import AdvantageAirData
|
||||
|
||||
@@ -32,9 +32,7 @@ class AdvantageAirApp(AdvantageAirEntity, UpdateEntity):
|
||||
"""Initialize the Advantage Air App."""
|
||||
super().__init__(instance)
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={
|
||||
(ADVANTAGE_AIR_DOMAIN, self.coordinator.data["system"]["rid"])
|
||||
},
|
||||
identifiers={(DOMAIN, self.coordinator.data["system"]["rid"])},
|
||||
manufacturer="Advantage Air",
|
||||
model=self.coordinator.data["system"]["sysType"],
|
||||
name=self.coordinator.data["system"]["name"],
|
||||
|
||||
@@ -10,7 +10,7 @@ from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
||||
from .const import DOMAIN as AGENT_DOMAIN, SERVER_URL
|
||||
from .const import DOMAIN, SERVER_URL
|
||||
|
||||
ATTRIBUTION = "ispyconnect.com"
|
||||
DEFAULT_BRAND = "Agent DVR by ispyconnect.com"
|
||||
@@ -46,7 +46,7 @@ async def async_setup_entry(
|
||||
|
||||
device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
identifiers={(AGENT_DOMAIN, agent_client.unique)},
|
||||
identifiers={(DOMAIN, agent_client.unique)},
|
||||
manufacturer="iSpyConnect",
|
||||
name=f"Agent {agent_client.name}",
|
||||
model="Agent DVR",
|
||||
|
||||
@@ -12,7 +12,7 @@ from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import AgentDVRConfigEntry
|
||||
from .const import DOMAIN as AGENT_DOMAIN
|
||||
from .const import DOMAIN
|
||||
|
||||
CONF_HOME_MODE_NAME = "home"
|
||||
CONF_AWAY_MODE_NAME = "away"
|
||||
@@ -47,7 +47,7 @@ class AgentBaseStation(AlarmControlPanelEntity):
|
||||
self._client = client
|
||||
self._attr_unique_id = f"{client.unique}_CP"
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(AGENT_DOMAIN, client.unique)},
|
||||
identifiers={(DOMAIN, client.unique)},
|
||||
name=f"{client.name} {CONST_ALARM_CONTROL_PANEL_NAME}",
|
||||
manufacturer="Agent",
|
||||
model=CONST_ALARM_CONTROL_PANEL_NAME,
|
||||
|
||||
@@ -3,6 +3,19 @@
|
||||
"name": "Airthings",
|
||||
"codeowners": ["@danielhiversen", "@LaStrada"],
|
||||
"config_flow": true,
|
||||
"dhcp": [
|
||||
{
|
||||
"hostname": "airthings-view"
|
||||
},
|
||||
{
|
||||
"hostname": "airthings-hub",
|
||||
"macaddress": "D0141190*"
|
||||
},
|
||||
{
|
||||
"hostname": "airthings-hub",
|
||||
"macaddress": "70B3D52A0*"
|
||||
}
|
||||
],
|
||||
"documentation": "https://www.home-assistant.io/integrations/airthings",
|
||||
"iot_class": "cloud_polling",
|
||||
"loggers": ["airthings"],
|
||||
|
||||
@@ -14,6 +14,7 @@ from homeassistant.const import (
|
||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
CONCENTRATION_PARTS_PER_BILLION,
|
||||
CONCENTRATION_PARTS_PER_MILLION,
|
||||
LIGHT_LUX,
|
||||
PERCENTAGE,
|
||||
SIGNAL_STRENGTH_DECIBELS,
|
||||
EntityCategory,
|
||||
@@ -78,6 +79,12 @@ SENSORS: dict[str, SensorEntityDescription] = {
|
||||
translation_key="light",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
"lux": SensorEntityDescription(
|
||||
key="lux",
|
||||
device_class=SensorDeviceClass.ILLUMINANCE,
|
||||
native_unit_of_measurement=LIGHT_LUX,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
"virusRisk": SensorEntityDescription(
|
||||
key="virusRisk",
|
||||
translation_key="virus_risk",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
"title": "Choose AlarmDecoder Protocol",
|
||||
"title": "Choose AlarmDecoder protocol",
|
||||
"data": {
|
||||
"protocol": "Protocol"
|
||||
}
|
||||
@@ -12,8 +12,8 @@
|
||||
"data": {
|
||||
"host": "[%key:common::config_flow::data::host%]",
|
||||
"port": "[%key:common::config_flow::data::port%]",
|
||||
"device_baudrate": "Device Baud Rate",
|
||||
"device_path": "Device Path"
|
||||
"device_baudrate": "Device baud rate",
|
||||
"device_path": "Device path"
|
||||
},
|
||||
"data_description": {
|
||||
"host": "The hostname or IP address of the AlarmDecoder device that is connected to your alarm panel.",
|
||||
@@ -44,36 +44,36 @@
|
||||
"arm_settings": {
|
||||
"title": "[%key:component::alarmdecoder::options::step::init::title%]",
|
||||
"data": {
|
||||
"auto_bypass": "Auto Bypass on Arm",
|
||||
"code_arm_required": "Code Required for Arming",
|
||||
"alt_night_mode": "Alternative Night Mode"
|
||||
"auto_bypass": "Auto-bypass on arm",
|
||||
"code_arm_required": "Code required for arming",
|
||||
"alt_night_mode": "Alternative night mode"
|
||||
}
|
||||
},
|
||||
"zone_select": {
|
||||
"title": "[%key:component::alarmdecoder::options::step::init::title%]",
|
||||
"description": "Enter the zone number you'd like to to add, edit, or remove.",
|
||||
"data": {
|
||||
"zone_number": "Zone Number"
|
||||
"zone_number": "Zone number"
|
||||
}
|
||||
},
|
||||
"zone_details": {
|
||||
"title": "[%key:component::alarmdecoder::options::step::init::title%]",
|
||||
"description": "Enter details for zone {zone_number}. To delete zone {zone_number}, leave Zone Name blank.",
|
||||
"description": "Enter details for zone {zone_number}. To delete zone {zone_number}, leave 'Zone name' blank.",
|
||||
"data": {
|
||||
"zone_name": "Zone Name",
|
||||
"zone_type": "Zone Type",
|
||||
"zone_rfid": "RF Serial",
|
||||
"zone_loop": "RF Loop",
|
||||
"zone_relayaddr": "Relay Address",
|
||||
"zone_relaychan": "Relay Channel"
|
||||
"zone_name": "Zone name",
|
||||
"zone_type": "Zone type",
|
||||
"zone_rfid": "RF serial",
|
||||
"zone_loop": "RF loop",
|
||||
"zone_relayaddr": "Relay address",
|
||||
"zone_relaychan": "Relay channel"
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"relay_inclusive": "Relay Address and Relay Channel are codependent and must be included together.",
|
||||
"relay_inclusive": "'Relay address' and 'Relay channel' are codependent and must be included together.",
|
||||
"int": "The field below must be an integer.",
|
||||
"loop_rfid": "RF Loop cannot be used without RF Serial.",
|
||||
"loop_range": "RF Loop must be an integer between 1 and 4."
|
||||
"loop_rfid": "'RF loop' cannot be used without 'RF serial'.",
|
||||
"loop_range": "'RF loop' must be an integer between 1 and 4."
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
},
|
||||
"step": {
|
||||
"validation": {
|
||||
"title": "Two factor authentication",
|
||||
"title": "Two-factor authentication",
|
||||
"data": {
|
||||
"verification_code": "Verification code"
|
||||
},
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
"user": {
|
||||
"description": "The inverter must be connected via an RS485 adaptor, please select serial port and the inverter's address as configured on the LCD panel",
|
||||
"data": {
|
||||
"port": "RS485 or USB-RS485 Adaptor Port",
|
||||
"address": "Inverter Address"
|
||||
"port": "RS485 or USB-RS485 adaptor port",
|
||||
"address": "Inverter address"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -16,7 +16,7 @@
|
||||
},
|
||||
"abort": {
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
|
||||
"no_serial_ports": "No com ports found. Need a valid RS485 device to communicate."
|
||||
"no_serial_ports": "No com ports found. The integration needs a valid RS485 device to communicate."
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"step": {
|
||||
"init": {
|
||||
"title": "Set up two-factor authentication using TOTP",
|
||||
"description": "To activate two factor authentication using time-based one-time passwords, scan the QR code with your authentication app. If you don't have one, we recommend either [Google Authenticator](https://support.google.com/accounts/answer/1066447) or [Authy](https://authy.com/).\n\n{qr_code}\n\nAfter scanning the code, enter the six digit code from your app to verify the setup. If you have problems scanning the QR code, do a manual setup with code **`{code}`**."
|
||||
"description": "To activate two-factor authentication using time-based one-time passwords, scan the QR code with your authentication app. If you don't have one, we recommend either [Google Authenticator](https://support.google.com/accounts/answer/1066447) or [Authy](https://authy.com/).\n\n{qr_code}\n\nAfter scanning the code, enter the six-digit code from your app to verify the setup. If you have problems scanning the QR code, do a manual setup with code **`{code}`**."
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
@@ -13,7 +13,7 @@
|
||||
}
|
||||
},
|
||||
"notify": {
|
||||
"title": "Notify One-Time Password",
|
||||
"title": "Notify one-time password",
|
||||
"step": {
|
||||
"init": {
|
||||
"title": "Set up one-time password delivered by notify component",
|
||||
|
||||
@@ -14,7 +14,7 @@ from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity, EntityDescription
|
||||
|
||||
from .const import DOMAIN as AXIS_DOMAIN
|
||||
from .const import DOMAIN
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .hub import AxisHub
|
||||
@@ -61,7 +61,7 @@ class AxisEntity(Entity):
|
||||
self.hub = hub
|
||||
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(AXIS_DOMAIN, hub.unique_id)},
|
||||
identifiers={(DOMAIN, hub.unique_id)},
|
||||
serial_number=hub.unique_id,
|
||||
)
|
||||
|
||||
|
||||
@@ -39,11 +39,20 @@ async def async_setup_entry(
|
||||
session = async_create_clientsession(
|
||||
hass, timeout=ClientTimeout(connect=10, total=12 * 60 * 60)
|
||||
)
|
||||
container_client = ContainerClient(
|
||||
account_url=f"https://{entry.data[CONF_ACCOUNT_NAME]}.blob.core.windows.net/",
|
||||
container_name=entry.data[CONF_CONTAINER_NAME],
|
||||
credential=entry.data[CONF_STORAGE_ACCOUNT_KEY],
|
||||
transport=AioHttpTransport(session=session),
|
||||
|
||||
def create_container_client() -> ContainerClient:
|
||||
"""Create a ContainerClient."""
|
||||
|
||||
return ContainerClient(
|
||||
account_url=f"https://{entry.data[CONF_ACCOUNT_NAME]}.blob.core.windows.net/",
|
||||
container_name=entry.data[CONF_CONTAINER_NAME],
|
||||
credential=entry.data[CONF_STORAGE_ACCOUNT_KEY],
|
||||
transport=AioHttpTransport(session=session),
|
||||
)
|
||||
|
||||
# has a blocking call to open in cpython
|
||||
container_client: ContainerClient = await hass.async_add_executor_job(
|
||||
create_container_client
|
||||
)
|
||||
|
||||
try:
|
||||
|
||||
@@ -27,9 +27,25 @@ _LOGGER = logging.getLogger(__name__)
|
||||
class AzureStorageConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
"""Handle a config flow for azure storage."""
|
||||
|
||||
def get_account_url(self, account_name: str) -> str:
|
||||
"""Get the account URL."""
|
||||
return f"https://{account_name}.blob.core.windows.net/"
|
||||
async def get_container_client(
|
||||
self, account_name: str, container_name: str, storage_account_key: str
|
||||
) -> ContainerClient:
|
||||
"""Get the container client.
|
||||
|
||||
ContainerClient has a blocking call to open in cpython
|
||||
"""
|
||||
|
||||
session = async_get_clientsession(self.hass)
|
||||
|
||||
def create_container_client() -> ContainerClient:
|
||||
return ContainerClient(
|
||||
account_url=f"https://{account_name}.blob.core.windows.net/",
|
||||
container_name=container_name,
|
||||
credential=storage_account_key,
|
||||
transport=AioHttpTransport(session=session),
|
||||
)
|
||||
|
||||
return await self.hass.async_add_executor_job(create_container_client)
|
||||
|
||||
async def validate_config(
|
||||
self, container_client: ContainerClient
|
||||
@@ -58,11 +74,10 @@ class AzureStorageConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
self._async_abort_entries_match(
|
||||
{CONF_ACCOUNT_NAME: user_input[CONF_ACCOUNT_NAME]}
|
||||
)
|
||||
container_client = ContainerClient(
|
||||
account_url=self.get_account_url(user_input[CONF_ACCOUNT_NAME]),
|
||||
container_client = await self.get_container_client(
|
||||
account_name=user_input[CONF_ACCOUNT_NAME],
|
||||
container_name=user_input[CONF_CONTAINER_NAME],
|
||||
credential=user_input[CONF_STORAGE_ACCOUNT_KEY],
|
||||
transport=AioHttpTransport(session=async_get_clientsession(self.hass)),
|
||||
storage_account_key=user_input[CONF_STORAGE_ACCOUNT_KEY],
|
||||
)
|
||||
errors = await self.validate_config(container_client)
|
||||
|
||||
@@ -99,12 +114,12 @@ class AzureStorageConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
reauth_entry = self._get_reauth_entry()
|
||||
|
||||
if user_input is not None:
|
||||
container_client = ContainerClient(
|
||||
account_url=self.get_account_url(reauth_entry.data[CONF_ACCOUNT_NAME]),
|
||||
container_client = await self.get_container_client(
|
||||
account_name=reauth_entry.data[CONF_ACCOUNT_NAME],
|
||||
container_name=reauth_entry.data[CONF_CONTAINER_NAME],
|
||||
credential=user_input[CONF_STORAGE_ACCOUNT_KEY],
|
||||
transport=AioHttpTransport(session=async_get_clientsession(self.hass)),
|
||||
storage_account_key=user_input[CONF_STORAGE_ACCOUNT_KEY],
|
||||
)
|
||||
|
||||
errors = await self.validate_config(container_client)
|
||||
if not errors:
|
||||
return self.async_update_reload_and_abort(
|
||||
@@ -129,13 +144,10 @@ class AzureStorageConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
reconfigure_entry = self._get_reconfigure_entry()
|
||||
|
||||
if user_input is not None:
|
||||
container_client = ContainerClient(
|
||||
account_url=self.get_account_url(
|
||||
reconfigure_entry.data[CONF_ACCOUNT_NAME]
|
||||
),
|
||||
container_client = await self.get_container_client(
|
||||
account_name=reconfigure_entry.data[CONF_ACCOUNT_NAME],
|
||||
container_name=user_input[CONF_CONTAINER_NAME],
|
||||
credential=user_input[CONF_STORAGE_ACCOUNT_KEY],
|
||||
transport=AioHttpTransport(session=async_get_clientsession(self.hass)),
|
||||
storage_account_key=user_input[CONF_STORAGE_ACCOUNT_KEY],
|
||||
)
|
||||
errors = await self.validate_config(container_client)
|
||||
if not errors:
|
||||
|
||||
@@ -30,6 +30,7 @@ class BackupCoordinatorData:
|
||||
"""Class to hold backup data."""
|
||||
|
||||
backup_manager_state: BackupManagerState
|
||||
last_attempted_automatic_backup: datetime | None
|
||||
last_successful_automatic_backup: datetime | None
|
||||
next_scheduled_automatic_backup: datetime | None
|
||||
|
||||
@@ -70,6 +71,7 @@ class BackupDataUpdateCoordinator(DataUpdateCoordinator[BackupCoordinatorData]):
|
||||
"""Update backup manager data."""
|
||||
return BackupCoordinatorData(
|
||||
self.backup_manager.state,
|
||||
self.backup_manager.config.data.last_attempted_automatic_backup,
|
||||
self.backup_manager.config.data.last_completed_automatic_backup,
|
||||
self.backup_manager.config.data.schedule.next_automatic_backup,
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ from . import util
|
||||
from .agent import BackupAgent
|
||||
from .const import DATA_MANAGER
|
||||
from .manager import BackupManager
|
||||
from .models import BackupNotFound
|
||||
from .models import AgentBackup, BackupNotFound
|
||||
|
||||
|
||||
@callback
|
||||
@@ -85,7 +85,15 @@ class DownloadBackupView(HomeAssistantView):
|
||||
request, headers, backup_id, agent_id, agent, manager
|
||||
)
|
||||
return await self._send_backup_with_password(
|
||||
hass, request, headers, backup_id, agent_id, password, agent, manager
|
||||
hass,
|
||||
backup,
|
||||
request,
|
||||
headers,
|
||||
backup_id,
|
||||
agent_id,
|
||||
password,
|
||||
agent,
|
||||
manager,
|
||||
)
|
||||
except BackupNotFound:
|
||||
return Response(status=HTTPStatus.NOT_FOUND)
|
||||
@@ -116,6 +124,7 @@ class DownloadBackupView(HomeAssistantView):
|
||||
async def _send_backup_with_password(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
backup: AgentBackup,
|
||||
request: Request,
|
||||
headers: dict[istr, str],
|
||||
backup_id: str,
|
||||
@@ -144,7 +153,8 @@ class DownloadBackupView(HomeAssistantView):
|
||||
|
||||
stream = util.AsyncIteratorWriter(hass)
|
||||
worker = threading.Thread(
|
||||
target=util.decrypt_backup, args=[reader, stream, password, on_done, 0, []]
|
||||
target=util.decrypt_backup,
|
||||
args=[backup, reader, stream, password, on_done, 0, []],
|
||||
)
|
||||
try:
|
||||
worker.start()
|
||||
|
||||
@@ -46,6 +46,12 @@ BACKUP_MANAGER_DESCRIPTIONS = (
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
value_fn=lambda data: data.last_successful_automatic_backup,
|
||||
),
|
||||
BackupSensorEntityDescription(
|
||||
key="last_attempted_automatic_backup",
|
||||
translation_key="last_attempted_automatic_backup",
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
value_fn=lambda data: data.last_attempted_automatic_backup,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
"next_scheduled_automatic_backup": {
|
||||
"name": "Next scheduled automatic backup"
|
||||
},
|
||||
"last_attempted_automatic_backup": {
|
||||
"name": "Last attempted automatic backup"
|
||||
},
|
||||
"last_successful_automatic_backup": {
|
||||
"name": "Last successful automatic backup"
|
||||
}
|
||||
|
||||
@@ -295,13 +295,26 @@ def validate_password_stream(
|
||||
raise BackupEmpty
|
||||
|
||||
|
||||
def _get_expected_archives(backup: AgentBackup) -> set[str]:
|
||||
"""Get the expected archives in the backup."""
|
||||
expected_archives = set()
|
||||
if backup.homeassistant_included:
|
||||
expected_archives.add("homeassistant")
|
||||
for addon in backup.addons:
|
||||
expected_archives.add(addon.slug)
|
||||
for folder in backup.folders:
|
||||
expected_archives.add(folder.value)
|
||||
return expected_archives
|
||||
|
||||
|
||||
def decrypt_backup(
|
||||
backup: AgentBackup,
|
||||
input_stream: IO[bytes],
|
||||
output_stream: IO[bytes],
|
||||
password: str | None,
|
||||
on_done: Callable[[Exception | None], None],
|
||||
minimum_size: int,
|
||||
nonces: list[bytes],
|
||||
nonces: NonceGenerator,
|
||||
) -> None:
|
||||
"""Decrypt a backup."""
|
||||
error: Exception | None = None
|
||||
@@ -315,10 +328,13 @@ def decrypt_backup(
|
||||
fileobj=output_stream, mode="w|", bufsize=BUF_SIZE
|
||||
) as output_tar,
|
||||
):
|
||||
_decrypt_backup(input_tar, output_tar, password)
|
||||
_decrypt_backup(backup, input_tar, output_tar, password)
|
||||
except (DecryptError, SecureTarError, tarfile.TarError) as err:
|
||||
LOGGER.warning("Error decrypting backup: %s", err)
|
||||
error = err
|
||||
except Exception as err: # noqa: BLE001
|
||||
LOGGER.exception("Unexpected error when decrypting backup: %s", err)
|
||||
error = err
|
||||
else:
|
||||
# Pad the output stream to the requested minimum size
|
||||
padding = max(minimum_size - output_stream.tell(), 0)
|
||||
@@ -333,15 +349,18 @@ def decrypt_backup(
|
||||
|
||||
|
||||
def _decrypt_backup(
|
||||
backup: AgentBackup,
|
||||
input_tar: tarfile.TarFile,
|
||||
output_tar: tarfile.TarFile,
|
||||
password: str | None,
|
||||
) -> None:
|
||||
"""Decrypt a backup."""
|
||||
expected_archives = _get_expected_archives(backup)
|
||||
for obj in input_tar:
|
||||
# We compare with PurePath to avoid issues with different path separators,
|
||||
# for example when backup.json is added as "./backup.json"
|
||||
if PurePath(obj.name) == PurePath("backup.json"):
|
||||
object_path = PurePath(obj.name)
|
||||
if object_path == PurePath("backup.json"):
|
||||
# Rewrite the backup.json file to indicate that the backup is decrypted
|
||||
if not (reader := input_tar.extractfile(obj)):
|
||||
raise DecryptError
|
||||
@@ -352,7 +371,13 @@ def _decrypt_backup(
|
||||
metadata_obj.size = len(updated_metadata_b)
|
||||
output_tar.addfile(metadata_obj, BytesIO(updated_metadata_b))
|
||||
continue
|
||||
if not obj.name.endswith((".tar", ".tgz", ".tar.gz")):
|
||||
prefix, _, suffix = object_path.name.partition(".")
|
||||
if suffix not in ("tar", "tgz", "tar.gz"):
|
||||
LOGGER.debug("Unknown file %s will not be decrypted", obj.name)
|
||||
output_tar.addfile(obj, input_tar.extractfile(obj))
|
||||
continue
|
||||
if prefix not in expected_archives:
|
||||
LOGGER.debug("Unknown inner tar file %s will not be decrypted", obj.name)
|
||||
output_tar.addfile(obj, input_tar.extractfile(obj))
|
||||
continue
|
||||
istf = SecureTarFile(
|
||||
@@ -371,12 +396,13 @@ def _decrypt_backup(
|
||||
|
||||
|
||||
def encrypt_backup(
|
||||
backup: AgentBackup,
|
||||
input_stream: IO[bytes],
|
||||
output_stream: IO[bytes],
|
||||
password: str | None,
|
||||
on_done: Callable[[Exception | None], None],
|
||||
minimum_size: int,
|
||||
nonces: list[bytes],
|
||||
nonces: NonceGenerator,
|
||||
) -> None:
|
||||
"""Encrypt a backup."""
|
||||
error: Exception | None = None
|
||||
@@ -390,10 +416,13 @@ def encrypt_backup(
|
||||
fileobj=output_stream, mode="w|", bufsize=BUF_SIZE
|
||||
) as output_tar,
|
||||
):
|
||||
_encrypt_backup(input_tar, output_tar, password, nonces)
|
||||
_encrypt_backup(backup, input_tar, output_tar, password, nonces)
|
||||
except (EncryptError, SecureTarError, tarfile.TarError) as err:
|
||||
LOGGER.warning("Error encrypting backup: %s", err)
|
||||
error = err
|
||||
except Exception as err: # noqa: BLE001
|
||||
LOGGER.exception("Unexpected error when decrypting backup: %s", err)
|
||||
error = err
|
||||
else:
|
||||
# Pad the output stream to the requested minimum size
|
||||
padding = max(minimum_size - output_stream.tell(), 0)
|
||||
@@ -408,17 +437,20 @@ def encrypt_backup(
|
||||
|
||||
|
||||
def _encrypt_backup(
|
||||
backup: AgentBackup,
|
||||
input_tar: tarfile.TarFile,
|
||||
output_tar: tarfile.TarFile,
|
||||
password: str | None,
|
||||
nonces: list[bytes],
|
||||
nonces: NonceGenerator,
|
||||
) -> None:
|
||||
"""Encrypt a backup."""
|
||||
inner_tar_idx = 0
|
||||
expected_archives = _get_expected_archives(backup)
|
||||
for obj in input_tar:
|
||||
# We compare with PurePath to avoid issues with different path separators,
|
||||
# for example when backup.json is added as "./backup.json"
|
||||
if PurePath(obj.name) == PurePath("backup.json"):
|
||||
object_path = PurePath(obj.name)
|
||||
if object_path == PurePath("backup.json"):
|
||||
# Rewrite the backup.json file to indicate that the backup is encrypted
|
||||
if not (reader := input_tar.extractfile(obj)):
|
||||
raise EncryptError
|
||||
@@ -429,16 +461,21 @@ def _encrypt_backup(
|
||||
metadata_obj.size = len(updated_metadata_b)
|
||||
output_tar.addfile(metadata_obj, BytesIO(updated_metadata_b))
|
||||
continue
|
||||
if not obj.name.endswith((".tar", ".tgz", ".tar.gz")):
|
||||
prefix, _, suffix = object_path.name.partition(".")
|
||||
if suffix not in ("tar", "tgz", "tar.gz"):
|
||||
LOGGER.debug("Unknown file %s will not be encrypted", obj.name)
|
||||
output_tar.addfile(obj, input_tar.extractfile(obj))
|
||||
continue
|
||||
if prefix not in expected_archives:
|
||||
LOGGER.debug("Unknown inner tar file %s will not be encrypted", obj.name)
|
||||
continue
|
||||
istf = SecureTarFile(
|
||||
None, # Not used
|
||||
gzip=False,
|
||||
key=password_to_key(password) if password is not None else None,
|
||||
mode="r",
|
||||
fileobj=input_tar.extractfile(obj),
|
||||
nonce=nonces[inner_tar_idx],
|
||||
nonce=nonces.get(inner_tar_idx),
|
||||
)
|
||||
inner_tar_idx += 1
|
||||
with istf.encrypt(obj) as encrypted:
|
||||
@@ -456,17 +493,33 @@ class _CipherWorkerStatus:
|
||||
writer: AsyncIteratorWriter
|
||||
|
||||
|
||||
class NonceGenerator:
|
||||
"""Generate nonces for encryption."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Initialize the generator."""
|
||||
self._nonces: dict[int, bytes] = {}
|
||||
|
||||
def get(self, index: int) -> bytes:
|
||||
"""Get a nonce for the given index."""
|
||||
if index not in self._nonces:
|
||||
# Generate a new nonce for the given index
|
||||
self._nonces[index] = os.urandom(16)
|
||||
return self._nonces[index]
|
||||
|
||||
|
||||
class _CipherBackupStreamer:
|
||||
"""Encrypt or decrypt a backup."""
|
||||
|
||||
_cipher_func: Callable[
|
||||
[
|
||||
AgentBackup,
|
||||
IO[bytes],
|
||||
IO[bytes],
|
||||
str | None,
|
||||
Callable[[Exception | None], None],
|
||||
int,
|
||||
list[bytes],
|
||||
NonceGenerator,
|
||||
],
|
||||
None,
|
||||
]
|
||||
@@ -484,7 +537,7 @@ class _CipherBackupStreamer:
|
||||
self._hass = hass
|
||||
self._open_stream = open_stream
|
||||
self._password = password
|
||||
self._nonces: list[bytes] = []
|
||||
self._nonces = NonceGenerator()
|
||||
|
||||
def size(self) -> int:
|
||||
"""Return the maximum size of the decrypted or encrypted backup."""
|
||||
@@ -508,7 +561,15 @@ class _CipherBackupStreamer:
|
||||
writer = AsyncIteratorWriter(self._hass)
|
||||
worker = threading.Thread(
|
||||
target=self._cipher_func,
|
||||
args=[reader, writer, self._password, on_done, self.size(), self._nonces],
|
||||
args=[
|
||||
self._backup,
|
||||
reader,
|
||||
writer,
|
||||
self._password,
|
||||
on_done,
|
||||
self.size(),
|
||||
self._nonces,
|
||||
],
|
||||
)
|
||||
worker_status = _CipherWorkerStatus(
|
||||
done=asyncio.Event(), reader=reader, thread=worker, writer=writer
|
||||
@@ -538,17 +599,6 @@ class DecryptedBackupStreamer(_CipherBackupStreamer):
|
||||
class EncryptedBackupStreamer(_CipherBackupStreamer):
|
||||
"""Encrypt a backup."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
backup: AgentBackup,
|
||||
open_stream: Callable[[], Coroutine[Any, Any, AsyncIterator[bytes]]],
|
||||
password: str | None,
|
||||
) -> None:
|
||||
"""Initialize."""
|
||||
super().__init__(hass, backup, open_stream, password)
|
||||
self._nonces = [os.urandom(16) for _ in range(self._num_tar_files())]
|
||||
|
||||
_cipher_func = staticmethod(encrypt_backup)
|
||||
|
||||
def backup(self) -> AgentBackup:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
"title": "Sign-in with Blink account",
|
||||
"title": "Sign in with Blink account",
|
||||
"data": {
|
||||
"username": "[%key:common::config_flow::data::username%]",
|
||||
"password": "[%key:common::config_flow::data::password%]"
|
||||
@@ -30,7 +30,7 @@
|
||||
"step": {
|
||||
"simple_options": {
|
||||
"data": {
|
||||
"scan_interval": "Scan Interval (seconds)"
|
||||
"scan_interval": "Scan interval (seconds)"
|
||||
},
|
||||
"title": "Blink options",
|
||||
"description": "Configure Blink integration"
|
||||
@@ -93,7 +93,7 @@
|
||||
},
|
||||
"config_entry_id": {
|
||||
"name": "Integration ID",
|
||||
"description": "The Blink Integration ID."
|
||||
"description": "The Blink integration ID."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ from .coordinator import (
|
||||
CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
|
||||
|
||||
PLATFORMS = [
|
||||
Platform.BUTTON,
|
||||
Platform.MEDIA_PLAYER,
|
||||
]
|
||||
|
||||
|
||||
128
homeassistant/components/bluesound/button.py
Normal file
128
homeassistant/components/bluesound/button.py
Normal file
@@ -0,0 +1,128 @@
|
||||
"""Button entities for Bluesound."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Awaitable, Callable
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from pyblu import Player
|
||||
|
||||
from homeassistant.components.button import ButtonEntity, ButtonEntityDescription
|
||||
from homeassistant.const import CONF_PORT
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import (
|
||||
CONNECTION_NETWORK_MAC,
|
||||
DeviceInfo,
|
||||
format_mac,
|
||||
)
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import DOMAIN
|
||||
from .coordinator import BluesoundCoordinator
|
||||
from .media_player import DEFAULT_PORT
|
||||
from .utils import format_unique_id
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from . import BluesoundConfigEntry
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
config_entry: BluesoundConfigEntry,
|
||||
async_add_entities: AddConfigEntryEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up the Bluesound entry."""
|
||||
|
||||
async_add_entities(
|
||||
BluesoundButton(
|
||||
config_entry.runtime_data.coordinator,
|
||||
config_entry.runtime_data.player,
|
||||
config_entry.data[CONF_PORT],
|
||||
description,
|
||||
)
|
||||
for description in BUTTON_DESCRIPTIONS
|
||||
)
|
||||
|
||||
|
||||
@dataclass(kw_only=True, frozen=True)
|
||||
class BluesoundButtonEntityDescription(ButtonEntityDescription):
|
||||
"""Description for Bluesound button entities."""
|
||||
|
||||
press_fn: Callable[[Player], Awaitable[None]]
|
||||
|
||||
|
||||
async def clear_sleep_timer(player: Player) -> None:
|
||||
"""Clear the sleep timer."""
|
||||
sleep = -1
|
||||
while sleep != 0:
|
||||
sleep = await player.sleep_timer()
|
||||
|
||||
|
||||
async def set_sleep_timer(player: Player) -> None:
|
||||
"""Set the sleep timer."""
|
||||
await player.sleep_timer()
|
||||
|
||||
|
||||
BUTTON_DESCRIPTIONS = [
|
||||
BluesoundButtonEntityDescription(
|
||||
key="set_sleep_timer",
|
||||
translation_key="set_sleep_timer",
|
||||
entity_registry_enabled_default=False,
|
||||
press_fn=set_sleep_timer,
|
||||
),
|
||||
BluesoundButtonEntityDescription(
|
||||
key="clear_sleep_timer",
|
||||
translation_key="clear_sleep_timer",
|
||||
entity_registry_enabled_default=False,
|
||||
press_fn=clear_sleep_timer,
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
class BluesoundButton(CoordinatorEntity[BluesoundCoordinator], ButtonEntity):
|
||||
"""Base class for Bluesound buttons."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
entity_description: BluesoundButtonEntityDescription
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: BluesoundCoordinator,
|
||||
player: Player,
|
||||
port: int,
|
||||
description: BluesoundButtonEntityDescription,
|
||||
) -> None:
|
||||
"""Initialize the Bluesound button."""
|
||||
super().__init__(coordinator)
|
||||
sync_status = coordinator.data.sync_status
|
||||
|
||||
self.entity_description = description
|
||||
self._player = player
|
||||
self._attr_unique_id = (
|
||||
f"{description.key}-{format_unique_id(sync_status.mac, port)}"
|
||||
)
|
||||
|
||||
if port == DEFAULT_PORT:
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, format_mac(sync_status.mac))},
|
||||
connections={(CONNECTION_NETWORK_MAC, format_mac(sync_status.mac))},
|
||||
name=sync_status.name,
|
||||
manufacturer=sync_status.brand,
|
||||
model=sync_status.model_name,
|
||||
model_id=sync_status.model,
|
||||
)
|
||||
else:
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, format_unique_id(sync_status.mac, port))},
|
||||
name=sync_status.name,
|
||||
manufacturer=sync_status.brand,
|
||||
model=sync_status.model_name,
|
||||
model_id=sync_status.model,
|
||||
via_device=(DOMAIN, format_mac(sync_status.mac)),
|
||||
)
|
||||
|
||||
async def async_press(self) -> None:
|
||||
"""Handle the button press."""
|
||||
await self.entity_description.press_fn(self._player)
|
||||
@@ -22,7 +22,11 @@ from homeassistant.components.media_player import (
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import ServiceValidationError
|
||||
from homeassistant.helpers import config_validation as cv, entity_platform
|
||||
from homeassistant.helpers import (
|
||||
config_validation as cv,
|
||||
entity_platform,
|
||||
issue_registry as ir,
|
||||
)
|
||||
from homeassistant.helpers.device_registry import (
|
||||
CONNECTION_NETWORK_MAC,
|
||||
DeviceInfo,
|
||||
@@ -34,7 +38,7 @@ from homeassistant.helpers.dispatcher import (
|
||||
)
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
from homeassistant.util import dt as dt_util
|
||||
from homeassistant.util import dt as dt_util, slugify
|
||||
|
||||
from .const import ATTR_BLUESOUND_GROUP, ATTR_MASTER, DOMAIN
|
||||
from .coordinator import BluesoundCoordinator
|
||||
@@ -488,10 +492,36 @@ class BluesoundPlayer(CoordinatorEntity[BluesoundCoordinator], MediaPlayerEntity
|
||||
|
||||
async def async_increase_timer(self) -> int:
|
||||
"""Increase sleep time on player."""
|
||||
ir.async_create_issue(
|
||||
self.hass,
|
||||
DOMAIN,
|
||||
f"deprecated_service_{SERVICE_SET_TIMER}",
|
||||
is_fixable=False,
|
||||
breaks_in_ha_version="2025.12.0",
|
||||
issue_domain=DOMAIN,
|
||||
severity=ir.IssueSeverity.WARNING,
|
||||
translation_key="deprecated_service_set_sleep_timer",
|
||||
translation_placeholders={
|
||||
"name": slugify(self.sync_status.name),
|
||||
},
|
||||
)
|
||||
return await self._player.sleep_timer()
|
||||
|
||||
async def async_clear_timer(self) -> None:
|
||||
"""Clear sleep timer on player."""
|
||||
ir.async_create_issue(
|
||||
self.hass,
|
||||
DOMAIN,
|
||||
f"deprecated_service_{SERVICE_CLEAR_TIMER}",
|
||||
is_fixable=False,
|
||||
breaks_in_ha_version="2025.12.0",
|
||||
issue_domain=DOMAIN,
|
||||
severity=ir.IssueSeverity.WARNING,
|
||||
translation_key="deprecated_service_clear_sleep_timer",
|
||||
translation_placeholders={
|
||||
"name": slugify(self.sync_status.name),
|
||||
},
|
||||
)
|
||||
sleep = 1
|
||||
while sleep > 0:
|
||||
sleep = await self._player.sleep_timer()
|
||||
|
||||
@@ -26,6 +26,16 @@
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_service_set_sleep_timer": {
|
||||
"title": "Detected use of deprecated action bluesound.set_sleep_timer",
|
||||
"description": "Use `button.{name}_set_sleep_timer` instead.\n\nPlease replace this action and adjust your automations and scripts."
|
||||
},
|
||||
"deprecated_service_clear_sleep_timer": {
|
||||
"title": "Detected use of deprecated action bluesound.clear_sleep_timer",
|
||||
"description": "Use `button.{name}_clear_sleep_timer` instead.\n\nPlease replace this action and adjust your automations and scripts."
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"join": {
|
||||
"name": "Join",
|
||||
@@ -71,5 +81,15 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"button": {
|
||||
"set_sleep_timer": {
|
||||
"name": "Set sleep timer"
|
||||
},
|
||||
"clear_sleep_timer": {
|
||||
"name": "Clear sleep timer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import DOMAIN as BMW_DOMAIN, BMWConfigEntry
|
||||
from . import DOMAIN, BMWConfigEntry
|
||||
from .entity import BMWBaseEntity
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -111,7 +111,7 @@ class BMWButton(BMWBaseEntity, ButtonEntity):
|
||||
await self.entity_description.remote_function(self.vehicle)
|
||||
except MyBMWAPIError as ex:
|
||||
raise HomeAssistantError(
|
||||
translation_domain=BMW_DOMAIN,
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="remote_service_error",
|
||||
translation_placeholders={"exception": str(ex)},
|
||||
) from ex
|
||||
|
||||
@@ -14,7 +14,7 @@ from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import DOMAIN as BMW_DOMAIN, BMWConfigEntry
|
||||
from . import DOMAIN, BMWConfigEntry
|
||||
from .coordinator import BMWDataUpdateCoordinator
|
||||
from .entity import BMWBaseEntity
|
||||
|
||||
@@ -71,7 +71,7 @@ class BMWLock(BMWBaseEntity, LockEntity):
|
||||
self._attr_is_locked = None
|
||||
self.async_write_ha_state()
|
||||
raise HomeAssistantError(
|
||||
translation_domain=BMW_DOMAIN,
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="remote_service_error",
|
||||
translation_placeholders={"exception": str(ex)},
|
||||
) from ex
|
||||
@@ -95,7 +95,7 @@ class BMWLock(BMWBaseEntity, LockEntity):
|
||||
self._attr_is_locked = None
|
||||
self.async_write_ha_state()
|
||||
raise HomeAssistantError(
|
||||
translation_domain=BMW_DOMAIN,
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="remote_service_error",
|
||||
translation_placeholders={"exception": str(ex)},
|
||||
) from ex
|
||||
|
||||
@@ -20,7 +20,7 @@ from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import DOMAIN as BMW_DOMAIN, BMWConfigEntry
|
||||
from . import DOMAIN, BMWConfigEntry
|
||||
|
||||
PARALLEL_UPDATES = 1
|
||||
|
||||
@@ -92,7 +92,7 @@ class BMWNotificationService(BaseNotificationService):
|
||||
|
||||
except (vol.Invalid, TypeError, ValueError) as ex:
|
||||
raise ServiceValidationError(
|
||||
translation_domain=BMW_DOMAIN,
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="invalid_poi",
|
||||
translation_placeholders={
|
||||
"poi_exception": str(ex),
|
||||
@@ -107,7 +107,7 @@ class BMWNotificationService(BaseNotificationService):
|
||||
await vehicle.remote_services.trigger_send_poi(poi)
|
||||
except MyBMWAPIError as ex:
|
||||
raise HomeAssistantError(
|
||||
translation_domain=BMW_DOMAIN,
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="remote_service_error",
|
||||
translation_placeholders={"exception": str(ex)},
|
||||
) from ex
|
||||
|
||||
@@ -18,7 +18,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import DOMAIN as BMW_DOMAIN, BMWConfigEntry
|
||||
from . import DOMAIN, BMWConfigEntry
|
||||
from .coordinator import BMWDataUpdateCoordinator
|
||||
from .entity import BMWBaseEntity
|
||||
|
||||
@@ -110,7 +110,7 @@ class BMWNumber(BMWBaseEntity, NumberEntity):
|
||||
await self.entity_description.remote_service(self.vehicle, value)
|
||||
except MyBMWAPIError as ex:
|
||||
raise HomeAssistantError(
|
||||
translation_domain=BMW_DOMAIN,
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="remote_service_error",
|
||||
translation_placeholders={"exception": str(ex)},
|
||||
) from ex
|
||||
|
||||
@@ -15,7 +15,7 @@ from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import DOMAIN as BMW_DOMAIN, BMWConfigEntry
|
||||
from . import DOMAIN, BMWConfigEntry
|
||||
from .coordinator import BMWDataUpdateCoordinator
|
||||
from .entity import BMWBaseEntity
|
||||
|
||||
@@ -124,7 +124,7 @@ class BMWSelect(BMWBaseEntity, SelectEntity):
|
||||
await self.entity_description.remote_service(self.vehicle, option)
|
||||
except MyBMWAPIError as ex:
|
||||
raise HomeAssistantError(
|
||||
translation_domain=BMW_DOMAIN,
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="remote_service_error",
|
||||
translation_placeholders={"exception": str(ex)},
|
||||
) from ex
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
"name": "Door lock state"
|
||||
},
|
||||
"condition_based_services": {
|
||||
"name": "Condition based services"
|
||||
"name": "Condition-based services"
|
||||
},
|
||||
"check_control_messages": {
|
||||
"name": "Check control messages"
|
||||
@@ -81,7 +81,7 @@
|
||||
"name": "Connection status"
|
||||
},
|
||||
"is_pre_entry_climatization_enabled": {
|
||||
"name": "Pre entry climatization"
|
||||
"name": "Pre-entry climatization"
|
||||
}
|
||||
},
|
||||
"button": {
|
||||
|
||||
@@ -14,7 +14,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import DOMAIN as BMW_DOMAIN, BMWConfigEntry
|
||||
from . import DOMAIN, BMWConfigEntry
|
||||
from .coordinator import BMWDataUpdateCoordinator
|
||||
from .entity import BMWBaseEntity
|
||||
|
||||
@@ -112,7 +112,7 @@ class BMWSwitch(BMWBaseEntity, SwitchEntity):
|
||||
await self.entity_description.remote_service_on(self.vehicle)
|
||||
except MyBMWAPIError as ex:
|
||||
raise HomeAssistantError(
|
||||
translation_domain=BMW_DOMAIN,
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="remote_service_error",
|
||||
translation_placeholders={"exception": str(ex)},
|
||||
) from ex
|
||||
@@ -124,7 +124,7 @@ class BMWSwitch(BMWBaseEntity, SwitchEntity):
|
||||
await self.entity_description.remote_service_off(self.vehicle)
|
||||
except MyBMWAPIError as ex:
|
||||
raise HomeAssistantError(
|
||||
translation_domain=BMW_DOMAIN,
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="remote_service_error",
|
||||
translation_placeholders={"exception": str(ex)},
|
||||
) from ex
|
||||
|
||||
@@ -5,7 +5,7 @@ import logging
|
||||
from typing import Any
|
||||
|
||||
from aiohttp import ClientError, ClientResponseError, ClientTimeout
|
||||
from bond_async import Bond, BPUPSubscriptions, start_bpup
|
||||
from bond_async import Bond, BPUPSubscriptions, RequestorUUID, start_bpup
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
@@ -49,6 +49,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: BondConfigEntry) -> bool
|
||||
token=token,
|
||||
timeout=ClientTimeout(total=_API_TIMEOUT),
|
||||
session=async_get_clientsession(hass),
|
||||
requestor_uuid=RequestorUUID.HOME_ASSISTANT,
|
||||
)
|
||||
hub = BondHub(bond, host)
|
||||
try:
|
||||
|
||||
@@ -8,7 +8,7 @@ import logging
|
||||
from typing import Any
|
||||
|
||||
from aiohttp import ClientConnectionError, ClientResponseError
|
||||
from bond_async import Bond
|
||||
from bond_async import Bond, RequestorUUID
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import ConfigEntryState, ConfigFlow, ConfigFlowResult
|
||||
@@ -34,7 +34,12 @@ TOKEN_SCHEMA = vol.Schema({})
|
||||
|
||||
async def async_get_token(hass: HomeAssistant, host: str) -> str | None:
|
||||
"""Try to fetch the token from the bond device."""
|
||||
bond = Bond(host, "", session=async_get_clientsession(hass))
|
||||
bond = Bond(
|
||||
host,
|
||||
"",
|
||||
session=async_get_clientsession(hass),
|
||||
requestor_uuid=RequestorUUID.HOME_ASSISTANT,
|
||||
)
|
||||
response: dict[str, str] = {}
|
||||
with contextlib.suppress(ClientConnectionError):
|
||||
response = await bond.token()
|
||||
@@ -45,7 +50,10 @@ async def _validate_input(hass: HomeAssistant, data: dict[str, Any]) -> tuple[st
|
||||
"""Validate the user input allows us to connect."""
|
||||
|
||||
bond = Bond(
|
||||
data[CONF_HOST], data[CONF_ACCESS_TOKEN], session=async_get_clientsession(hass)
|
||||
data[CONF_HOST],
|
||||
data[CONF_ACCESS_TOKEN],
|
||||
session=async_get_clientsession(hass),
|
||||
requestor_uuid=RequestorUUID.HOME_ASSISTANT,
|
||||
)
|
||||
try:
|
||||
hub = BondHub(bond, data[CONF_HOST])
|
||||
|
||||
@@ -14,7 +14,11 @@ from homeassistant.helpers import device_registry as dr
|
||||
|
||||
from .const import CONF_INSTALLER_CODE, CONF_USER_CODE, DOMAIN
|
||||
|
||||
PLATFORMS: list[Platform] = [Platform.ALARM_CONTROL_PANEL, Platform.SENSOR]
|
||||
PLATFORMS: list[Platform] = [
|
||||
Platform.ALARM_CONTROL_PANEL,
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
]
|
||||
|
||||
type BoschAlarmConfigEntry = ConfigEntry[Panel]
|
||||
|
||||
|
||||
@@ -86,3 +86,57 @@ class BoschAlarmAreaEntity(BoschAlarmEntity):
|
||||
self._area.ready_observer.detach(self.schedule_update_ha_state)
|
||||
if self._observe_status:
|
||||
self._area.status_observer.detach(self.schedule_update_ha_state)
|
||||
|
||||
|
||||
class BoschAlarmDoorEntity(BoschAlarmEntity):
|
||||
"""A base entity for area related entities within a bosch alarm panel."""
|
||||
|
||||
def __init__(self, panel: Panel, door_id: int, unique_id: str) -> None:
|
||||
"""Set up a area related entity for a bosch alarm panel."""
|
||||
super().__init__(panel, unique_id)
|
||||
self._door_id = door_id
|
||||
self._door = panel.doors[door_id]
|
||||
self._door_unique_id = f"{unique_id}_door_{door_id}"
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, self._door_unique_id)},
|
||||
name=self._door.name,
|
||||
manufacturer="Bosch Security Systems",
|
||||
via_device=(DOMAIN, unique_id),
|
||||
)
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Observe state changes."""
|
||||
await super().async_added_to_hass()
|
||||
self._door.status_observer.attach(self.schedule_update_ha_state)
|
||||
|
||||
async def async_will_remove_from_hass(self) -> None:
|
||||
"""Stop observing state changes."""
|
||||
await super().async_added_to_hass()
|
||||
self._door.status_observer.detach(self.schedule_update_ha_state)
|
||||
|
||||
|
||||
class BoschAlarmOutputEntity(BoschAlarmEntity):
|
||||
"""A base entity for area related entities within a bosch alarm panel."""
|
||||
|
||||
def __init__(self, panel: Panel, output_id: int, unique_id: str) -> None:
|
||||
"""Set up a output related entity for a bosch alarm panel."""
|
||||
super().__init__(panel, unique_id)
|
||||
self._output_id = output_id
|
||||
self._output = panel.outputs[output_id]
|
||||
self._output_unique_id = f"{unique_id}_output_{output_id}"
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, self._output_unique_id)},
|
||||
name=self._output.name,
|
||||
manufacturer="Bosch Security Systems",
|
||||
via_device=(DOMAIN, unique_id),
|
||||
)
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Observe state changes."""
|
||||
await super().async_added_to_hass()
|
||||
self._output.status_observer.attach(self.schedule_update_ha_state)
|
||||
|
||||
async def async_will_remove_from_hass(self) -> None:
|
||||
"""Stop observing state changes."""
|
||||
await super().async_added_to_hass()
|
||||
self._output.status_observer.detach(self.schedule_update_ha_state)
|
||||
|
||||
@@ -2,7 +2,27 @@
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"faulting_points": {
|
||||
"default": "mdi:alert-circle-outline"
|
||||
"default": "mdi:alert-circle"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"locked": {
|
||||
"default": "mdi:lock",
|
||||
"state": {
|
||||
"off": "mdi:lock-open"
|
||||
}
|
||||
},
|
||||
"secured": {
|
||||
"default": "mdi:lock",
|
||||
"state": {
|
||||
"off": "mdi:lock-open"
|
||||
}
|
||||
},
|
||||
"cycling": {
|
||||
"default": "mdi:lock",
|
||||
"state": {
|
||||
"on": "mdi:lock-open"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,9 +54,23 @@
|
||||
},
|
||||
"authentication_failed": {
|
||||
"message": "Incorrect credentials for panel."
|
||||
},
|
||||
"incorrect_door_state": {
|
||||
"message": "Door cannot be manipulated while it is being cycled."
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"switch": {
|
||||
"secured": {
|
||||
"name": "Secured"
|
||||
},
|
||||
"cycling": {
|
||||
"name": "Cycling"
|
||||
},
|
||||
"locked": {
|
||||
"name": "Locked"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"faulting_points": {
|
||||
"name": "Faulting points",
|
||||
|
||||
150
homeassistant/components/bosch_alarm/switch.py
Normal file
150
homeassistant/components/bosch_alarm/switch.py
Normal file
@@ -0,0 +1,150 @@
|
||||
"""Support for Bosch Alarm Panel outputs and doors as switches."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable, Coroutine
|
||||
from dataclasses import dataclass
|
||||
from typing import Any
|
||||
|
||||
from bosch_alarm_mode2 import Panel
|
||||
from bosch_alarm_mode2.panel import Door
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity, SwitchEntityDescription
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import BoschAlarmConfigEntry
|
||||
from .const import DOMAIN
|
||||
from .entity import BoschAlarmDoorEntity, BoschAlarmOutputEntity
|
||||
|
||||
|
||||
@dataclass(kw_only=True, frozen=True)
|
||||
class BoschAlarmSwitchEntityDescription(SwitchEntityDescription):
|
||||
"""Describes Bosch Alarm door entity."""
|
||||
|
||||
value_fn: Callable[[Door], bool]
|
||||
on_fn: Callable[[Panel, int], Coroutine[Any, Any, None]]
|
||||
off_fn: Callable[[Panel, int], Coroutine[Any, Any, None]]
|
||||
|
||||
|
||||
DOOR_SWITCH_TYPES: list[BoschAlarmSwitchEntityDescription] = [
|
||||
BoschAlarmSwitchEntityDescription(
|
||||
key="locked",
|
||||
translation_key="locked",
|
||||
value_fn=lambda door: door.is_locked(),
|
||||
on_fn=lambda panel, door_id: panel.door_relock(door_id),
|
||||
off_fn=lambda panel, door_id: panel.door_unlock(door_id),
|
||||
),
|
||||
BoschAlarmSwitchEntityDescription(
|
||||
key="secured",
|
||||
translation_key="secured",
|
||||
value_fn=lambda door: door.is_secured(),
|
||||
on_fn=lambda panel, door_id: panel.door_secure(door_id),
|
||||
off_fn=lambda panel, door_id: panel.door_unsecure(door_id),
|
||||
),
|
||||
BoschAlarmSwitchEntityDescription(
|
||||
key="cycling",
|
||||
translation_key="cycling",
|
||||
value_fn=lambda door: door.is_cycling(),
|
||||
on_fn=lambda panel, door_id: panel.door_cycle(door_id),
|
||||
off_fn=lambda panel, door_id: panel.door_relock(door_id),
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
config_entry: BoschAlarmConfigEntry,
|
||||
async_add_entities: AddConfigEntryEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up switch entities for outputs."""
|
||||
|
||||
panel = config_entry.runtime_data
|
||||
entities: list[SwitchEntity] = [
|
||||
PanelOutputEntity(
|
||||
panel, output_id, config_entry.unique_id or config_entry.entry_id
|
||||
)
|
||||
for output_id in panel.outputs
|
||||
]
|
||||
|
||||
entities.extend(
|
||||
PanelDoorEntity(
|
||||
panel,
|
||||
door_id,
|
||||
config_entry.unique_id or config_entry.entry_id,
|
||||
entity_description,
|
||||
)
|
||||
for door_id in panel.doors
|
||||
for entity_description in DOOR_SWITCH_TYPES
|
||||
)
|
||||
|
||||
async_add_entities(entities)
|
||||
|
||||
|
||||
PARALLEL_UPDATES = 0
|
||||
|
||||
|
||||
class PanelDoorEntity(BoschAlarmDoorEntity, SwitchEntity):
|
||||
"""A switch entity for a door on a bosch alarm panel."""
|
||||
|
||||
entity_description: BoschAlarmSwitchEntityDescription
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
panel: Panel,
|
||||
door_id: int,
|
||||
unique_id: str,
|
||||
entity_description: BoschAlarmSwitchEntityDescription,
|
||||
) -> None:
|
||||
"""Set up a switch entity for a door on a bosch alarm panel."""
|
||||
super().__init__(panel, door_id, unique_id)
|
||||
self.entity_description = entity_description
|
||||
self._attr_unique_id = f"{self._door_unique_id}_{entity_description.key}"
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return the value function."""
|
||||
return self.entity_description.value_fn(self._door)
|
||||
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Run the on function."""
|
||||
# If the door is currently cycling, we can't send it any other commands until it is done
|
||||
if self._door.is_cycling():
|
||||
raise HomeAssistantError(
|
||||
translation_domain=DOMAIN, translation_key="incorrect_door_state"
|
||||
)
|
||||
await self.entity_description.on_fn(self.panel, self._door_id)
|
||||
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Run the off function."""
|
||||
# If the door is currently cycling, we can't send it any other commands until it is done
|
||||
if self._door.is_cycling():
|
||||
raise HomeAssistantError(
|
||||
translation_domain=DOMAIN, translation_key="incorrect_door_state"
|
||||
)
|
||||
await self.entity_description.off_fn(self.panel, self._door_id)
|
||||
|
||||
|
||||
class PanelOutputEntity(BoschAlarmOutputEntity, SwitchEntity):
|
||||
"""An output entity for a bosch alarm panel."""
|
||||
|
||||
_attr_name = None
|
||||
|
||||
def __init__(self, panel: Panel, output_id: int, unique_id: str) -> None:
|
||||
"""Set up an output entity for a bosch alarm panel."""
|
||||
super().__init__(panel, output_id, unique_id)
|
||||
self._attr_unique_id = self._output_unique_id
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Check if this entity is on."""
|
||||
return self._output.is_active()
|
||||
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn on this output."""
|
||||
await self.panel.set_output_active(self._output_id)
|
||||
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn off this output."""
|
||||
await self.panel.set_output_inactive(self._output_id)
|
||||
@@ -10,7 +10,12 @@ from homeassistant.const import CONF_EMAIL, CONF_PASSWORD, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
||||
from .coordinator import BringConfigEntry, BringDataUpdateCoordinator
|
||||
from .coordinator import (
|
||||
BringActivityCoordinator,
|
||||
BringConfigEntry,
|
||||
BringCoordinators,
|
||||
BringDataUpdateCoordinator,
|
||||
)
|
||||
|
||||
PLATFORMS: list[Platform] = [Platform.EVENT, Platform.SENSOR, Platform.TODO]
|
||||
|
||||
@@ -26,7 +31,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: BringConfigEntry) -> boo
|
||||
coordinator = BringDataUpdateCoordinator(hass, entry, bring)
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
|
||||
entry.runtime_data = coordinator
|
||||
activity_coordinator = BringActivityCoordinator(hass, entry, coordinator)
|
||||
await activity_coordinator.async_config_entry_first_refresh()
|
||||
|
||||
entry.runtime_data = BringCoordinators(coordinator, activity_coordinator)
|
||||
|
||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||
|
||||
|
||||
@@ -30,7 +30,15 @@ from .const import DOMAIN
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
type BringConfigEntry = ConfigEntry[BringDataUpdateCoordinator]
|
||||
type BringConfigEntry = ConfigEntry[BringCoordinators]
|
||||
|
||||
|
||||
@dataclass
|
||||
class BringCoordinators:
|
||||
"""Data class holding coordinators."""
|
||||
|
||||
data: BringDataUpdateCoordinator
|
||||
activity: BringActivityCoordinator
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -39,17 +47,28 @@ class BringData(DataClassORJSONMixin):
|
||||
|
||||
lst: BringList
|
||||
content: BringItemsResponse
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BringActivityData(DataClassORJSONMixin):
|
||||
"""Coordinator data class."""
|
||||
|
||||
activity: BringActivityResponse
|
||||
users: BringUsersResponse
|
||||
|
||||
|
||||
class BringDataUpdateCoordinator(DataUpdateCoordinator[dict[str, BringData]]):
|
||||
"""A Bring Data Update Coordinator."""
|
||||
class BringBaseCoordinator[_DataT](DataUpdateCoordinator[_DataT]):
|
||||
"""Bring base coordinator."""
|
||||
|
||||
config_entry: BringConfigEntry
|
||||
user_settings: BringUserSettingsResponse
|
||||
lists: list[BringList]
|
||||
|
||||
|
||||
class BringDataUpdateCoordinator(BringBaseCoordinator[dict[str, BringData]]):
|
||||
"""A Bring Data Update Coordinator."""
|
||||
|
||||
user_settings: BringUserSettingsResponse
|
||||
|
||||
def __init__(
|
||||
self, hass: HomeAssistant, config_entry: BringConfigEntry, bring: Bring
|
||||
) -> None:
|
||||
@@ -90,16 +109,19 @@ class BringDataUpdateCoordinator(DataUpdateCoordinator[dict[str, BringData]]):
|
||||
current_lists := {lst.listUuid for lst in self.lists}
|
||||
):
|
||||
self._purge_deleted_lists()
|
||||
new_lists = current_lists - self.previous_lists
|
||||
self.previous_lists = current_lists
|
||||
|
||||
list_dict: dict[str, BringData] = {}
|
||||
for lst in self.lists:
|
||||
if (ctx := set(self.async_contexts())) and lst.listUuid not in ctx:
|
||||
if (
|
||||
(ctx := set(self.async_contexts()))
|
||||
and lst.listUuid not in ctx
|
||||
and lst.listUuid not in new_lists
|
||||
):
|
||||
continue
|
||||
try:
|
||||
items = await self.bring.get_list(lst.listUuid)
|
||||
activity = await self.bring.get_activity(lst.listUuid)
|
||||
users = await self.bring.get_list_users(lst.listUuid)
|
||||
except BringRequestException as e:
|
||||
raise UpdateFailed(
|
||||
translation_domain=DOMAIN,
|
||||
@@ -111,7 +133,7 @@ class BringDataUpdateCoordinator(DataUpdateCoordinator[dict[str, BringData]]):
|
||||
translation_key="setup_parse_exception",
|
||||
) from e
|
||||
else:
|
||||
list_dict[lst.listUuid] = BringData(lst, items, activity, users)
|
||||
list_dict[lst.listUuid] = BringData(lst, items)
|
||||
|
||||
return list_dict
|
||||
|
||||
@@ -156,3 +178,60 @@ class BringDataUpdateCoordinator(DataUpdateCoordinator[dict[str, BringData]]):
|
||||
device_reg.async_update_device(
|
||||
device.id, remove_config_entry_id=self.config_entry.entry_id
|
||||
)
|
||||
|
||||
|
||||
class BringActivityCoordinator(BringBaseCoordinator[dict[str, BringActivityData]]):
|
||||
"""A Bring Activity Data Update Coordinator."""
|
||||
|
||||
user_settings: BringUserSettingsResponse
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: BringConfigEntry,
|
||||
coordinator: BringDataUpdateCoordinator,
|
||||
) -> None:
|
||||
"""Initialize the Bring Activity data coordinator."""
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=DOMAIN,
|
||||
update_interval=timedelta(minutes=10),
|
||||
)
|
||||
|
||||
self.coordinator = coordinator
|
||||
self.lists = coordinator.lists
|
||||
|
||||
async def _async_update_data(self) -> dict[str, BringActivityData]:
|
||||
"""Fetch activity data from bring."""
|
||||
|
||||
list_dict: dict[str, BringActivityData] = {}
|
||||
for lst in self.lists:
|
||||
if (
|
||||
ctx := set(self.coordinator.async_contexts())
|
||||
) and lst.listUuid not in ctx:
|
||||
continue
|
||||
try:
|
||||
activity = await self.coordinator.bring.get_activity(lst.listUuid)
|
||||
users = await self.coordinator.bring.get_list_users(lst.listUuid)
|
||||
except BringAuthException as e:
|
||||
raise ConfigEntryAuthFailed(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="setup_authentication_exception",
|
||||
translation_placeholders={CONF_EMAIL: self.coordinator.bring.mail},
|
||||
) from e
|
||||
except BringRequestException as e:
|
||||
raise UpdateFailed(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="setup_request_exception",
|
||||
) from e
|
||||
except BringParseException as e:
|
||||
raise UpdateFailed(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="setup_parse_exception",
|
||||
) from e
|
||||
else:
|
||||
list_dict[lst.listUuid] = BringActivityData(activity, users)
|
||||
|
||||
return list_dict
|
||||
|
||||
@@ -20,9 +20,12 @@ async def async_get_config_entry_diagnostics(
|
||||
|
||||
return {
|
||||
"data": {
|
||||
k: async_redact_data(v.to_dict(), TO_REDACT)
|
||||
for k, v in config_entry.runtime_data.data.items()
|
||||
k: v.to_dict() for k, v in config_entry.runtime_data.data.data.items()
|
||||
},
|
||||
"lists": [lst.to_dict() for lst in config_entry.runtime_data.lists],
|
||||
"user_settings": config_entry.runtime_data.user_settings.to_dict(),
|
||||
"activity": {
|
||||
k: async_redact_data(v.to_dict(), TO_REDACT)
|
||||
for k, v in config_entry.runtime_data.activity.data.items()
|
||||
},
|
||||
"lists": [lst.to_dict() for lst in config_entry.runtime_data.data.lists],
|
||||
"user_settings": config_entry.runtime_data.data.user_settings.to_dict(),
|
||||
}
|
||||
|
||||
@@ -8,17 +8,17 @@ from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import DOMAIN
|
||||
from .coordinator import BringDataUpdateCoordinator
|
||||
from .coordinator import BringBaseCoordinator
|
||||
|
||||
|
||||
class BringBaseEntity(CoordinatorEntity[BringDataUpdateCoordinator]):
|
||||
class BringBaseEntity(CoordinatorEntity[BringBaseCoordinator]):
|
||||
"""Bring base entity."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: BringDataUpdateCoordinator,
|
||||
coordinator: BringBaseCoordinator,
|
||||
bring_list: BringList,
|
||||
) -> None:
|
||||
"""Initialize the entity."""
|
||||
@@ -34,5 +34,7 @@ class BringBaseEntity(CoordinatorEntity[BringDataUpdateCoordinator]):
|
||||
},
|
||||
manufacturer="Bring! Labs AG",
|
||||
model="Bring! Grocery Shopping List",
|
||||
configuration_url=f"https://web.getbring.com/app/lists/{list(self.coordinator.lists).index(bring_list)}",
|
||||
configuration_url=f"https://web.getbring.com/app/lists/{list(self.coordinator.lists).index(bring_list)}"
|
||||
if bring_list in self.coordinator.lists
|
||||
else None,
|
||||
)
|
||||
|
||||
@@ -12,7 +12,7 @@ from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import BringConfigEntry
|
||||
from .coordinator import BringDataUpdateCoordinator
|
||||
from .coordinator import BringActivityCoordinator
|
||||
from .entity import BringBaseEntity
|
||||
|
||||
PARALLEL_UPDATES = 0
|
||||
@@ -32,18 +32,18 @@ async def async_setup_entry(
|
||||
"""Add event entities."""
|
||||
nonlocal lists_added
|
||||
|
||||
if new_lists := {lst.listUuid for lst in coordinator.lists} - lists_added:
|
||||
if new_lists := {lst.listUuid for lst in coordinator.data.lists} - lists_added:
|
||||
async_add_entities(
|
||||
BringEventEntity(
|
||||
coordinator,
|
||||
coordinator.activity,
|
||||
bring_list,
|
||||
)
|
||||
for bring_list in coordinator.lists
|
||||
for bring_list in coordinator.data.lists
|
||||
if bring_list.listUuid in new_lists
|
||||
)
|
||||
lists_added |= new_lists
|
||||
|
||||
coordinator.async_add_listener(add_entities)
|
||||
coordinator.activity.async_add_listener(add_entities)
|
||||
add_entities()
|
||||
|
||||
|
||||
@@ -51,10 +51,11 @@ class BringEventEntity(BringBaseEntity, EventEntity):
|
||||
"""An event entity."""
|
||||
|
||||
_attr_translation_key = "activities"
|
||||
coordinator: BringActivityCoordinator
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: BringDataUpdateCoordinator,
|
||||
coordinator: BringActivityCoordinator,
|
||||
bring_list: BringList,
|
||||
) -> None:
|
||||
"""Initialize the entity."""
|
||||
|
||||
@@ -88,7 +88,7 @@ async def async_setup_entry(
|
||||
async_add_entities: AddConfigEntryEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up the sensor platform."""
|
||||
coordinator = config_entry.runtime_data
|
||||
coordinator = config_entry.runtime_data.data
|
||||
lists_added: set[str] = set()
|
||||
|
||||
@callback
|
||||
@@ -117,6 +117,7 @@ class BringSensorEntity(BringBaseEntity, SensorEntity):
|
||||
"""A sensor entity."""
|
||||
|
||||
entity_description: BringSensorEntityDescription
|
||||
coordinator: BringDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
||||
@@ -44,7 +44,7 @@ async def async_setup_entry(
|
||||
async_add_entities: AddConfigEntryEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up the sensor from a config entry created in the integrations UI."""
|
||||
coordinator = config_entry.runtime_data
|
||||
coordinator = config_entry.runtime_data.data
|
||||
lists_added: set[str] = set()
|
||||
|
||||
@callback
|
||||
@@ -88,6 +88,7 @@ class BringTodoListEntity(BringBaseEntity, TodoListEntity):
|
||||
| TodoListEntityFeature.DELETE_TODO_ITEM
|
||||
| TodoListEntityFeature.SET_DESCRIPTION_ON_ITEM
|
||||
)
|
||||
coordinator: BringDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self, coordinator: BringDataUpdateCoordinator, bring_list: BringList
|
||||
@@ -107,7 +108,9 @@ class BringTodoListEntity(BringBaseEntity, TodoListEntity):
|
||||
description=item.specification,
|
||||
status=TodoItemStatus.NEEDS_ACTION,
|
||||
)
|
||||
for item in self.bring_list.content.items.purchase
|
||||
for item in sorted(
|
||||
self.bring_list.content.items.purchase, key=lambda i: i.itemId
|
||||
)
|
||||
),
|
||||
*(
|
||||
TodoItem(
|
||||
|
||||
@@ -11,6 +11,13 @@
|
||||
},
|
||||
"audio_output": {
|
||||
"default": "mdi:audio-input-stereo-minijack"
|
||||
},
|
||||
"control_bus_mode": {
|
||||
"default": "mdi:audio-video-off",
|
||||
"state": {
|
||||
"amplifier": "mdi:speaker",
|
||||
"receiver": "mdi:audio-video"
|
||||
}
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
|
||||
@@ -11,6 +11,7 @@ from aiostreammagic import (
|
||||
StreamMagicClient,
|
||||
TransportControl,
|
||||
)
|
||||
from aiostreammagic.models import ControlBusMode
|
||||
|
||||
from homeassistant.components.media_player import (
|
||||
BrowseMedia,
|
||||
@@ -91,6 +92,8 @@ class CambridgeAudioDevice(CambridgeAudioEntity, MediaPlayerEntity):
|
||||
features = BASE_FEATURES
|
||||
if self.client.state.pre_amp_mode:
|
||||
features |= PREAMP_FEATURES
|
||||
if self.client.state.control_bus == ControlBusMode.AMPLIFIER:
|
||||
features |= MediaPlayerEntityFeature.VOLUME_STEP
|
||||
if TransportControl.PLAY_PAUSE in controls:
|
||||
features |= MediaPlayerEntityFeature.PLAY | MediaPlayerEntityFeature.PAUSE
|
||||
for control in controls:
|
||||
|
||||
@@ -4,7 +4,7 @@ from collections.abc import Awaitable, Callable
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
from aiostreammagic import StreamMagicClient
|
||||
from aiostreammagic.models import DisplayBrightness
|
||||
from aiostreammagic.models import ControlBusMode, DisplayBrightness
|
||||
|
||||
from homeassistant.components.select import SelectEntity, SelectEntityDescription
|
||||
from homeassistant.const import EntityCategory
|
||||
@@ -76,6 +76,20 @@ CONTROL_ENTITIES: tuple[CambridgeAudioSelectEntityDescription, ...] = (
|
||||
value_fn=_audio_output_value_fn,
|
||||
set_value_fn=_audio_output_set_value_fn,
|
||||
),
|
||||
CambridgeAudioSelectEntityDescription(
|
||||
key="control_bus_mode",
|
||||
translation_key="control_bus_mode",
|
||||
options=[
|
||||
ControlBusMode.AMPLIFIER.value,
|
||||
ControlBusMode.RECEIVER.value,
|
||||
ControlBusMode.OFF.value,
|
||||
],
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
value_fn=lambda client: client.state.control_bus,
|
||||
set_value_fn=lambda client, value: client.set_control_bus_mode(
|
||||
ControlBusMode(value)
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -46,6 +46,14 @@
|
||||
},
|
||||
"audio_output": {
|
||||
"name": "Audio output"
|
||||
},
|
||||
"control_bus_mode": {
|
||||
"name": "Control Bus mode",
|
||||
"state": {
|
||||
"amplifier": "Amplifier",
|
||||
"receiver": "Receiver",
|
||||
"off": "[%key:common::state::off%]"
|
||||
}
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
|
||||
@@ -55,13 +55,11 @@ from homeassistant.helpers.deprecation import (
|
||||
DeprecatedConstantEnum,
|
||||
all_with_deprecated_constants,
|
||||
check_if_deprecated_constant,
|
||||
deprecated_function,
|
||||
dir_with_deprecated_constants,
|
||||
)
|
||||
from homeassistant.helpers.entity import Entity, EntityDescription
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.event import async_track_time_interval
|
||||
from homeassistant.helpers.frame import ReportBehavior, report_usage
|
||||
from homeassistant.helpers.network import get_url
|
||||
from homeassistant.helpers.template import Template
|
||||
from homeassistant.helpers.typing import ConfigType, VolDictType
|
||||
@@ -86,18 +84,15 @@ from .img_util import scale_jpeg_camera_image
|
||||
from .prefs import CameraPreferences, DynamicStreamSettings # noqa: F401
|
||||
from .webrtc import (
|
||||
DATA_ICE_SERVERS,
|
||||
CameraWebRTCLegacyProvider,
|
||||
CameraWebRTCProvider,
|
||||
WebRTCAnswer,
|
||||
WebRTCAnswer, # noqa: F401
|
||||
WebRTCCandidate, # noqa: F401
|
||||
WebRTCClientConfiguration,
|
||||
WebRTCError,
|
||||
WebRTCError, # noqa: F401
|
||||
WebRTCMessage, # noqa: F401
|
||||
WebRTCSendMessage,
|
||||
async_get_supported_legacy_provider,
|
||||
async_get_supported_provider,
|
||||
async_register_ice_servers,
|
||||
async_register_rtsp_to_web_rtc_provider, # noqa: F401
|
||||
async_register_webrtc_provider, # noqa: F401
|
||||
async_register_ws,
|
||||
)
|
||||
@@ -436,7 +431,6 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
CACHED_PROPERTIES_WITH_ATTR_ = {
|
||||
"brand",
|
||||
"frame_interval",
|
||||
"frontend_stream_type",
|
||||
"is_on",
|
||||
"is_recording",
|
||||
"is_streaming",
|
||||
@@ -456,8 +450,6 @@ class Camera(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
||||
# Entity Properties
|
||||
_attr_brand: str | None = None
|
||||
_attr_frame_interval: float = MIN_STREAM_INTERVAL
|
||||
# Deprecated in 2024.12. Remove in 2025.6
|
||||
_attr_frontend_stream_type: StreamType | None
|
||||
_attr_is_on: bool = True
|
||||
_attr_is_recording: bool = False
|
||||
_attr_is_streaming: bool = False
|
||||
@@ -480,24 +472,10 @@ class Camera(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
||||
self.async_update_token()
|
||||
self._create_stream_lock: asyncio.Lock | None = None
|
||||
self._webrtc_provider: CameraWebRTCProvider | None = None
|
||||
self._legacy_webrtc_provider: CameraWebRTCLegacyProvider | None = None
|
||||
self._supports_native_sync_webrtc = (
|
||||
type(self).async_handle_web_rtc_offer != Camera.async_handle_web_rtc_offer
|
||||
)
|
||||
self._supports_native_async_webrtc = (
|
||||
type(self).async_handle_async_webrtc_offer
|
||||
!= Camera.async_handle_async_webrtc_offer
|
||||
)
|
||||
self._deprecate_attr_frontend_stream_type_logged = False
|
||||
if type(self).frontend_stream_type != Camera.frontend_stream_type:
|
||||
report_usage(
|
||||
(
|
||||
f"is overwriting the 'frontend_stream_type' property in the {type(self).__name__} class,"
|
||||
" which is deprecated and will be removed in Home Assistant 2025.6, "
|
||||
),
|
||||
core_integration_behavior=ReportBehavior.ERROR,
|
||||
exclude_integrations={DOMAIN},
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def entity_picture(self) -> str:
|
||||
@@ -559,40 +537,6 @@ class Camera(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
||||
"""Return the interval between frames of the mjpeg stream."""
|
||||
return self._attr_frame_interval
|
||||
|
||||
@property
|
||||
def frontend_stream_type(self) -> StreamType | None:
|
||||
"""Return the type of stream supported by this camera.
|
||||
|
||||
A camera may have a single stream type which is used to inform the
|
||||
frontend which camera attributes and player to use. The default type
|
||||
is to use HLS, and components can override to change the type.
|
||||
"""
|
||||
# Deprecated in 2024.12. Remove in 2025.6
|
||||
# Use the camera_capabilities instead
|
||||
if hasattr(self, "_attr_frontend_stream_type"):
|
||||
if not self._deprecate_attr_frontend_stream_type_logged:
|
||||
report_usage(
|
||||
(
|
||||
f"is setting the '_attr_frontend_stream_type' attribute in the {type(self).__name__} class,"
|
||||
" which is deprecated and will be removed in Home Assistant 2025.6, "
|
||||
),
|
||||
core_integration_behavior=ReportBehavior.ERROR,
|
||||
exclude_integrations={DOMAIN},
|
||||
)
|
||||
|
||||
self._deprecate_attr_frontend_stream_type_logged = True
|
||||
return self._attr_frontend_stream_type
|
||||
if CameraEntityFeature.STREAM not in self.supported_features_compat:
|
||||
return None
|
||||
if (
|
||||
self._webrtc_provider
|
||||
or self._legacy_webrtc_provider
|
||||
or self._supports_native_sync_webrtc
|
||||
or self._supports_native_async_webrtc
|
||||
):
|
||||
return StreamType.WEB_RTC
|
||||
return StreamType.HLS
|
||||
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
"""Return True if entity is available."""
|
||||
@@ -631,15 +575,6 @@ class Camera(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
||||
"""
|
||||
return None
|
||||
|
||||
async def async_handle_web_rtc_offer(self, offer_sdp: str) -> str | None:
|
||||
"""Handle the WebRTC offer and return an answer.
|
||||
|
||||
This is used by cameras with CameraEntityFeature.STREAM
|
||||
and StreamType.WEB_RTC.
|
||||
|
||||
Integrations can override with a native WebRTC implementation.
|
||||
"""
|
||||
|
||||
async def async_handle_async_webrtc_offer(
|
||||
self, offer_sdp: str, session_id: str, send_message: WebRTCSendMessage
|
||||
) -> None:
|
||||
@@ -652,56 +587,13 @@ class Camera(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
||||
|
||||
Integrations can override with a native WebRTC implementation.
|
||||
"""
|
||||
if self._supports_native_sync_webrtc:
|
||||
try:
|
||||
answer = await deprecated_function(
|
||||
"async_handle_async_webrtc_offer",
|
||||
breaks_in_ha_version="2025.6",
|
||||
)(self.async_handle_web_rtc_offer)(offer_sdp)
|
||||
except ValueError as ex:
|
||||
_LOGGER.error("Error handling WebRTC offer: %s", ex)
|
||||
send_message(
|
||||
WebRTCError(
|
||||
"webrtc_offer_failed",
|
||||
str(ex),
|
||||
)
|
||||
)
|
||||
except TimeoutError:
|
||||
# This catch was already here and should stay through the deprecation
|
||||
_LOGGER.error("Timeout handling WebRTC offer")
|
||||
send_message(
|
||||
WebRTCError(
|
||||
"webrtc_offer_failed",
|
||||
"Timeout handling WebRTC offer",
|
||||
)
|
||||
)
|
||||
else:
|
||||
if answer:
|
||||
send_message(WebRTCAnswer(answer))
|
||||
else:
|
||||
_LOGGER.error("Error handling WebRTC offer: No answer")
|
||||
send_message(
|
||||
WebRTCError(
|
||||
"webrtc_offer_failed",
|
||||
"No answer on WebRTC offer",
|
||||
)
|
||||
)
|
||||
return
|
||||
|
||||
if self._webrtc_provider:
|
||||
await self._webrtc_provider.async_handle_async_webrtc_offer(
|
||||
self, offer_sdp, session_id, send_message
|
||||
)
|
||||
return
|
||||
|
||||
if self._legacy_webrtc_provider and (
|
||||
answer := await self._legacy_webrtc_provider.async_handle_web_rtc_offer(
|
||||
self, offer_sdp
|
||||
)
|
||||
):
|
||||
send_message(WebRTCAnswer(answer))
|
||||
else:
|
||||
raise HomeAssistantError("Camera does not support WebRTC")
|
||||
raise HomeAssistantError("Camera does not support WebRTC")
|
||||
|
||||
def camera_image(
|
||||
self, width: int | None = None, height: int | None = None
|
||||
@@ -797,9 +689,6 @@ class Camera(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
||||
if motion_detection_enabled := self.motion_detection_enabled:
|
||||
attrs["motion_detection"] = motion_detection_enabled
|
||||
|
||||
if frontend_stream_type := self.frontend_stream_type:
|
||||
attrs["frontend_stream_type"] = frontend_stream_type
|
||||
|
||||
return attrs
|
||||
|
||||
@callback
|
||||
@@ -823,28 +712,17 @@ class Camera(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
||||
providers or inputs to the state attributes change.
|
||||
"""
|
||||
old_provider = self._webrtc_provider
|
||||
old_legacy_provider = self._legacy_webrtc_provider
|
||||
new_provider = None
|
||||
new_legacy_provider = None
|
||||
|
||||
# Skip all providers if the camera has a native WebRTC implementation
|
||||
if not (
|
||||
self._supports_native_sync_webrtc or self._supports_native_async_webrtc
|
||||
):
|
||||
if not self._supports_native_async_webrtc:
|
||||
# Camera doesn't have a native WebRTC implementation
|
||||
new_provider = await self._async_get_supported_webrtc_provider(
|
||||
async_get_supported_provider
|
||||
)
|
||||
|
||||
if new_provider is None:
|
||||
# Only add the legacy provider if the new provider is not available
|
||||
new_legacy_provider = await self._async_get_supported_webrtc_provider(
|
||||
async_get_supported_legacy_provider
|
||||
)
|
||||
|
||||
if old_provider != new_provider or old_legacy_provider != new_legacy_provider:
|
||||
if old_provider != new_provider:
|
||||
self._webrtc_provider = new_provider
|
||||
self._legacy_webrtc_provider = new_legacy_provider
|
||||
self._invalidate_camera_capabilities_cache()
|
||||
if write_state:
|
||||
self.async_write_ha_state()
|
||||
@@ -869,20 +747,12 @@ class Camera(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
||||
"""Return the WebRTC client configuration and extend it with the registered ice servers."""
|
||||
config = self._async_get_webrtc_client_configuration()
|
||||
|
||||
if not self._supports_native_sync_webrtc:
|
||||
# Until 2024.11, the frontend was not resolving any ice servers
|
||||
# The async approach was added 2024.11 and new integrations need to use it
|
||||
ice_servers = [
|
||||
server
|
||||
for servers in self.hass.data.get(DATA_ICE_SERVERS, [])
|
||||
for server in servers()
|
||||
]
|
||||
config.configuration.ice_servers.extend(ice_servers)
|
||||
|
||||
config.get_candidates_upfront = (
|
||||
self._supports_native_sync_webrtc
|
||||
or self._legacy_webrtc_provider is not None
|
||||
)
|
||||
ice_servers = [
|
||||
server
|
||||
for servers in self.hass.data.get(DATA_ICE_SERVERS, [])
|
||||
for server in servers()
|
||||
]
|
||||
config.configuration.ice_servers.extend(ice_servers)
|
||||
|
||||
return config
|
||||
|
||||
@@ -912,13 +782,13 @@ class Camera(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
||||
"""Return the camera capabilities."""
|
||||
frontend_stream_types = set()
|
||||
if CameraEntityFeature.STREAM in self.supported_features_compat:
|
||||
if self._supports_native_sync_webrtc or self._supports_native_async_webrtc:
|
||||
if self._supports_native_async_webrtc:
|
||||
# The camera has a native WebRTC implementation
|
||||
frontend_stream_types.add(StreamType.WEB_RTC)
|
||||
else:
|
||||
frontend_stream_types.add(StreamType.HLS)
|
||||
|
||||
if self._webrtc_provider or self._legacy_webrtc_provider:
|
||||
if self._webrtc_provider:
|
||||
frontend_stream_types.add(StreamType.WEB_RTC)
|
||||
|
||||
return CameraCapabilities(frontend_stream_types)
|
||||
|
||||
@@ -46,10 +46,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"legacy_webrtc_provider": {
|
||||
"title": "Detected use of legacy WebRTC provider registered by {legacy_integration}",
|
||||
"description": "The {legacy_integration} integration has registered a legacy WebRTC provider. Home Assistant prefers using the built-in modern WebRTC provider registered by the {builtin_integration} integration.\n\nBenefits of the built-in integration are:\n\n- The camera stream is started faster.\n- More camera devices are supported.\n\nTo fix this issue, you can either keep using the built-in modern WebRTC provider and remove the {legacy_integration} integration or remove the {builtin_integration} integration to use the legacy provider, and then restart Home Assistant."
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
|
||||
@@ -8,7 +8,7 @@ from collections.abc import Awaitable, Callable, Iterable
|
||||
from dataclasses import asdict, dataclass, field
|
||||
from functools import cache, partial, wraps
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, Any, Protocol
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from mashumaro import MissingField
|
||||
import voluptuous as vol
|
||||
@@ -22,8 +22,7 @@ from webrtc_models import (
|
||||
from homeassistant.components import websocket_api
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import config_validation as cv, issue_registry as ir
|
||||
from homeassistant.helpers.deprecation import deprecated_function
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.util.hass_dict import HassKey
|
||||
from homeassistant.util.ulid import ulid
|
||||
|
||||
@@ -39,9 +38,6 @@ _LOGGER = logging.getLogger(__name__)
|
||||
DATA_WEBRTC_PROVIDERS: HassKey[set[CameraWebRTCProvider]] = HassKey(
|
||||
"camera_webrtc_providers"
|
||||
)
|
||||
DATA_WEBRTC_LEGACY_PROVIDERS: HassKey[dict[str, CameraWebRTCLegacyProvider]] = HassKey(
|
||||
"camera_webrtc_legacy_providers"
|
||||
)
|
||||
DATA_ICE_SERVERS: HassKey[list[Callable[[], Iterable[RTCIceServer]]]] = HassKey(
|
||||
"camera_webrtc_ice_servers"
|
||||
)
|
||||
@@ -115,13 +111,11 @@ class WebRTCClientConfiguration:
|
||||
|
||||
configuration: RTCConfiguration = field(default_factory=RTCConfiguration)
|
||||
data_channel: str | None = None
|
||||
get_candidates_upfront: bool = False
|
||||
|
||||
def to_frontend_dict(self) -> dict[str, Any]:
|
||||
"""Return a dict that can be used by the frontend."""
|
||||
data: dict[str, Any] = {
|
||||
"configuration": self.configuration.to_dict(),
|
||||
"getCandidatesUpfront": self.get_candidates_upfront,
|
||||
}
|
||||
if self.data_channel is not None:
|
||||
data["dataChannel"] = self.data_channel
|
||||
@@ -163,18 +157,6 @@ class CameraWebRTCProvider(ABC):
|
||||
return ## This is an optional method so we need a default here.
|
||||
|
||||
|
||||
class CameraWebRTCLegacyProvider(Protocol):
|
||||
"""WebRTC provider."""
|
||||
|
||||
async def async_is_supported(self, stream_source: str) -> bool:
|
||||
"""Determine if the provider supports the stream source."""
|
||||
|
||||
async def async_handle_web_rtc_offer(
|
||||
self, camera: Camera, offer_sdp: str
|
||||
) -> str | None:
|
||||
"""Handle the WebRTC offer and return an answer."""
|
||||
|
||||
|
||||
@callback
|
||||
def async_register_webrtc_provider(
|
||||
hass: HomeAssistant,
|
||||
@@ -204,8 +186,6 @@ def async_register_webrtc_provider(
|
||||
|
||||
async def _async_refresh_providers(hass: HomeAssistant) -> None:
|
||||
"""Check all cameras for any state changes for registered providers."""
|
||||
_async_check_conflicting_legacy_provider(hass)
|
||||
|
||||
component = hass.data[DATA_COMPONENT]
|
||||
await asyncio.gather(
|
||||
*(camera.async_refresh_providers() for camera in component.entities)
|
||||
@@ -380,21 +360,6 @@ async def async_get_supported_provider(
|
||||
return None
|
||||
|
||||
|
||||
async def async_get_supported_legacy_provider(
|
||||
hass: HomeAssistant, camera: Camera
|
||||
) -> CameraWebRTCLegacyProvider | None:
|
||||
"""Return the first supported provider for the camera."""
|
||||
providers = hass.data.get(DATA_WEBRTC_LEGACY_PROVIDERS)
|
||||
if not providers or not (stream_source := await camera.stream_source()):
|
||||
return None
|
||||
|
||||
for provider in providers.values():
|
||||
if await provider.async_is_supported(stream_source):
|
||||
return provider
|
||||
|
||||
return None
|
||||
|
||||
|
||||
@callback
|
||||
def async_register_ice_servers(
|
||||
hass: HomeAssistant,
|
||||
@@ -411,94 +376,3 @@ def async_register_ice_servers(
|
||||
|
||||
servers.append(get_ice_server_fn)
|
||||
return remove
|
||||
|
||||
|
||||
# The following code is legacy code that was introduced with rtsp_to_webrtc and will be deprecated/removed in the future.
|
||||
# Left it so custom integrations can still use it.
|
||||
|
||||
_RTSP_PREFIXES = {"rtsp://", "rtsps://", "rtmp://"}
|
||||
|
||||
# An RtspToWebRtcProvider accepts these inputs:
|
||||
# stream_source: The RTSP url
|
||||
# offer_sdp: The WebRTC SDP offer
|
||||
# stream_id: A unique id for the stream, used to update an existing source
|
||||
# The output is the SDP answer, or None if the source or offer is not eligible.
|
||||
# The Callable may throw HomeAssistantError on failure.
|
||||
type RtspToWebRtcProviderType = Callable[[str, str, str], Awaitable[str | None]]
|
||||
|
||||
|
||||
class _CameraRtspToWebRTCProvider(CameraWebRTCLegacyProvider):
|
||||
def __init__(self, fn: RtspToWebRtcProviderType) -> None:
|
||||
"""Initialize the RTSP to WebRTC provider."""
|
||||
self._fn = fn
|
||||
|
||||
async def async_is_supported(self, stream_source: str) -> bool:
|
||||
"""Return if this provider is supports the Camera as source."""
|
||||
return any(stream_source.startswith(prefix) for prefix in _RTSP_PREFIXES)
|
||||
|
||||
async def async_handle_web_rtc_offer(
|
||||
self, camera: Camera, offer_sdp: str
|
||||
) -> str | None:
|
||||
"""Handle the WebRTC offer and return an answer."""
|
||||
if not (stream_source := await camera.stream_source()):
|
||||
return None
|
||||
|
||||
return await self._fn(stream_source, offer_sdp, camera.entity_id)
|
||||
|
||||
|
||||
@deprecated_function("async_register_webrtc_provider", breaks_in_ha_version="2025.6")
|
||||
def async_register_rtsp_to_web_rtc_provider(
|
||||
hass: HomeAssistant,
|
||||
domain: str,
|
||||
provider: RtspToWebRtcProviderType,
|
||||
) -> Callable[[], None]:
|
||||
"""Register an RTSP to WebRTC provider.
|
||||
|
||||
The first provider to satisfy the offer will be used.
|
||||
"""
|
||||
if DOMAIN not in hass.data:
|
||||
raise ValueError("Unexpected state, camera not loaded")
|
||||
|
||||
legacy_providers = hass.data.setdefault(DATA_WEBRTC_LEGACY_PROVIDERS, {})
|
||||
|
||||
if domain in legacy_providers:
|
||||
raise ValueError("Provider already registered")
|
||||
|
||||
provider_instance = _CameraRtspToWebRTCProvider(provider)
|
||||
|
||||
@callback
|
||||
def remove_provider() -> None:
|
||||
legacy_providers.pop(domain)
|
||||
hass.async_create_task(_async_refresh_providers(hass))
|
||||
|
||||
legacy_providers[domain] = provider_instance
|
||||
hass.async_create_task(_async_refresh_providers(hass))
|
||||
|
||||
return remove_provider
|
||||
|
||||
|
||||
@callback
|
||||
def _async_check_conflicting_legacy_provider(hass: HomeAssistant) -> None:
|
||||
"""Check if a legacy provider is registered together with the builtin provider."""
|
||||
builtin_provider_domain = "go2rtc"
|
||||
if (
|
||||
(legacy_providers := hass.data.get(DATA_WEBRTC_LEGACY_PROVIDERS))
|
||||
and (providers := hass.data.get(DATA_WEBRTC_PROVIDERS))
|
||||
and any(provider.domain == builtin_provider_domain for provider in providers)
|
||||
):
|
||||
for domain in legacy_providers:
|
||||
ir.async_create_issue(
|
||||
hass,
|
||||
DOMAIN,
|
||||
f"legacy_webrtc_provider_{domain}",
|
||||
is_fixable=False,
|
||||
is_persistent=False,
|
||||
issue_domain=domain,
|
||||
learn_more_url="https://www.home-assistant.io/integrations/go2rtc/",
|
||||
severity=ir.IssueSeverity.WARNING,
|
||||
translation_key="legacy_webrtc_provider",
|
||||
translation_placeholders={
|
||||
"legacy_integration": domain,
|
||||
"builtin_integration": builtin_provider_domain,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
"known_hosts": "Add known host"
|
||||
},
|
||||
"data_description": {
|
||||
"known_hosts": "Hostnames or IP-addresses of cast devices, use if mDNS discovery is not working"
|
||||
"known_hosts": "Hostnames or IP addresses of cast devices, use if mDNS discovery is not working"
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"invalid_known_hosts": "Known hosts must be a comma separated list of hosts."
|
||||
"invalid_known_hosts": "Known hosts must be a comma-separated list of hosts."
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
|
||||
@@ -61,7 +61,6 @@ from .const import (
|
||||
CONF_RELAYER_SERVER,
|
||||
CONF_REMOTESTATE_SERVER,
|
||||
CONF_SERVICEHANDLERS_SERVER,
|
||||
CONF_THINGTALK_SERVER,
|
||||
CONF_USER_POOL_ID,
|
||||
DATA_CLOUD,
|
||||
DATA_CLOUD_LOG_HANDLER,
|
||||
@@ -134,7 +133,6 @@ CONFIG_SCHEMA = vol.Schema(
|
||||
vol.Optional(CONF_CLOUDHOOK_SERVER): str,
|
||||
vol.Optional(CONF_RELAYER_SERVER): str,
|
||||
vol.Optional(CONF_REMOTESTATE_SERVER): str,
|
||||
vol.Optional(CONF_THINGTALK_SERVER): str,
|
||||
vol.Optional(CONF_SERVICEHANDLERS_SERVER): str,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -26,7 +26,11 @@ from homeassistant.core import Context, HassJob, HomeAssistant, callback
|
||||
from homeassistant.helpers.aiohttp_client import SERVER_SOFTWARE
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||
from homeassistant.helpers.event import async_call_later
|
||||
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
|
||||
from homeassistant.helpers.issue_registry import (
|
||||
IssueSeverity,
|
||||
async_create_issue,
|
||||
async_delete_issue,
|
||||
)
|
||||
from homeassistant.util.aiohttp import MockRequest, serialize_response
|
||||
|
||||
from . import alexa_config, google_config
|
||||
@@ -36,8 +40,10 @@ from .prefs import CloudPreferences
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
VALID_REPAIR_TRANSLATION_KEYS = {
|
||||
"no_subscription",
|
||||
"warn_bad_custom_domain_configuration",
|
||||
"reset_bad_custom_domain_configuration",
|
||||
"subscription_expired",
|
||||
}
|
||||
|
||||
|
||||
@@ -399,7 +405,12 @@ class CloudClient(Interface):
|
||||
) -> None:
|
||||
"""Create a repair issue."""
|
||||
if translation_key not in VALID_REPAIR_TRANSLATION_KEYS:
|
||||
raise ValueError(f"Invalid translation key {translation_key}")
|
||||
_LOGGER.error(
|
||||
"Invalid translation key %s for repair issue %s",
|
||||
translation_key,
|
||||
identifier,
|
||||
)
|
||||
return
|
||||
async_create_issue(
|
||||
hass=self._hass,
|
||||
domain=DOMAIN,
|
||||
@@ -409,3 +420,7 @@ class CloudClient(Interface):
|
||||
severity=IssueSeverity(severity),
|
||||
is_fixable=False,
|
||||
)
|
||||
|
||||
async def async_delete_repair_issue(self, identifier: str) -> None:
|
||||
"""Delete a repair issue."""
|
||||
async_delete_issue(hass=self._hass, domain=DOMAIN, issue_id=identifier)
|
||||
|
||||
@@ -81,7 +81,6 @@ CONF_ACME_SERVER = "acme_server"
|
||||
CONF_CLOUDHOOK_SERVER = "cloudhook_server"
|
||||
CONF_RELAYER_SERVER = "relayer_server"
|
||||
CONF_REMOTESTATE_SERVER = "remotestate_server"
|
||||
CONF_THINGTALK_SERVER = "thingtalk_server"
|
||||
CONF_SERVICEHANDLERS_SERVER = "servicehandlers_server"
|
||||
|
||||
MODE_DEV = "development"
|
||||
|
||||
@@ -16,7 +16,7 @@ from typing import Any, Concatenate, cast
|
||||
import aiohttp
|
||||
from aiohttp import web
|
||||
import attr
|
||||
from hass_nabucasa import AlreadyConnectedError, Cloud, auth, thingtalk
|
||||
from hass_nabucasa import AlreadyConnectedError, Cloud, auth
|
||||
from hass_nabucasa.const import STATE_DISCONNECTED
|
||||
from hass_nabucasa.voice_data import TTS_VOICES
|
||||
import voluptuous as vol
|
||||
@@ -104,7 +104,6 @@ def async_setup(hass: HomeAssistant) -> None:
|
||||
websocket_api.async_register_command(hass, alexa_list)
|
||||
websocket_api.async_register_command(hass, alexa_sync)
|
||||
|
||||
websocket_api.async_register_command(hass, thingtalk_convert)
|
||||
websocket_api.async_register_command(hass, tts_info)
|
||||
|
||||
hass.http.register_view(GoogleActionsSyncView)
|
||||
@@ -998,25 +997,6 @@ async def alexa_sync(
|
||||
)
|
||||
|
||||
|
||||
@websocket_api.websocket_command({"type": "cloud/thingtalk/convert", "query": str})
|
||||
@websocket_api.async_response
|
||||
async def thingtalk_convert(
|
||||
hass: HomeAssistant,
|
||||
connection: websocket_api.ActiveConnection,
|
||||
msg: dict[str, Any],
|
||||
) -> None:
|
||||
"""Convert a query."""
|
||||
cloud = hass.data[DATA_CLOUD]
|
||||
|
||||
async with asyncio.timeout(10):
|
||||
try:
|
||||
connection.send_result(
|
||||
msg["id"], await thingtalk.async_convert(cloud, msg["query"])
|
||||
)
|
||||
except thingtalk.ThingTalkConversionError as err:
|
||||
connection.send_error(msg["id"], websocket_api.ERR_UNKNOWN_ERROR, str(err))
|
||||
|
||||
|
||||
@websocket_api.websocket_command({"type": "cloud/tts/info"})
|
||||
def tts_info(
|
||||
hass: HomeAssistant,
|
||||
|
||||
@@ -13,6 +13,6 @@
|
||||
"integration_type": "system",
|
||||
"iot_class": "cloud_push",
|
||||
"loggers": ["acme", "hass_nabucasa", "snitun"],
|
||||
"requirements": ["hass-nabucasa==0.96.0"],
|
||||
"requirements": ["hass-nabucasa==0.100.0"],
|
||||
"single_config_entry": true
|
||||
}
|
||||
|
||||
@@ -62,6 +62,10 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"no_subscription": {
|
||||
"title": "No subscription detected",
|
||||
"description": "You do not have a Home Assistant Cloud subscription. Subscribe at {account_url}."
|
||||
},
|
||||
"warn_bad_custom_domain_configuration": {
|
||||
"title": "Detected wrong custom domain configuration",
|
||||
"description": "The DNS configuration for your custom domain ({custom_domains}) is not correct. Please check the DNS configuration of your domain and make sure it points to the correct CNAME."
|
||||
@@ -69,6 +73,10 @@
|
||||
"reset_bad_custom_domain_configuration": {
|
||||
"title": "Custom domain ignored",
|
||||
"description": "The DNS configuration for your custom domain ({custom_domains}) is not correct. This domain has now been ignored and will not be used for Home Assistant Cloud. If you want to use this domain, please fix the DNS configuration and restart Home Assistant. If you do not need this anymore, you can remove it from the account page."
|
||||
},
|
||||
"subscription_expired": {
|
||||
"title": "Subscription has expired",
|
||||
"description": "Your Home Assistant Cloud subscription has expired. Resubscribe at {account_url}."
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
|
||||
@@ -77,6 +77,5 @@ async def async_unload_entry(hass: HomeAssistant, entry: ComelitConfigEntry) ->
|
||||
coordinator = entry.runtime_data
|
||||
if unload_ok := await hass.config_entries.async_unload_platforms(entry, platforms):
|
||||
await coordinator.api.logout()
|
||||
await coordinator.api.close()
|
||||
|
||||
return unload_ok
|
||||
|
||||
@@ -73,7 +73,6 @@ async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> dict[str,
|
||||
) from err
|
||||
finally:
|
||||
await api.logout()
|
||||
await api.close()
|
||||
|
||||
return {"title": data[CONF_HOST]}
|
||||
|
||||
|
||||
@@ -8,5 +8,5 @@
|
||||
"iot_class": "local_polling",
|
||||
"loggers": ["aiocomelit"],
|
||||
"quality_scale": "bronze",
|
||||
"requirements": ["aiocomelit==0.12.0"]
|
||||
"requirements": ["aiocomelit==0.12.1"]
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@ rules:
|
||||
status: todo
|
||||
comment: missing implementation
|
||||
entity-category:
|
||||
status: todo
|
||||
comment: PR in progress
|
||||
status: exempt
|
||||
comment: no config or diagnostic entities
|
||||
entity-device-class: done
|
||||
entity-disabled-by-default: done
|
||||
entity-translations: done
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
"cannot_authenticate": {
|
||||
"message": "Error authenticating"
|
||||
},
|
||||
"updated_failed": {
|
||||
"update_failed": {
|
||||
"message": "Failed to update data: {error}"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,9 +165,7 @@ class ConfigManagerFlowIndexView(
|
||||
"""Not implemented."""
|
||||
raise aiohttp.web_exceptions.HTTPMethodNotAllowed("GET", ["POST"])
|
||||
|
||||
@require_admin(
|
||||
error=Unauthorized(perm_category=CAT_CONFIG_ENTRIES, permission="add")
|
||||
)
|
||||
@require_admin(perm_category=CAT_CONFIG_ENTRIES, permission="add")
|
||||
@RequestDataValidator(
|
||||
vol.Schema(
|
||||
{
|
||||
@@ -218,16 +216,12 @@ class ConfigManagerFlowResourceView(
|
||||
url = "/api/config/config_entries/flow/{flow_id}"
|
||||
name = "api:config:config_entries:flow:resource"
|
||||
|
||||
@require_admin(
|
||||
error=Unauthorized(perm_category=CAT_CONFIG_ENTRIES, permission="add")
|
||||
)
|
||||
@require_admin(perm_category=CAT_CONFIG_ENTRIES, permission="add")
|
||||
async def get(self, request: web.Request, /, flow_id: str) -> web.Response:
|
||||
"""Get the current state of a data_entry_flow."""
|
||||
return await super().get(request, flow_id)
|
||||
|
||||
@require_admin(
|
||||
error=Unauthorized(perm_category=CAT_CONFIG_ENTRIES, permission="add")
|
||||
)
|
||||
@require_admin(perm_category=CAT_CONFIG_ENTRIES, permission="add")
|
||||
async def post(self, request: web.Request, flow_id: str) -> web.Response:
|
||||
"""Handle a POST request."""
|
||||
return await super().post(request, flow_id)
|
||||
@@ -262,9 +256,7 @@ class OptionManagerFlowIndexView(
|
||||
url = "/api/config/config_entries/options/flow"
|
||||
name = "api:config:config_entries:option:flow"
|
||||
|
||||
@require_admin(
|
||||
error=Unauthorized(perm_category=CAT_CONFIG_ENTRIES, permission=POLICY_EDIT)
|
||||
)
|
||||
@require_admin(perm_category=CAT_CONFIG_ENTRIES, permission=POLICY_EDIT)
|
||||
async def post(self, request: web.Request) -> web.Response:
|
||||
"""Handle a POST request.
|
||||
|
||||
@@ -281,16 +273,12 @@ class OptionManagerFlowResourceView(
|
||||
url = "/api/config/config_entries/options/flow/{flow_id}"
|
||||
name = "api:config:config_entries:options:flow:resource"
|
||||
|
||||
@require_admin(
|
||||
error=Unauthorized(perm_category=CAT_CONFIG_ENTRIES, permission=POLICY_EDIT)
|
||||
)
|
||||
@require_admin(perm_category=CAT_CONFIG_ENTRIES, permission=POLICY_EDIT)
|
||||
async def get(self, request: web.Request, /, flow_id: str) -> web.Response:
|
||||
"""Get the current state of a data_entry_flow."""
|
||||
return await super().get(request, flow_id)
|
||||
|
||||
@require_admin(
|
||||
error=Unauthorized(perm_category=CAT_CONFIG_ENTRIES, permission=POLICY_EDIT)
|
||||
)
|
||||
@require_admin(perm_category=CAT_CONFIG_ENTRIES, permission=POLICY_EDIT)
|
||||
async def post(self, request: web.Request, flow_id: str) -> web.Response:
|
||||
"""Handle a POST request."""
|
||||
return await super().post(request, flow_id)
|
||||
@@ -304,9 +292,7 @@ class SubentryManagerFlowIndexView(
|
||||
url = "/api/config/config_entries/subentries/flow"
|
||||
name = "api:config:config_entries:subentries:flow"
|
||||
|
||||
@require_admin(
|
||||
error=Unauthorized(perm_category=CAT_CONFIG_ENTRIES, permission=POLICY_EDIT)
|
||||
)
|
||||
@require_admin(perm_category=CAT_CONFIG_ENTRIES, permission=POLICY_EDIT)
|
||||
@RequestDataValidator(
|
||||
vol.Schema(
|
||||
{
|
||||
@@ -341,16 +327,12 @@ class SubentryManagerFlowResourceView(
|
||||
url = "/api/config/config_entries/subentries/flow/{flow_id}"
|
||||
name = "api:config:config_entries:subentries:flow:resource"
|
||||
|
||||
@require_admin(
|
||||
error=Unauthorized(perm_category=CAT_CONFIG_ENTRIES, permission=POLICY_EDIT)
|
||||
)
|
||||
@require_admin(perm_category=CAT_CONFIG_ENTRIES, permission=POLICY_EDIT)
|
||||
async def get(self, request: web.Request, /, flow_id: str) -> web.Response:
|
||||
"""Get the current state of a data_entry_flow."""
|
||||
return await super().get(request, flow_id)
|
||||
|
||||
@require_admin(
|
||||
error=Unauthorized(perm_category=CAT_CONFIG_ENTRIES, permission=POLICY_EDIT)
|
||||
)
|
||||
@require_admin(perm_category=CAT_CONFIG_ENTRIES, permission=POLICY_EDIT)
|
||||
async def post(self, request: web.Request, flow_id: str) -> web.Response:
|
||||
"""Handle a POST request."""
|
||||
return await super().post(request, flow_id)
|
||||
|
||||
@@ -12,7 +12,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import DOMAIN as DANFOSS_AIR_DOMAIN
|
||||
from . import DOMAIN
|
||||
|
||||
|
||||
def setup_platform(
|
||||
@@ -22,7 +22,7 @@ def setup_platform(
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the available Danfoss Air sensors etc."""
|
||||
data = hass.data[DANFOSS_AIR_DOMAIN]
|
||||
data = hass.data[DOMAIN]
|
||||
|
||||
sensors = [
|
||||
[
|
||||
|
||||
@@ -16,7 +16,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import DOMAIN as DANFOSS_AIR_DOMAIN
|
||||
from . import DOMAIN
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -28,7 +28,7 @@ def setup_platform(
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the available Danfoss Air sensors etc."""
|
||||
data = hass.data[DANFOSS_AIR_DOMAIN]
|
||||
data = hass.data[DOMAIN]
|
||||
|
||||
sensors = [
|
||||
[
|
||||
|
||||
@@ -12,7 +12,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import DOMAIN as DANFOSS_AIR_DOMAIN
|
||||
from . import DOMAIN
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -24,7 +24,7 @@ def setup_platform(
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the Danfoss Air HRV switch platform."""
|
||||
data = hass.data[DANFOSS_AIR_DOMAIN]
|
||||
data = hass.data[DOMAIN]
|
||||
|
||||
switches = [
|
||||
[
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
"integration_type": "service",
|
||||
"iot_class": "local_push",
|
||||
"quality_scale": "internal",
|
||||
"requirements": ["debugpy==1.8.13"]
|
||||
"requirements": ["debugpy==1.8.14"]
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ from homeassistant.helpers.device_registry import CONNECTION_ZIGBEE, DeviceInfo
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import DOMAIN as DECONZ_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .hub import DeconzHub
|
||||
from .util import serial_from_unique_id
|
||||
|
||||
@@ -59,12 +59,12 @@ class DeconzBase[_DeviceT: _DeviceType]:
|
||||
|
||||
return DeviceInfo(
|
||||
connections={(CONNECTION_ZIGBEE, self.serial)},
|
||||
identifiers={(DECONZ_DOMAIN, self.serial)},
|
||||
identifiers={(DOMAIN, self.serial)},
|
||||
manufacturer=self._device.manufacturer,
|
||||
model=self._device.model_id,
|
||||
name=self._device.name,
|
||||
sw_version=self._device.software_version,
|
||||
via_device=(DECONZ_DOMAIN, self.hub.api.config.bridge_id),
|
||||
via_device=(DOMAIN, self.hub.api.config.bridge_id),
|
||||
)
|
||||
|
||||
|
||||
@@ -176,9 +176,9 @@ class DeconzSceneMixin(DeconzDevice[PydeconzScene]):
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return a device description for device registry."""
|
||||
return DeviceInfo(
|
||||
identifiers={(DECONZ_DOMAIN, self._group_identifier)},
|
||||
identifiers={(DOMAIN, self._group_identifier)},
|
||||
manufacturer="Dresden Elektronik",
|
||||
model="deCONZ group",
|
||||
name=self.group.name,
|
||||
via_device=(DECONZ_DOMAIN, self.hub.api.config.bridge_id),
|
||||
via_device=(DOMAIN, self.hub.api.config.bridge_id),
|
||||
)
|
||||
|
||||
@@ -38,7 +38,7 @@ from homeassistant.util.color import (
|
||||
)
|
||||
|
||||
from . import DeconzConfigEntry
|
||||
from .const import DOMAIN as DECONZ_DOMAIN, POWER_PLUGS
|
||||
from .const import DOMAIN, POWER_PLUGS
|
||||
from .entity import DeconzDevice
|
||||
from .hub import DeconzHub
|
||||
|
||||
@@ -395,11 +395,11 @@ class DeconzGroup(DeconzBaseLight[Group]):
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return a device description for device registry."""
|
||||
return DeviceInfo(
|
||||
identifiers={(DECONZ_DOMAIN, self.unique_id)},
|
||||
identifiers={(DOMAIN, self.unique_id)},
|
||||
manufacturer="Dresden Elektronik",
|
||||
model="deCONZ group",
|
||||
name=self._device.name,
|
||||
via_device=(DECONZ_DOMAIN, self.hub.api.config.bridge_id),
|
||||
via_device=(DOMAIN, self.hub.api.config.bridge_id),
|
||||
)
|
||||
|
||||
@property
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"documentation": "https://www.home-assistant.io/integrations/denonavr",
|
||||
"iot_class": "local_push",
|
||||
"loggers": ["denonavr"],
|
||||
"requirements": ["denonavr==1.0.1"],
|
||||
"requirements": ["denonavr==1.1.0"],
|
||||
"ssdp": [
|
||||
{
|
||||
"manufacturer": "Denon",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
},
|
||||
"data_description": {
|
||||
"round": "Controls the number of decimal digits in the output.",
|
||||
"time_window": "If set, the sensor's value is a time weighted moving average of derivatives within this window.",
|
||||
"time_window": "If set, the sensor's value is a time-weighted moving average of derivatives within this window.",
|
||||
"unit_prefix": "The output will be scaled according to the selected metric prefix and time unit of the derivative."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
],
|
||||
"quality_scale": "internal",
|
||||
"requirements": [
|
||||
"aiodhcpwatcher==1.1.1",
|
||||
"aiodiscover==2.6.1",
|
||||
"aiodhcpwatcher==1.2.0",
|
||||
"aiodiscover==2.7.0",
|
||||
"cached-ipaddress==0.10.0"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ async def async_validate_hostname(
|
||||
result = False
|
||||
with contextlib.suppress(DNSError):
|
||||
result = bool(
|
||||
await aiodns.DNSResolver(
|
||||
await aiodns.DNSResolver( # type: ignore[call-overload]
|
||||
nameservers=[resolver], udp_port=port, tcp_port=port
|
||||
).query(hostname, qtype)
|
||||
)
|
||||
|
||||
@@ -5,5 +5,5 @@
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/dnsip",
|
||||
"iot_class": "cloud_polling",
|
||||
"requirements": ["aiodns==3.3.0"]
|
||||
"requirements": ["aiodns==3.4.0"]
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class WanIpSensor(SensorEntity):
|
||||
async def async_update(self) -> None:
|
||||
"""Get the current DNS IP address for hostname."""
|
||||
try:
|
||||
response = await self.resolver.query(self.hostname, self.querytype)
|
||||
response = await self.resolver.query(self.hostname, self.querytype) # type: ignore[call-overload]
|
||||
except DNSError as err:
|
||||
_LOGGER.warning("Exception while resolving host: %s", err)
|
||||
response = None
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"events": "Comma separated list of events."
|
||||
"events": "Comma-separated list of events."
|
||||
},
|
||||
"data_description": {
|
||||
"events": "Add a comma separated event name for each event you wish to track. After entering them here, use the DoorBird app to assign them to a specific event.\n\nExample: somebody_pressed_the_button, motion"
|
||||
"events": "Add a comma-separated event name for each event you wish to track. After entering them here, use the DoorBird app to assign them to a specific event.\n\nExample: somebody_pressed_the_button, motion"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ from homeassistant.components.notify import ATTR_TARGET, BaseNotificationService
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import DOMAIN as DOVADO_DOMAIN
|
||||
from . import DOMAIN
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -19,7 +19,7 @@ def get_service(
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> DovadoSMSNotificationService:
|
||||
"""Get the Dovado Router SMS notification service."""
|
||||
return DovadoSMSNotificationService(hass.data[DOVADO_DOMAIN].client)
|
||||
return DovadoSMSNotificationService(hass.data[DOMAIN].client)
|
||||
|
||||
|
||||
class DovadoSMSNotificationService(BaseNotificationService):
|
||||
|
||||
@@ -20,7 +20,7 @@ from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import DOMAIN as DOVADO_DOMAIN
|
||||
from . import DOMAIN
|
||||
|
||||
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=30)
|
||||
|
||||
@@ -90,7 +90,7 @@ def setup_platform(
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the Dovado sensor platform."""
|
||||
dovado = hass.data[DOVADO_DOMAIN]
|
||||
dovado = hass.data[DOMAIN]
|
||||
|
||||
sensors = config[CONF_SENSORS]
|
||||
entities = [
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"phone_number": "Phone Number"
|
||||
"phone_number": "Phone number"
|
||||
}
|
||||
},
|
||||
"one_time_password": {
|
||||
"data": {
|
||||
"one_time_password": "One Time Password"
|
||||
"one_time_password": "One-time password"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"advertise_ip": "Advertise IP Address",
|
||||
"advertise_port": "Advertise Port",
|
||||
"host_ip": "Host IP Address",
|
||||
"listen_port": "Listen Port",
|
||||
"advertise_ip": "Advertise IP address",
|
||||
"advertise_port": "Advertise port",
|
||||
"host_ip": "Host IP address",
|
||||
"listen_port": "Listen port",
|
||||
"name": "[%key:common::config_flow::data::name%]",
|
||||
"upnp_bind_multicast": "Bind multicast (True/False)"
|
||||
"upnp_bind_multicast": "Bind multicast"
|
||||
},
|
||||
"title": "Define server configuration"
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ VALID_ENERGY_UNITS_GAS = {
|
||||
UnitOfVolume.CENTUM_CUBIC_FEET,
|
||||
UnitOfVolume.CUBIC_FEET,
|
||||
UnitOfVolume.CUBIC_METERS,
|
||||
UnitOfVolume.LITERS,
|
||||
*VALID_ENERGY_UNITS,
|
||||
}
|
||||
VALID_VOLUME_UNITS_WATER: set[str] = {
|
||||
|
||||
@@ -50,6 +50,7 @@ GAS_USAGE_UNITS: dict[str, tuple[UnitOfEnergy | UnitOfVolume, ...]] = {
|
||||
UnitOfVolume.CENTUM_CUBIC_FEET,
|
||||
UnitOfVolume.CUBIC_FEET,
|
||||
UnitOfVolume.CUBIC_METERS,
|
||||
UnitOfVolume.LITERS,
|
||||
),
|
||||
}
|
||||
GAS_PRICE_UNITS = tuple(
|
||||
|
||||
@@ -64,7 +64,7 @@ async def _get_fixture_collection(envoy: Envoy, serial: str) -> dict[str, Any]:
|
||||
"/ivp/ensemble/generator",
|
||||
"/ivp/meters",
|
||||
"/ivp/meters/readings",
|
||||
"/home,",
|
||||
"/home",
|
||||
]
|
||||
|
||||
for end_point in end_points:
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"iot_class": "local_polling",
|
||||
"loggers": ["pyenphase"],
|
||||
"quality_scale": "platinum",
|
||||
"requirements": ["pyenphase==1.26.0"],
|
||||
"requirements": ["pyenphase==1.26.1"],
|
||||
"zeroconf": [
|
||||
{
|
||||
"type": "_enphase-envoy._tcp.local."
|
||||
|
||||
@@ -134,6 +134,22 @@ def esphome_state_property[_R, _EntityT: EsphomeEntity[Any, Any]](
|
||||
return _wrapper
|
||||
|
||||
|
||||
def async_esphome_state_property[_R, _EntityT: EsphomeEntity[Any, Any]](
|
||||
func: Callable[[_EntityT], Awaitable[_R | None]],
|
||||
) -> Callable[[_EntityT], Coroutine[Any, Any, _R | None]]:
|
||||
"""Wrap a state property of an esphome entity.
|
||||
|
||||
This checks if the state object in the entity is set
|
||||
and returns None if it is not set.
|
||||
"""
|
||||
|
||||
@functools.wraps(func)
|
||||
async def _wrapper(self: _EntityT) -> _R | None:
|
||||
return await func(self) if self._has_state else None
|
||||
|
||||
return _wrapper
|
||||
|
||||
|
||||
def esphome_float_state_property[_EntityT: EsphomeEntity[Any, Any]](
|
||||
func: Callable[[_EntityT], float | None],
|
||||
) -> Callable[[_EntityT], float | None]:
|
||||
|
||||
@@ -8,6 +8,7 @@ from collections.abc import Callable, Iterable
|
||||
from dataclasses import dataclass, field
|
||||
from functools import partial
|
||||
import logging
|
||||
from operator import delitem
|
||||
from typing import TYPE_CHECKING, Any, Final, TypedDict, cast
|
||||
|
||||
from aioesphomeapi import (
|
||||
@@ -183,18 +184,7 @@ class RuntimeEntryData:
|
||||
"""Register to receive callbacks when static info changes for an EntityInfo type."""
|
||||
callbacks = self.entity_info_callbacks.setdefault(entity_info_type, [])
|
||||
callbacks.append(callback_)
|
||||
return partial(
|
||||
self._async_unsubscribe_register_static_info, callbacks, callback_
|
||||
)
|
||||
|
||||
@callback
|
||||
def _async_unsubscribe_register_static_info(
|
||||
self,
|
||||
callbacks: list[Callable[[list[EntityInfo]], None]],
|
||||
callback_: Callable[[list[EntityInfo]], None],
|
||||
) -> None:
|
||||
"""Unsubscribe to when static info is registered."""
|
||||
callbacks.remove(callback_)
|
||||
return partial(callbacks.remove, callback_)
|
||||
|
||||
@callback
|
||||
def async_register_key_static_info_updated_callback(
|
||||
@@ -206,18 +196,7 @@ class RuntimeEntryData:
|
||||
callback_key = (type(static_info), static_info.key)
|
||||
callbacks = self.entity_info_key_updated_callbacks.setdefault(callback_key, [])
|
||||
callbacks.append(callback_)
|
||||
return partial(
|
||||
self._async_unsubscribe_static_key_info_updated, callbacks, callback_
|
||||
)
|
||||
|
||||
@callback
|
||||
def _async_unsubscribe_static_key_info_updated(
|
||||
self,
|
||||
callbacks: list[Callable[[EntityInfo], None]],
|
||||
callback_: Callable[[EntityInfo], None],
|
||||
) -> None:
|
||||
"""Unsubscribe to when static info is updated ."""
|
||||
callbacks.remove(callback_)
|
||||
return partial(callbacks.remove, callback_)
|
||||
|
||||
@callback
|
||||
def async_set_assist_pipeline_state(self, state: bool) -> None:
|
||||
@@ -232,14 +211,7 @@ class RuntimeEntryData:
|
||||
) -> CALLBACK_TYPE:
|
||||
"""Subscribe to assist pipeline updates."""
|
||||
self.assist_pipeline_update_callbacks.append(update_callback)
|
||||
return partial(self._async_unsubscribe_assist_pipeline_update, update_callback)
|
||||
|
||||
@callback
|
||||
def _async_unsubscribe_assist_pipeline_update(
|
||||
self, update_callback: CALLBACK_TYPE
|
||||
) -> None:
|
||||
"""Unsubscribe to assist pipeline updates."""
|
||||
self.assist_pipeline_update_callbacks.remove(update_callback)
|
||||
return partial(self.assist_pipeline_update_callbacks.remove, update_callback)
|
||||
|
||||
@callback
|
||||
def async_remove_entities(
|
||||
@@ -337,12 +309,7 @@ class RuntimeEntryData:
|
||||
def async_subscribe_device_updated(self, callback_: CALLBACK_TYPE) -> CALLBACK_TYPE:
|
||||
"""Subscribe to state updates."""
|
||||
self.device_update_subscriptions.add(callback_)
|
||||
return partial(self._async_unsubscribe_device_update, callback_)
|
||||
|
||||
@callback
|
||||
def _async_unsubscribe_device_update(self, callback_: CALLBACK_TYPE) -> None:
|
||||
"""Unsubscribe to device updates."""
|
||||
self.device_update_subscriptions.remove(callback_)
|
||||
return partial(self.device_update_subscriptions.remove, callback_)
|
||||
|
||||
@callback
|
||||
def async_subscribe_static_info_updated(
|
||||
@@ -350,14 +317,7 @@ class RuntimeEntryData:
|
||||
) -> CALLBACK_TYPE:
|
||||
"""Subscribe to static info updates."""
|
||||
self.static_info_update_subscriptions.add(callback_)
|
||||
return partial(self._async_unsubscribe_static_info_updated, callback_)
|
||||
|
||||
@callback
|
||||
def _async_unsubscribe_static_info_updated(
|
||||
self, callback_: Callable[[list[EntityInfo]], None]
|
||||
) -> None:
|
||||
"""Unsubscribe to static info updates."""
|
||||
self.static_info_update_subscriptions.remove(callback_)
|
||||
return partial(self.static_info_update_subscriptions.remove, callback_)
|
||||
|
||||
@callback
|
||||
def async_subscribe_state_update(
|
||||
@@ -369,14 +329,7 @@ class RuntimeEntryData:
|
||||
"""Subscribe to state updates."""
|
||||
subscription_key = (state_type, state_key)
|
||||
self.state_subscriptions[subscription_key] = entity_callback
|
||||
return partial(self._async_unsubscribe_state_update, subscription_key)
|
||||
|
||||
@callback
|
||||
def _async_unsubscribe_state_update(
|
||||
self, subscription_key: tuple[type[EntityState], int]
|
||||
) -> None:
|
||||
"""Unsubscribe to state updates."""
|
||||
self.state_subscriptions.pop(subscription_key)
|
||||
return partial(delitem, self.state_subscriptions, subscription_key)
|
||||
|
||||
@callback
|
||||
def async_update_state(self, state: EntityState) -> None:
|
||||
@@ -523,7 +476,7 @@ class RuntimeEntryData:
|
||||
) -> CALLBACK_TYPE:
|
||||
"""Register to receive callbacks when the Assist satellite's configuration is updated."""
|
||||
self.assist_satellite_config_update_callbacks.append(callback_)
|
||||
return lambda: self.assist_satellite_config_update_callbacks.remove(callback_)
|
||||
return partial(self.assist_satellite_config_update_callbacks.remove, callback_)
|
||||
|
||||
@callback
|
||||
def async_assist_satellite_config_updated(
|
||||
@@ -540,7 +493,7 @@ class RuntimeEntryData:
|
||||
) -> CALLBACK_TYPE:
|
||||
"""Register to receive callbacks when the Assist satellite's wake word is set."""
|
||||
self.assist_satellite_set_wake_word_callbacks.append(callback_)
|
||||
return lambda: self.assist_satellite_set_wake_word_callbacks.remove(callback_)
|
||||
return partial(self.assist_satellite_set_wake_word_callbacks.remove, callback_)
|
||||
|
||||
@callback
|
||||
def async_assist_satellite_set_wake_word(self, wake_word_id: str) -> None:
|
||||
|
||||
@@ -63,7 +63,7 @@ class EsphomeFan(EsphomeEntity[FanInfo, FanState], FanEntity):
|
||||
if self._supports_speed_levels:
|
||||
data["speed_level"] = math.ceil(
|
||||
percentage_to_ranged_value(
|
||||
(1, self._static_info.supported_speed_levels), percentage
|
||||
(1, self._static_info.supported_speed_count), percentage
|
||||
)
|
||||
)
|
||||
else:
|
||||
@@ -121,7 +121,7 @@ class EsphomeFan(EsphomeEntity[FanInfo, FanState], FanEntity):
|
||||
)
|
||||
|
||||
return ranged_value_to_percentage(
|
||||
(1, self._static_info.supported_speed_levels), self._state.speed_level
|
||||
(1, self._static_info.supported_speed_count), self._state.speed_level
|
||||
)
|
||||
|
||||
@property
|
||||
@@ -164,7 +164,7 @@ class EsphomeFan(EsphomeEntity[FanInfo, FanState], FanEntity):
|
||||
if not supports_speed_levels:
|
||||
self._attr_speed_count = len(ORDERED_NAMED_FAN_SPEEDS)
|
||||
else:
|
||||
self._attr_speed_count = static_info.supported_speed_levels
|
||||
self._attr_speed_count = static_info.supported_speed_count
|
||||
|
||||
|
||||
async_setup_entry = partial(
|
||||
|
||||
@@ -8,6 +8,7 @@ from typing import TYPE_CHECKING, Any, cast
|
||||
|
||||
from aioesphomeapi import (
|
||||
APIVersion,
|
||||
ColorMode as ESPHomeColorMode,
|
||||
EntityInfo,
|
||||
LightColorCapability,
|
||||
LightInfo,
|
||||
@@ -106,15 +107,15 @@ def _mired_to_kelvin(mired_temperature: float) -> int:
|
||||
|
||||
|
||||
@lru_cache
|
||||
def _color_mode_to_ha(mode: int) -> str:
|
||||
def _color_mode_to_ha(mode: ESPHomeColorMode) -> ColorMode:
|
||||
"""Convert an esphome color mode to a HA color mode constant.
|
||||
|
||||
Choose the color mode that best matches the feature-set.
|
||||
"""
|
||||
candidates = []
|
||||
candidates: list[tuple[ColorMode, LightColorCapability]] = []
|
||||
for ha_mode, cap_lists in _COLOR_MODE_MAPPING.items():
|
||||
for caps in cap_lists:
|
||||
if caps == mode:
|
||||
if caps.value == mode:
|
||||
# exact match
|
||||
return ha_mode
|
||||
if (mode & caps) == caps:
|
||||
@@ -131,8 +132,8 @@ def _color_mode_to_ha(mode: int) -> str:
|
||||
|
||||
@lru_cache
|
||||
def _filter_color_modes(
|
||||
supported: list[int], features: LightColorCapability
|
||||
) -> tuple[int, ...]:
|
||||
supported: list[ESPHomeColorMode], features: LightColorCapability
|
||||
) -> tuple[ESPHomeColorMode, ...]:
|
||||
"""Filter the given supported color modes.
|
||||
|
||||
Excluding all values that don't have the requested features.
|
||||
@@ -156,7 +157,7 @@ def _least_complex_color_mode(color_modes: tuple[int, ...]) -> int:
|
||||
class EsphomeLight(EsphomeEntity[LightInfo, LightState], LightEntity):
|
||||
"""A light implementation for ESPHome."""
|
||||
|
||||
_native_supported_color_modes: tuple[int, ...]
|
||||
_native_supported_color_modes: tuple[ESPHomeColorMode, ...]
|
||||
_supports_color_mode = False
|
||||
|
||||
@property
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"mqtt": ["esphome/discover/#"],
|
||||
"quality_scale": "platinum",
|
||||
"requirements": [
|
||||
"aioesphomeapi==30.1.0",
|
||||
"aioesphomeapi==31.0.0",
|
||||
"esphome-dashboard-api==1.3.0",
|
||||
"bleak-esphome==2.15.1"
|
||||
],
|
||||
|
||||
@@ -88,9 +88,9 @@ class EsphomeSensor(EsphomeEntity[SensorInfo, SensorState], SensorEntity):
|
||||
return
|
||||
if (
|
||||
state_class == EsphomeSensorStateClass.MEASUREMENT
|
||||
and static_info.last_reset_type == LastResetType.AUTO
|
||||
and static_info.legacy_last_reset_type == LastResetType.AUTO
|
||||
):
|
||||
# Legacy, last_reset_type auto was the equivalent to the
|
||||
# Legacy, legacy_last_reset_type auto was the equivalent to the
|
||||
# TOTAL_INCREASING state class
|
||||
self._attr_state_class = SensorStateClass.TOTAL_INCREASING
|
||||
else:
|
||||
|
||||
@@ -195,7 +195,10 @@
|
||||
"message": "Error compiling {configuration}; Try again in ESPHome dashboard for more information."
|
||||
},
|
||||
"error_uploading": {
|
||||
"message": "Error during OTA of {configuration}; Try again in ESPHome dashboard for more information."
|
||||
"message": "Error during OTA (Over-The-Air) of {configuration}; Try again in ESPHome dashboard for more information."
|
||||
},
|
||||
"ota_in_progress": {
|
||||
"message": "An OTA (Over-The-Air) update is already in progress for {configuration}."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ from .coordinator import ESPHomeDashboardCoordinator
|
||||
from .dashboard import async_get_dashboard
|
||||
from .entity import (
|
||||
EsphomeEntity,
|
||||
async_esphome_state_property,
|
||||
convert_api_error_ha_error,
|
||||
esphome_state_property,
|
||||
platform_async_setup_entry,
|
||||
@@ -125,21 +126,17 @@ class ESPHomeDashboardUpdateEntity(
|
||||
(dr.CONNECTION_NETWORK_MAC, entry_data.device_info.mac_address)
|
||||
}
|
||||
)
|
||||
self._install_lock = asyncio.Lock()
|
||||
self._available_future: asyncio.Future[None] | None = None
|
||||
self._update_attrs()
|
||||
|
||||
@callback
|
||||
def _update_attrs(self) -> None:
|
||||
"""Update the supported features."""
|
||||
# If the device has deep sleep, we can't assume we can install updates
|
||||
# as the ESP will not be connectable (by design).
|
||||
coordinator = self.coordinator
|
||||
device_info = self._device_info
|
||||
# Install support can change at run time
|
||||
if (
|
||||
coordinator.last_update_success
|
||||
and coordinator.supports_update
|
||||
and not device_info.has_deep_sleep
|
||||
):
|
||||
if coordinator.last_update_success and coordinator.supports_update:
|
||||
self._attr_supported_features = UpdateEntityFeature.INSTALL
|
||||
else:
|
||||
self._attr_supported_features = NO_FEATURES
|
||||
@@ -178,6 +175,13 @@ class ESPHomeDashboardUpdateEntity(
|
||||
self, static_info: list[EntityInfo] | None = None
|
||||
) -> None:
|
||||
"""Handle updated data from the device."""
|
||||
if (
|
||||
self._entry_data.available
|
||||
and self._available_future
|
||||
and not self._available_future.done()
|
||||
):
|
||||
self._available_future.set_result(None)
|
||||
self._available_future = None
|
||||
self._update_attrs()
|
||||
self.async_write_ha_state()
|
||||
|
||||
@@ -192,17 +196,46 @@ class ESPHomeDashboardUpdateEntity(
|
||||
entry_data.async_subscribe_device_updated(self._handle_device_update)
|
||||
)
|
||||
|
||||
async def async_will_remove_from_hass(self) -> None:
|
||||
"""Handle entity about to be removed from Home Assistant."""
|
||||
if self._available_future and not self._available_future.done():
|
||||
self._available_future.cancel()
|
||||
self._available_future = None
|
||||
|
||||
async def _async_wait_available(self) -> None:
|
||||
"""Wait until the device is available."""
|
||||
# If the device has deep sleep, we need to wait for it to wake up
|
||||
# and connect to the network to be able to install the update.
|
||||
if self._entry_data.available:
|
||||
return
|
||||
self._available_future = self.hass.loop.create_future()
|
||||
try:
|
||||
await self._available_future
|
||||
finally:
|
||||
self._available_future = None
|
||||
|
||||
async def async_install(
|
||||
self, version: str | None, backup: bool, **kwargs: Any
|
||||
) -> None:
|
||||
"""Install an update."""
|
||||
async with self.hass.data.setdefault(KEY_UPDATE_LOCK, asyncio.Lock()):
|
||||
coordinator = self.coordinator
|
||||
api = coordinator.api
|
||||
device = coordinator.data.get(self._device_info.name)
|
||||
assert device is not None
|
||||
configuration = device["configuration"]
|
||||
try:
|
||||
if self._install_lock.locked():
|
||||
raise HomeAssistantError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="ota_in_progress",
|
||||
translation_placeholders={
|
||||
"configuration": self._device_info.name,
|
||||
},
|
||||
)
|
||||
|
||||
# Ensure only one OTA per device at a time
|
||||
async with self._install_lock:
|
||||
# Ensure only one compile at a time for ALL devices
|
||||
async with self.hass.data.setdefault(KEY_UPDATE_LOCK, asyncio.Lock()):
|
||||
coordinator = self.coordinator
|
||||
api = coordinator.api
|
||||
device = coordinator.data.get(self._device_info.name)
|
||||
assert device is not None
|
||||
configuration = device["configuration"]
|
||||
if not await api.compile(configuration):
|
||||
raise HomeAssistantError(
|
||||
translation_domain=DOMAIN,
|
||||
@@ -211,14 +244,25 @@ class ESPHomeDashboardUpdateEntity(
|
||||
"configuration": configuration,
|
||||
},
|
||||
)
|
||||
if not await api.upload(configuration, "OTA"):
|
||||
raise HomeAssistantError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="error_uploading",
|
||||
translation_placeholders={
|
||||
"configuration": configuration,
|
||||
},
|
||||
)
|
||||
|
||||
# If the device uses deep sleep, there's a small chance it goes
|
||||
# to sleep right after the dashboard connects but before the OTA
|
||||
# starts. In that case, the update won't go through, so we try
|
||||
# again to catch it on its next wakeup.
|
||||
attempts = 2 if self._device_info.has_deep_sleep else 1
|
||||
try:
|
||||
for attempt in range(1, attempts + 1):
|
||||
await self._async_wait_available()
|
||||
if await api.upload(configuration, "OTA"):
|
||||
break
|
||||
if attempt == attempts:
|
||||
raise HomeAssistantError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="error_uploading",
|
||||
translation_placeholders={
|
||||
"configuration": configuration,
|
||||
},
|
||||
)
|
||||
finally:
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
@@ -227,7 +271,9 @@ class ESPHomeUpdateEntity(EsphomeEntity[UpdateInfo, UpdateState], UpdateEntity):
|
||||
"""A update implementation for esphome."""
|
||||
|
||||
_attr_supported_features = (
|
||||
UpdateEntityFeature.INSTALL | UpdateEntityFeature.PROGRESS
|
||||
UpdateEntityFeature.INSTALL
|
||||
| UpdateEntityFeature.PROGRESS
|
||||
| UpdateEntityFeature.RELEASE_NOTES
|
||||
)
|
||||
|
||||
@callback
|
||||
@@ -257,11 +303,12 @@ class ESPHomeUpdateEntity(EsphomeEntity[UpdateInfo, UpdateState], UpdateEntity):
|
||||
"""Return the latest version."""
|
||||
return self._state.latest_version
|
||||
|
||||
@property
|
||||
@esphome_state_property
|
||||
def release_summary(self) -> str:
|
||||
"""Return the release summary."""
|
||||
return self._state.release_summary
|
||||
@async_esphome_state_property
|
||||
async def async_release_notes(self) -> str | None:
|
||||
"""Return the release notes."""
|
||||
if self._state.release_summary:
|
||||
return self._state.release_summary
|
||||
return None
|
||||
|
||||
@property
|
||||
@esphome_state_property
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
import logging
|
||||
|
||||
from pyezviz.client import EzvizClient
|
||||
from pyezviz.exceptions import (
|
||||
from pyezvizapi.client import EzvizClient
|
||||
from pyezvizapi.exceptions import (
|
||||
EzvizAuthTokenExpired,
|
||||
EzvizAuthVerificationCode,
|
||||
HTTPError,
|
||||
|
||||
@@ -6,8 +6,8 @@ from dataclasses import dataclass
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from pyezviz import PyEzvizError
|
||||
from pyezviz.constants import DefenseModeType
|
||||
from pyezvizapi import PyEzvizError
|
||||
from pyezvizapi.constants import DefenseModeType
|
||||
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
AlarmControlPanelEntity,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user