Compare commits

...

186 Commits

Author SHA1 Message Date
Paulus Schoutsen
40c71fbaa9 Ignore variants for pt raquel voice 2025-05-06 17:31:57 +00:00
epenet
a673bd7a91 Use runtime_data in here_travel_time (#144340) 2025-05-06 19:16:14 +02:00
J. Nick Koston
121e9e4e7f Bump aioesphomeapi to 30.2.0 (#144348) 2025-05-06 19:13:51 +02:00
J. Nick Koston
452e946509 Bump bluemaestro-ble to 0.4.1 (#144345)
changelog: https://github.com/Bluetooth-Devices/bluemaestro-ble/compare/v0.4.0...v0.4.1

fixes #https://github.com/home-assistant/core/issues/144339
2025-05-06 18:32:35 +03:00
Martin Hjelmare
c3ce82d874 Fix Z-Wave migration flow to unload config entry before unplugging controller (#144343)
* Fix Z-Wave migration unload config entry before unplugging controller

* Remove typo
2025-05-06 17:57:11 +03:00
epenet
253217958b Use runtime_data in google (#144331)
* Use runtime_data in google

* Quality scale
2025-05-06 07:55:04 -07:00
epenet
1447392847 Use runtime_data in guardian (#144344)
* Use runtime_data in guardian

* Adjust tests
2025-05-06 16:16:16 +02:00
epenet
32a6b8a0f8 Use runtime_data in goodwe (#144325) 2025-05-06 16:04:12 +02:00
Robert Resch
0ec7dc5654 Add endpoint validation for AWS S3 (#144334) 2025-05-06 15:54:42 +02:00
epenet
bdf6f7f590 Use config entry title to name SamsungTV entities (#144254) 2025-05-06 15:52:33 +02:00
epenet
fbae79fab2 Use runtime_data in google_assistant_sdk (#144335) 2025-05-06 15:52:00 +02:00
epenet
2c34712069 Move service definitions to separate module in guardian (#144306)
* Move service definitions to separate module in guardian

* docstring
2025-05-06 15:37:10 +02:00
Martin Hjelmare
40e3038775 Fix Z-Wave to reload config entry after migration nvm restore (#144338) 2025-05-06 15:26:45 +02:00
epenet
e2c02706a0 Use runtime_data in google_assistant (#144332) 2025-05-06 15:20:18 +02:00
Stefan Agner
313be7b30a Update Home Assistant base image to 2025.05.0 (#144333) 2025-05-06 14:49:47 +02:00
Jan Bouwhuis
d0ed8b67c4 Add MQTT button as entity platform on MQTT subentries (#144204) 2025-05-06 13:57:27 +02:00
epenet
deaaf2f082 Drop alias from local const DOMAIN import (#144312) 2025-05-06 13:35:27 +02:00
Robert Resch
ce95876d03 Rename S3 to AWS_S3 (#144324) 2025-05-06 13:29:37 +02:00
epenet
5475d7ef58 Use runtime_data in freebox (#144326) 2025-05-06 13:09:56 +02:00
epenet
687c74ee4c Remove deprecated freebox reboot service (#144303) 2025-05-06 12:21:48 +02:00
Simone Chemelli
c9a9488ff5 Manage unsupported sources on Samsung TV (#144221) 2025-05-06 12:20:04 +02:00
epenet
57217b46ed Use runtime_data in gogogate2 (#144322) 2025-05-06 12:14:46 +02:00
epenet
5a01521ff8 Use runtime_data in geonetnz_volcano (#144320) 2025-05-06 12:06:00 +02:00
Robert Resch
19a0a16915 Revert "Disable S3 checksums" (#144092) (#144318) 2025-05-06 12:01:27 +02:00
epenet
62877c2c58 Use runtime_data in geonetnz_quakes (#144319) 2025-05-06 11:58:25 +02:00
Joakim Sørensen
9479874bb4 Remove ThingTalk server configuration and related websocket command from cloud integration (#144301) 2025-05-06 11:49:44 +02:00
epenet
241b6a0170 Improve type hints in gc100 (#144308) 2025-05-06 11:01:46 +02:00
Arnie97
babc183834 Allow liter for gas sensor device class (#141518) 2025-05-06 10:59:09 +02:00
Joakim Sørensen
f3371bcf39 Add async_delete_repair_issue method to CloudClient (#144302) 2025-05-06 10:57:56 +02:00
epenet
33da5465bd Use runtime_data in gdacs (#144309) 2025-05-06 10:44:16 +02:00
epenet
5df3a9d76d Use runtime_data in geocaching (#144310) 2025-05-06 10:41:56 +02:00
Martin Hjelmare
ec4f4a4a1f Fix Z-Wave USB discovery to use serial by id path (#144314) 2025-05-06 11:33:58 +03:00
Jan Bouwhuis
46df29b390 Add MQTT binary_sensor as entity platform on MQTT subentries (#144142)
Add MQTT binary_sensor subentry support
2025-05-06 10:23:19 +02:00
epenet
60846434d3 Invert DOMAIN alias in telegram (#144313) 2025-05-06 10:05:12 +02:00
epenet
66c86c0461 Drop alias from local DOMAIN import (#144311) 2025-05-06 09:55:57 +02:00
Cerallin
73996fb916 Bump xiaomi-ble to 0.38.0 (#143885) 2025-05-06 09:55:43 +02:00
Ivan Lopez Hernandez
0edfbded23 Fixes #140182 by checking file status before sending the prompt. (#144131)
* Added unit tests

* Addressed review comments

* Fixed tests

* PR comments
2025-05-05 23:45:39 -07:00
Norbert Rittel
212c3ddcca Use international English spelling for "authorization" in reolink (#144305)
Use international English for "authorization" in `reolink`
2025-05-06 08:34:40 +02:00
Jamin
edcb090209 Bump VoIP utils to 0.3.2 (#144298) 2025-05-05 22:50:46 -04:00
Michael
92010e1fca Fix un-/re-load of Feedreader integration (#144285)
fix unload platforms call
2025-05-05 22:39:25 -04:00
Jan Bouwhuis
12f9a11716 Fix mqtt subentry device name is not required but should be (#144289)
Fix mqtt subentry device name is not required
2025-05-05 22:39:03 -04:00
Pete Sage
0dd21f4c89 Rehlko adjust timeouts for coordinator polls (#144297) 2025-05-05 21:37:54 -05:00
Jamin
14f967cdd0 Improve Voip pipeline stability (#137620)
* Improve Voip pipeline stability

It appears the pipeline is being unexpectedly cancelled in some
instances. In order to mitigate this issue hang ups will be detected
using a separate task rather than relying on timeouts in the STT read
method. Also reading STT events will be retried once if it is cancelled.
The pipeline will also catch and log any CancelledErrors to help with
further debugging.

* Update Voip tests

* Remove unnecessary changes

Remove unnecessary logging and cancelled error handling in wyoming STT.

* Remove comment about clearing system prompt

The test no longer checks for clearing the system prompt. Since that
logic exists completely in the assist_satellite component I think it is
reasonable to only test that logic in the unit tests for that component.

* Re-raise cancellation

Re-raise CancelledError if the current task is cancelling in the check hangup task

Co-authored-by: J. Nick Koston <nick@koston.org>

* Re-raise CancelledError in pipeline as well

* Fix formatting issue

* Remove unnecessary logging

* Add MockResultStream import to tests

This was presumably missed while merging

* Cancel check hangup task on disconnect

* Add myself as codeowner for VoIP

* Update CODEOWNERS

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2025-05-05 20:25:52 -04:00
Norbert Rittel
f3b23afc92 Change "recognized" to international English spelling in hive (#144284)
Change "recognized" to international English in `hive`
2025-05-06 00:15:24 +03:00
Jan Bouwhuis
0bf807b96e Fix default entity name not the device default entity when no name set on MQTT subentry entity (#144263) 2025-05-05 21:26:56 +02:00
Martin Hjelmare
1879b8c27f Fix Z-Wave config flow forms (#144279) 2025-05-05 15:02:20 -04:00
Paul Bottein
e3ed9fac78 Update frontend to 20250502.1 (#144276) 2025-05-05 14:47:15 -04:00
Josef Zweck
b98a27d3d0 Bump pylamarzocco to 2.0.0 (#144275) 2025-05-05 20:43:51 +02:00
Eliz
c73383ded3 Fix missing head forwarding in ingress (#144231)
* Add support for connect, head and trace in ingress

* added tests

* update the testutil

* fix

* fix empty space

* removed connect

* remove trace
2025-05-05 19:11:41 +02:00
Erik Montnemery
36a08d04c5 Fail tests which JSON serialize mocks (#144261)
* Fail tests which JSON serialize mocks

* Patch JSON helper earlier

* Check type instead of attribute
2025-05-05 19:06:54 +02:00
Åke Strandberg
8a95fffbab Remove program phase sensor from miele vacuum robot (#144257)
* Use device class transation

* Remove program pghses sensor from robot vacuum cleaner
2025-05-05 18:41:45 +02:00
Erik Montnemery
633c770a48 Fix matter mocks (#144271) 2025-05-05 17:59:57 +02:00
Erik Montnemery
826d28974b Fix fibaro mocks (#144270) 2025-05-05 17:59:50 +02:00
Erik Montnemery
135df5a24e Fix palazzetti mocks (#144268) 2025-05-05 17:59:17 +02:00
Erik Montnemery
2e8e13bffb Fix velbus mocks (#144267) 2025-05-05 17:59:08 +02:00
Erik Montnemery
5e8def837e Fix imeon_inverter mocks (#144266) 2025-05-05 17:58:58 +02:00
Erik Montnemery
14735cce26 Fix deako mocks (#144265) 2025-05-05 17:58:48 +02:00
Erik Montnemery
d775e443f8 Fix balboa mocks (#144264) 2025-05-05 17:58:39 +02:00
Luke Lashley
aa8dfa760d Bump Roborock Map Parser to 0.1.4 (#144260)
Bump to 0.1.4
2025-05-05 07:40:48 -07:00
tronikos
0043b18135 Use names instead of statistic IDs in the Opower repair issue (#144018)
* Use names instead of statistic IDs in the Opower repair issue

* target_ids
2025-05-05 08:36:58 -04:00
Luca De Petrillo
c14ddedfae Fix message corruption in picotts component (#141182) 2025-05-05 14:30:36 +02:00
Markus Jacobsen
a073a6b01e Fix hassfest expecting strings file for custom components (#135789)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
Co-authored-by: Robert Resch <robert@resch.dev>
2025-05-05 14:23:02 +02:00
epenet
0713ac4977 Cleanup invalid CONF_ID from samsungtv tests (#144252) 2025-05-05 13:47:07 +02:00
Allen Porter
3390dc0dbb Fix Office 365 calendars to be compatible with rfc5545 (#144230) 2025-05-05 13:13:08 +02:00
dependabot[bot]
445b38f25d Bump github/codeql-action from 3.28.16 to 3.28.17 (#144245)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.16 to 3.28.17.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v3.28.16...v3.28.17)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.28.17
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-05 12:51:19 +02:00
John Hillery
9e4a20c267 Bump nexia to 2.9.0 (#144153)
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Robert Resch <robert@resch.dev>
2025-05-05 11:40:37 +01:00
epenet
d88cd72d13 Move more SamsungTV test constants to fixture files (#144249)
* Add SSDP fixtures to SamsungTV

* Adjust

* Improve

* Improve
2025-05-05 11:58:24 +02:00
tronikos
66b2e06cd3 Fix Invalid statistic_id for Opower: National Grid (#144243)
Co-authored-by: J. Nick Koston <nick+github@koston.org>
2025-05-05 11:35:32 +02:00
Michael
58906008b9 Add last attempted automatic backup sensor (#144194)
add last_attempted_automatic_backup sensor
2025-05-05 10:39:06 +02:00
Ville Skyttä
aa062515b8 Remove unused huawei_lte YAML schemas, error out on YAML config (#144217) 2025-05-05 10:46:30 +03:00
Norbert Rittel
65da1e79b9 Change some strings to international English in fronius (#144244)
Change to international English in `fronius`
2025-05-05 10:39:23 +03:00
Brett Adams
41ecb24135 Set api type more specifically in Teslemetry (#144178)
* Set api type more specifically

* remove extra spacing

* Fix class after rebase

---------

Co-authored-by: Allen Porter <allen@thebends.org>
2025-05-04 21:54:00 -07:00
Brett Adams
e3b3c32751 Add valet switch to Teslemetry (#144167)
* Add valet switch

* Add snapshot
2025-05-05 06:28:01 +02:00
Allen Porter
e2a8137140 Bump ical to 9.2.0 (#144240) 2025-05-04 23:40:49 -04:00
Allen Porter
fa6a2f08ab Update remote calendar to do all event handling in an executor (#144232) 2025-05-04 23:07:02 -04:00
Allen Porter
68d62ab58e Update local calendar to process calendar events in the executor (#144233) 2025-05-04 23:06:27 -04:00
Allen Porter
c6b9a40234 Increase the local calendar update interval to avoid re-parsing the calendar state unnecessarily (#144234) 2025-05-04 23:05:33 -04:00
Luke Lashley
e0916fdd26 Change roborock to use home_data_v3 (#144238) 2025-05-04 20:02:32 -07:00
Luke Lashley
cad2d72ed9 Bump python-roborock to 2.18.2 (#144235) 2025-05-04 16:59:49 -07:00
Norbert Rittel
8eaddbf2b2 Replace "log-in" with "log in" in zwave_me (#144223) 2025-05-04 21:56:33 +03:00
Norbert Rittel
9b30f32cad Replace "Sign-in …" with "Sign in …" in ring (#144222)
The config flow titles in Home Assistant use verbs by default ("Set up …" / "Configure …" / "Select …" etc.

Therefore "Sign-in …" (noun) for the initial setup in `ring` is replaced with "Sign in …" (verb).
2025-05-04 21:12:01 +03:00
Norbert Rittel
c2a69bcb20 Improve user-facing strings of blink (#144219)
- treat "sign in" as verb for consistency, removing the hyphen
- fix sentence-casing of two strings
2025-05-04 20:36:57 +03:00
Norbert Rittel
2e7b60c3ca Fix spelling of "sign in" and "setup" in verisure (#144214)
- use "sign in" for the verb
- use "setup" for the noun
- fix sentence-casing of "Verification code"
2025-05-04 20:36:24 +03:00
Norbert Rittel
eca811d0d4 Fix sentence-casing in user-facing strings of tami4 (#144212)
Fix sentence-casing in user-facing string of `tami4`
2025-05-04 20:35:59 +03:00
Norbert Rittel
8e202bc202 Improve the user-facing strings of heos (#144218) 2025-05-04 12:13:53 -05:00
J. Nick Koston
429682cecd Remove unnecessary intermediate functions in entry_data for ESPHome (#144173) 2025-05-04 11:42:07 -05:00
Pete Sage
9cd2080de2 Avoid delaying HA startup in Rehlko (#144202) 2025-05-04 11:41:39 -05:00
Pete Sage
2960271b81 bump aiokem to 0.5.10 (#144203) 2025-05-04 11:15:01 -05:00
Paulus Schoutsen
8048d2bfb8 Fix intent TurnOn creating stack trace for buttons (#144205) 2025-05-04 09:00:40 -07:00
Norbert Rittel
490bb46a82 Make spelling of "Auto-charge" switch consistent in TechnoVE (#144206)
* Make spelling of "Auto-charge" switch consistent in TechnoVE

Also fix sentence-casing in "Charging enabled" switch.

* Update test_switch.ambr
2025-05-04 18:56:25 +03:00
Norbert Rittel
1199353204 Fix sentence-casing of "Phone number" in peco (#144208) 2025-05-04 18:55:58 +03:00
Oliver
2c368c79d1 Update denonavr to 1.1.0 (#144199) 2025-05-04 16:41:44 +02:00
Michael Hannon
095318114b Add Zimi Cloud Connect Integration (#129876)
* Give entry unique id with MAC, strings.json tweaks

* Update codeowners

* Add config_flow tests

* Update requirements

* Update homeassistant/components/zimi/__init__.py

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Store controller reference in entry.runtime_data instead of hass.data

* Add typing

* Removed hass data pop on unload.  (No longer needed when hass data moved for runtime_data)

* Refactor config_flow based on feedback from @zweckj with inline validation, simpler defaults, better description data

* Add Michael to codeowners

* Remove manual debug override in entity

* Populate via_device

* remove empty keys from manifest.json

* Refactor with DataUpdateCoordinator
Device Entities use existing push update method

* set via_device to match zcc identifier

* Changed logger to use debug level

* Define the zimi constants

* Move extraaneous code out from try

* Move __del__ to async_wil_remove_from_hass

* Use zcc device for name

* Print debug if mac mismatch
Add final exception if api is not ready after connect

* Re-work configuration flow:
1. Remove unused CONF_TIMEOUT, CONF_VERBOSITY and CONF_WATCHDOG
2. Move connect() logic out of ZimiCoordinator
3. Add fast connect check during ConfigFlow to check mac matches
4. Use zcc version 3.2.3 with default watchdog time value (and remove this from HA)

* Add error detail to mac mismatch

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Update homeassistant/components/zimi/const.py

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Update homeassistant/components/zimi/coordinator.py

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Update homeassistant/components/zimi/coordinator.py

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Update homeassistant/components/zimi/light.py

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Remove coordinator and move setup to __init__

* Set name in _attr_name

* Use _light directly for status etc; Remove _state and _brightness; SImplify update()

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Update homeassistant/components/zimi/strings.json

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* No need to delete device, fix return

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Remove non-failing items from try
Abort duplicate configurations

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Move attr change to notify

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Update homeassistant/components/zimi/__init__.py

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Remove superflous defalt

* Update homeassistant/components/zimi/light.py

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Update homeassistant/components/zimi/light.py

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Move aysnc_connect_to_controller to helpers.py

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Invert if api

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Added ZimiConfigEntry to type runtime_data correctly.
Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Use _abort_if_unique_id_configured
Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Invert error logic for cleaner flow
Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Add ZimiDimmer class

* Set colour_mode only in ZimiDimmer

* Use device name instead of entity name
Update deviceinfo for zcc
Update deviceinfo for lights
More ZimiDimmer and ZimiLight cleanup

* Update homeassistant/components/zimi/__init__.py

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Update homeassistant/components/zimi/__init__.py

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Add missing import for CONNECTION_NETWORK_MAC

* @mhannon11 Fixed some minor style changes BUT these tests need re-working now that the config_flow has a second call to the zcc helper to check the API.   The tests as written now fail with connect_fail

* Remove some code from try

* Moved static items from initialiser

* Remove superflous assert when unloading entry

* refactor - move title out of data

* One call to async_add_entities
Update ZimiDimmer to initialise color_modes after calling super()

* Create ZimiEntity base class
(as ToggleEntity)

* Updated test of config_flow

* Move api_mock parameters to test cases

* Much improved tests

* Test for input value mismatch and then recovery of flow

* Import FlowResultType

* Implement Entities event setup correctly

* Initial quality_scale.yml

* Update homeassistant/components/zimi/quality_scale.yml

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Update homeassistant/components/zimi/manifest.json

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Add link to zcc repo

* Update homeassistant/components/zimi/entity.py

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Update homeassistant/components/zimi/entity.py

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Removed unecessary f-strings

* Filled in all of the quality scale

* Updated in line with latest documentation improvements

* FIx missing import for Entity

* Update homeassistant/components/zimi/strings.json

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Update homeassistant/components/zimi/strings.json

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Simplify logger and throw

* Update homeassistant/components/zimi/helpers.py

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Re-factor config_flow with multi-stage steps

* Add comments to notify

* Don't set hw_version

* Update homeassistant/components/zimi/light.py

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Update homeassistant/components/zimi/light.py

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Update homeassistant/components/zimi/quality_scale.yml

Co-authored-by: Josef Zweck <josef@zweck.dev>

* mark docs-troubleshooting done

* Update with zcc-helper version supporting PEP 625 sdist rules on PyPi

* Comment re characteristic ID

* Pulls in latest zcc that closes UDP listening port correctly after discovery timeout

* Re-factored config_flow

1. Try discovery and auto-populate
2. Try manual configuration (with optional values for port and mac)

In most cases, auto-discovery does it all.

Discovery will only fail if UDP broadcast is not possible to/from zcc.

* Do not show error message if discovery fails

* Refactor with self.data and async_show_step_finish()

* Update homeassistant/components/zimi/light.py

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Update homeassistant/components/zimi/quality_scale.yml

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Update homeassistant/components/zimi/quality_scale.yml

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Update homeassistant/components/zimi/entity.py

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Update homeassistant/components/zimi/light.py

Co-authored-by: Josef Zweck <josef@zweck.dev>

* refactor import to use ConfigFlow

* Change status for discovery

* Add dynamic title to config flow

* string

* Revert title from form but add IP:port to static title

* Automatically finish configuration if possible, if not show form

* Use StrEnum instead of Exception class

* Remove MAC from user forms

* Disconnect api before form completion

* Assign to self.mac instead of returning as detail

* Updated test suite

* Update test status

* mark action exemptions todo

* Remove mac related error cases from flow completely

* Remove unused MAC error strings

* Moved error details to logs
Removed _error_tuple
Removed error details

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Josef Zweck <josef@zweck.dev>

* rename check_errors

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Update zcc-helper and support HA devices via zcc manufacter_info fields

* Partial implementation - Use updated zcc-helper to discover multiple controllers

* Config_flow with support for auto-discovery of one or more zcc or fallback to manual configuration.

* Don't re-connect to api if validate_connection already did

* Make fast=False is used for creation

* Pull in improved zcc_helper version to address data completeness after machine_info implementation

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Import and use ConfigFlowResult

* Latest zcc to fix discovers() return value bug

* Update config_flow.py

* Update homeassistant/components/zimi/manifest.json

Co-authored-by: Josef Zweck <josef@zweck.dev>

* Use latest release version of 3.3 (no changes to rc4)

* Improved sentence casing

* Update strings.json

* Update homeassistant/components/zimi/entity.py

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* Remove superflous logging
Use Zimi network_name as ZCC name
Cleanup device info inputs

* Remove __del__

* Rename arguments

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Move PLATFORMS to init

* Update homeassistant/components/zimi/light.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Remove debug at init

* Update homeassistant/components/zimi/helpers.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Remove _attr_has_entity = False

* More naming changes

* Revised config_flow to use zcc-helper for validation using new zcc-helper version

* Update homeassistant/components/zimi/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Removed commented enum

* s/_entity/_device/g

* Update homeassistant/components/zimi/entity.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/helpers.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Don't log error when raising exception

* Updated tests for new config_flow

* Refactor with new zcc that uses Exception classes to pass errors

* Updated tests for config_flow to use Exceptions

* Device name is based on model

* Device name is None

Maps better to ZCC concept where devices do not have a name but the individual entities have names.

* Fix quality filename

* Bump zcc-helper to 3.4 release version

* Remove name override

* Bump zcc-helper to 3.4.1 with new device_name attribute used to populate devinfo

* Update homeassistant/components/zimi/light.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Add missing transalation picked up by CI

* Update homeassistant/components/zimi/light.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Bump zcc-helper to only classify light and dimmer controlPointType as lights

* Bump to non dev version of zcc-helper

* Ruff fixes

* Add missing data description for pytest

* Remove confusing comment

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/strings.json

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/strings.json

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/strings.json

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/strings.json

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/strings.json

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/const.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/const.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/const.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/strings.json

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/strings.json

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/zimi/test_config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/zimi/light.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* f-strings

* Update tests/components/zimi/test_config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/zimi/test_config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Assert result type, step and errors between each step

* test for duplicate entry

* Update tests/components/zimi/test_config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/zimi/test_config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/zimi/test_config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/zimi/test_config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/zimi/test_config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Remove duplicate test for discovery failure

* Calculate brightness

* Don't re-raise Exception in helper

* Fix ruff and mypi errors

* Add tests for missing connection exceptions

* Added standard invalid_host and timeout strings

* Explain limitations in discovery.

* Update quality_scale.yaml

* Update quality_scale.yaml

* Removed duplicate strings with reference

---------

Co-authored-by: markhannon <mark.hannon@gmail.com>
Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>
Co-authored-by: Josef Zweck <josef@zweck.dev>
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2025-05-04 15:58:32 +02:00
Norbert Rittel
9e388f5b13 Fix spelling of "comma-separated (network addresses)" in nmap_tracker (#144197) 2025-05-04 15:21:06 +03:00
Brett Adams
87fab1fa14 Rename classes in Teslemetry (#144179) 2025-05-04 14:18:39 +02:00
Brett Adams
8046684179 Update models const in Teslemetry (#144175) 2025-05-04 13:44:56 +02:00
Brett Adams
5a475ec7ea Improve typing of binary sensors in Teslemetry (#144169) 2025-05-04 13:42:25 +02:00
Brett Adams
8c6edd8b81 Add better typing to Teslemetry switch platform (#144168) 2025-05-04 13:41:45 +02:00
Brett Adams
de496c693e Add hazard lights binary sensor to Teslemetry (#144166) 2025-05-04 13:36:13 +02:00
Norbert Rittel
cb37d4d36a Fix spelling of "comma-separated (list / event name)" in doorbird (#144190) 2025-05-04 13:09:31 +03:00
Norbert Rittel
2aa82da615 Fix spelling of "comma-separated (list)" in huawei_lte (#144189) 2025-05-04 13:09:09 +03:00
Maciej Bieniek
04982f5e12 Add missing pollen category to AccuWeather (#144185)
* Add extreme level to pollen map

* Sort

* Sort
2025-05-04 13:08:07 +03:00
Norbert Rittel
b9e11b0f45 Fix spelling of "comma-separated" and "IP address" in cast (#144188) 2025-05-04 13:07:30 +03:00
hahn-th
1e0d1c46ab Bump homematicip to 2.0.1.1 (#144182)
Co-authored-by: Shay Levy <levyshay1@gmail.com>
2025-05-04 12:07:18 +02:00
Norbert Rittel
b5d499dda8 Fix spelling of "comma-separated (list)" in fritzbox_callmonitor (#144191)
Also fix one missing sentence-casing in corresponding "title" string.
2025-05-04 13:06:46 +03:00
Åke Strandberg
d1615f9a6e Bump pymiele to 0.4.3 (#144176)
* Use device class transation

* Bump pymiele to 0.4.3

---------

Co-authored-by: Shay Levy <levyshay1@gmail.com>
2025-05-04 11:30:37 +02:00
Marc Mueller
516a3c0504 Fix licenses check for setuptools (#144181) 2025-05-04 11:02:11 +03:00
J. Nick Koston
2a5c0d9b88 Add support for updating ESPHome deep sleep devices (#144161)
Co-authored-by: Keith Burzinski <kbx81x@gmail.com>
2025-05-03 20:50:17 -05:00
J. Nick Koston
a15a3c12d5 Pass requestor_uuid to bond API calls (#144128) 2025-05-03 20:40:28 -04:00
J. Nick Koston
a6131b3ebf Bump habluetooth to 3.48.2 (#144157) 2025-05-03 18:22:48 -05:00
Paulus Schoutsen
b9aadb252f Point thumbnail TTS media source to right logo (#144162) 2025-05-03 17:21:22 -04:00
J. Nick Koston
1264c2cbfa Bump zeroconf to 0.147.0 (#144158) 2025-05-03 14:21:03 -05:00
tronikos
716b559e5d Skip the update right after the migration in Opower (#144088)
* Wait for the migration to finish in Opower

* Don't call async_block_till_done since this can timeout and seems to meant for tests

* Don't call async_block_till_done since this can timeout and seems to meant for tests
2025-05-03 15:12:01 -04:00
Charlie Rusbridger
30e4264aa9 Use kodi posters, fall back to thumbnails if unavailable. (#144066) 2025-05-03 15:10:33 -04:00
Michael
fb94f8ea18 Make the network device tracking feature optional in AVM Fritz!Tools (#144149)
* make the network device tracking feature optional

* fix doc strings

* Apply suggestions from code review

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>

---------

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2025-05-03 21:04:59 +02:00
Florian Sabonchi
aea5760424 Fix check for locked device in AVM Fritz!SmartHome (#141697)
* feat: raise execption on hvac mode while device is locked

* fix: test for setting hvac mode while device is locked.

* feat: update translation

* feat: add separate translations for HVAC and temperature

* fix: test cases

* fix: test cases for test_set_preset_mode_boost

* rev: code review

* rev: exception string

* feat: updated  error message and added helper function

* Update homeassistant/components/fritzbox/strings.json

Co-authored-by: Michael <35783820+mib1185@users.noreply.github.com>

* fix: translation key

* remove check_active_or_lock_mode from async_set_preset_mode

---------

Co-authored-by: Michael <35783820+mib1185@users.noreply.github.com>
2025-05-03 20:25:27 +02:00
Jan Bouwhuis
debec3bfbc Improve supported color modes description (#144144) 2025-05-03 17:13:43 +01:00
J. Diego Rodríguez Royo
4122f94fb6 Add DHCP discovery to Home Connect (#144095)
* Add DHCP discovery to Home Connect

* Added tests

* Use enums

* Use more enums
2025-05-03 17:16:02 +02:00
J. Nick Koston
b48a2cf2b5 Add tests to ensure ESPHome entity_ids are preserved on upgrade (#144116) 2025-05-03 10:12:37 -05:00
Shay Levy
0ca9ad1cc0 Mark Shelly docs-data-update as done (#144151) 2025-05-03 16:17:37 +02:00
Shay Levy
ee555a3700 Mark Shelly icon-translations as done (#144148) 2025-05-03 17:08:34 +03:00
Josef Zweck
a2bc3e3908 Switch to common clientsession for lamarzocco (#144137) 2025-05-03 14:44:18 +02:00
Thomas55555
64b7f2c285 Improve select platform in Husqvarna Automower (#144117) 2025-05-03 15:39:46 +03:00
Marc Mueller
db2435dc36 Fix litterrobot entity typing (#144147) 2025-05-03 14:35:17 +02:00
Marc Mueller
1d500fda67 Fix fritz coordinator typing (#144146) 2025-05-03 14:35:04 +02:00
Jan Bouwhuis
558b0ec3b1 Fix small issues with mqtt translations and improve readability (#144091) 2025-05-03 11:51:26 +02:00
J. Nick Koston
9780db1c22 Bump Bluetooth deps to improve auto recovery process (#144133) 2025-05-03 10:09:28 +02:00
J. Nick Koston
5e39fb6da1 Bump bleak-esphome to 2.15.1 (#144129) 2025-05-03 10:08:56 +02:00
J. Nick Koston
4450f919c3 Bump PyISY to 3.4.1 (#144127) 2025-05-02 17:46:59 -05:00
Marc Hörsken
3183bb78ff Update pywmspro to 0.2.2 to make error handling more robust (#144124) 2025-05-03 00:16:49 +02:00
J. Nick Koston
e74f918382 Bump aiodns to 3.3.0 (#144115) 2025-05-02 15:53:19 -05:00
Thomas55555
247d2e7efd Bump aioautomower to 2025.5.1 (#144118) 2025-05-02 22:35:34 +02:00
Bram Kragten
32b7edb608 Update frontend to 20250502.0 (#144114) 2025-05-02 22:33:39 +02:00
Josef Zweck
df4297be62 Fix intermittent unavailability for lamarzocco brew active sensor (#144120)
* Fix brew active intermittent unavailability for lamarzocco

* Whitespaces
2025-05-02 22:29:54 +02:00
Brett Adams
4c2e9fc759 Bump teslemetry-stream to 0.7.7 (#144085) 2025-05-02 21:13:12 +02:00
J. Nick Koston
2890fc7dd2 Only create a single resolver object if there are multiple aiohttp sessions (#144090) 2025-05-02 13:43:06 -05:00
Ian
97be2c4ac9 Bump py-nextbusnext to 2.1.2 (#144081)r
Bump py-nextbusnext version

Fixes #144059
2025-05-02 20:17:58 +02:00
Åke Strandberg
762d284102 Improve naming of miele freezers and fridges (#144062)
* Use device class transation

* Improve naming of miele freezers and fridges

* Address review

* Address review comment

* Simplify
2025-05-02 19:31:56 +02:00
Joost Lekkerkerker
4967c287f8 Add DHCP discovery to Knocki (#144048)
* Add DHCP discovery to Knocki

* Update homeassistant/components/knocki/quality_scale.yaml

Co-authored-by: Josef Zweck <josef@zweck.dev>

---------

Co-authored-by: Josef Zweck <josef@zweck.dev>
2025-05-02 18:34:09 +02:00
Pete Sage
5e463d6af4 bump aiokem to 0.5.9 (#144098)
fix: bump aiokem to 0.5.9
2025-05-02 17:34:58 +02:00
Åke Strandberg
cbf4676ae4 Improve handling of missing miele program codes (#144093)
* Use device class transation

* Improve handling of unknown program codes

* Address review comment
2025-05-02 17:31:11 +02:00
Tomáš Bedřich
81444c8f4a Disable S3 checksums (#144092)
Disable S3 checksums (#143995)
2025-05-02 13:49:33 +02:00
J. Nick Koston
9861bd88b9 Avoid working out suggested id in entity_platform when already registered (#144079)
If the entity is already registered, avoid trying to work
out the suggested_entity_id and suggested_object_id as
async_get_or_create will discard them anyways.
2025-05-02 11:44:38 +02:00
Simone Chemelli
b0f1c71129 Handle missing action exceptions in SamsungTV (#143630)
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2025-05-02 11:39:28 +02:00
Shay Levy
86b845f04a Mark exception-translations done in Shelly (#144073) 2025-05-02 12:32:41 +03:00
J. Diego Rodríguez Royo
3af0d6e484 Use is instead of == on check against enum value at Home Connect (#144083)
* Use `is` instead of `==` on check against enum value at Home Connect

* Revert HTTP status checks
2025-05-02 10:08:46 +02:00
epenet
fca62f1ae8 Move SamsungTV test constants to fixture files (#144086) 2025-05-02 08:32:44 +02:00
Andreas Kölsch
4e8d68a2ef Fix brightness calculation when using brightness_step_pct (#143786) 2025-05-01 23:07:52 +01:00
J. Diego Rodríguez Royo
883ab44437 Move Home Connect entry state assertion at tests (#144027) 2025-05-01 23:04:03 +02:00
tronikos
abd17d9af9 Pass empty set instead of empty dict to get_last_statistics (#144022) 2025-05-01 16:47:48 -04:00
J. Nick Koston
a906a1754e Avoid DomainData lookup in ESPHome update platform (#144072)
We can get this from entry.runtime_data
2025-05-01 16:45:44 -04:00
Josef Zweck
255beafe08 Add connect/disconnect callbacks to lamarzocco (#144011) 2025-05-01 16:29:44 -04:00
Josef Zweck
e2679004a1 Add bluetooth connection availability to diagnostics for lamarzocco (#144012)
* Add bluetooth connection availability to diagnostics for lamarzocco

* make even more detailed
2025-05-01 16:26:50 -04:00
J. Nick Koston
06bb692522 Bump inkbird-ble to 0.16.1 (#144074)
I made a mistake in one of the data lengths as I forgot to add
the length of the id which is 2 bytes. I really wish vendors
would stop putting raw data in this field.

changelog: https://github.com/Bluetooth-Devices/inkbird-ble/compare/v0.16.0...v0.16.1
2025-05-01 23:23:56 +03:00
Shay Levy
71599b8e75 Set Shelly PARALLEL_UPDATES (#144070) 2025-05-01 21:20:50 +02:00
J. Nick Koston
79f8bea48d Avoid validation of ESPHome MAC when discovered entry is ignored or unchanged (#144071)
fixes #144033
fixes #143991
2025-05-01 14:51:38 -04:00
Åke Strandberg
82b335a2c1 Flag strict typing for miele (#144060) 2025-05-01 19:10:24 +02:00
Thomas55555
361d93eb96 Remove deprecated binary sensor in Husqvarna Automower (#144064)
* Remove deprecated binary sensor in Husqvarna Automower

* snapshot
2025-05-01 18:35:48 +02:00
Ludovic BOUÉ
bab699eb0c Matter Solar power fixture (#144058) 2025-05-01 17:06:08 +02:00
Thomas55555
b8881ed85b Fix test in Husqvarna Automower (#144055) 2025-05-01 16:36:05 +02:00
Åke Strandberg
4013b418dd Use device class transation for door in miele (#144053) 2025-05-01 16:33:30 +02:00
Åke Strandberg
80d714b865 Use action property defined in MieleEntity (#144052) 2025-05-01 16:06:49 +02:00
Åke Strandberg
7fcad580cb Update miele program codes and strings (#144049) 2025-05-01 15:14:11 +02:00
Ludovic BOUÉ
60b6ff4064 Matter Laundry Dryer fixture (#144043)
* Create laundry_dryer.json

* Add snapshots

* Format fixture

* Set CurrentPhase attribute

* Set OperationalState attribute

* Update snapshot
2025-05-01 14:52:32 +02:00
Josef Zweck
24252edf38 Handle TimeoutError for lamarzocco (#144042) 2025-05-01 14:02:39 +02:00
J. Diego Rodríguez Royo
79aa7aacec Sort Home Connect test params (#144035) 2025-05-01 12:04:25 +02:00
OzGav
92944fa509 Media Player strings adjust grammar (#144030) 2025-05-01 11:40:04 +02:00
J. Diego Rodríguez Royo
c0f0a4a1ac Listen for an event just once at Home Connect test (#144031) 2025-05-01 11:24:29 +02:00
J. Diego Rodríguez Royo
a084b9fdde Set autouse to setup_credentials Home Connect fixture (#144028) 2025-05-01 11:24:05 +02:00
Andrea Turri
83b9b8b032 Fix state of fan entity for Miele hobs with extractor when turned off (#144025) 2025-05-01 10:42:27 +02:00
J. Diego Rodríguez Royo
bc47049d42 Remove non required Home Connect tests (#144024) 2025-05-01 10:18:32 +02:00
J. Diego Rodríguez Royo
17360ede28 Use common percentage const at Home Connect (#144021) 2025-05-01 09:57:42 +02:00
J. Diego Rodríguez Royo
f441f4d7c0 Remove translation key for battery level in Home Connect sensor (#144020) 2025-05-01 09:57:30 +02:00
J. Diego Rodríguez Royo
5ddc449247 Remove default brightness values from Home Connect light entities (#144019) 2025-05-01 09:57:17 +02:00
J. Diego Rodríguez Royo
dd8d714c94 Remove _attr_should_poll from Home Connect base entity (#144016) 2025-05-01 09:49:49 +02:00
J. Diego Rodríguez Royo
c2079ddf6f Remove unused client param at Home Connect diagnostics (#144017) 2025-05-01 09:49:25 +02:00
Manu
5250590b17 Remove deprecated action api_call from Habitica integration (#143978) 2025-05-01 09:28:25 +02:00
Jan-Philipp Benecke
93f4f14b2a Default backup encryption to true when updating only location retention (#143997) 2025-04-30 22:45:41 +01:00
Ville Skyttä
ba712ed514 Move huawei_lte sensor icons to icons.json where applicable (#143999) 2025-04-30 23:26:10 +02:00
Norbert Rittel
6e76ca0fb3 Add translations for "energy_distance" and "wind_direction" in random (#143994)
* Add translations for "energy_distance" and "wind_direction" in `random`

* Comma
2025-05-01 00:13:04 +03:00
Megamind
b0345cce68 Bump pushover-complete to 1.2.0 (#143966)
Co-authored-by: Joostlek <joostlek@outlook.com>
2025-04-30 23:04:56 +02:00
Paulus Schoutsen
c4eddc8d11 Ensure legacy TTS providers are hidden if entity exists (#143992) 2025-04-30 16:57:02 -04:00
Josef Zweck
7d89804a87 Bump pylamarzocco to 2.0.0b7 (#143989) 2025-04-30 22:56:04 +02:00
Ludovic BOUÉ
b92f718e08 Matter Cooktop fixture (#143984) 2025-04-30 22:09:29 +02:00
Franck Nijhof
ad0209a4a0 Bump version to 2025.6.0dev0 (#143983) 2025-04-30 21:44:19 +02:00
J. Diego Rodríguez Royo
d23d25c6b7 Add units of measurement for Home Connect counter entities (#143982) 2025-04-30 21:03:17 +02:00
479 changed files with 9167 additions and 4227 deletions

View File

@@ -40,7 +40,7 @@ env:
CACHE_VERSION: 12
UV_CACHE_VERSION: 1
MYPY_CACHE_VERSION: 9
HA_SHORT_VERSION: "2025.5"
HA_SHORT_VERSION: "2025.6"
DEFAULT_PYTHON: "3.13"
ALL_PYTHON_VERSIONS: "['3.13']"
# 10.3 is the oldest supported version

View File

@@ -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"

View File

@@ -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.*

10
CODEOWNERS generated
View File

@@ -171,6 +171,8 @@ build.json @home-assistant/supervisor
/homeassistant/components/avea/ @pattyland
/homeassistant/components/awair/ @ahayworth @danielsjf
/tests/components/awair/ @ahayworth @danielsjf
/homeassistant/components/aws_s3/ @tomasbedrich
/tests/components/aws_s3/ @tomasbedrich
/homeassistant/components/axis/ @Kane610
/tests/components/axis/ @Kane610
/homeassistant/components/azure_data_explorer/ @kaareseras
@@ -1318,8 +1320,6 @@ build.json @home-assistant/supervisor
/tests/components/ruuvitag_ble/ @akx
/homeassistant/components/rympro/ @OnFreund @elad-bar @maorcc
/tests/components/rympro/ @OnFreund @elad-bar @maorcc
/homeassistant/components/s3/ @tomasbedrich
/tests/components/s3/ @tomasbedrich
/homeassistant/components/sabnzbd/ @shaiu @jpbede
/tests/components/sabnzbd/ @shaiu @jpbede
/homeassistant/components/saj/ @fredericvl
@@ -1678,8 +1678,8 @@ build.json @home-assistant/supervisor
/tests/components/vlc_telnet/ @rodripf @MartinHjelmare
/homeassistant/components/vodafone_station/ @paoloantinori @chemelli74
/tests/components/vodafone_station/ @paoloantinori @chemelli74
/homeassistant/components/voip/ @balloob @synesthesiam
/tests/components/voip/ @balloob @synesthesiam
/homeassistant/components/voip/ @balloob @synesthesiam @jaminh
/tests/components/voip/ @balloob @synesthesiam @jaminh
/homeassistant/components/volumio/ @OnFreund
/tests/components/volumio/ @OnFreund
/homeassistant/components/volvooncall/ @molobrakos
@@ -1796,6 +1796,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

View File

@@ -1,10 +1,10 @@
image: ghcr.io/home-assistant/{arch}-homeassistant
build_from:
aarch64: ghcr.io/home-assistant/aarch64-homeassistant-base:2025.02.1
armhf: ghcr.io/home-assistant/armhf-homeassistant-base:2025.02.1
armv7: ghcr.io/home-assistant/armv7-homeassistant-base:2025.02.1
amd64: ghcr.io/home-assistant/amd64-homeassistant-base:2025.02.1
i386: ghcr.io/home-assistant/i386-homeassistant-base:2025.02.1
aarch64: ghcr.io/home-assistant/aarch64-homeassistant-base:2025.05.0
armhf: ghcr.io/home-assistant/armhf-homeassistant-base:2025.05.0
armv7: ghcr.io/home-assistant/armv7-homeassistant-base:2025.05.0
amd64: ghcr.io/home-assistant/amd64-homeassistant-base:2025.05.0
i386: ghcr.io/home-assistant/i386-homeassistant-base:2025.05.0
codenotary:
signer: notary@home-assistant.io
base_image: notary@home-assistant.io

View File

@@ -1,5 +1,12 @@
{
"domain": "amazon",
"name": "Amazon",
"integrations": ["alexa", "amazon_polly", "aws", "fire_tv", "route53"]
"integrations": [
"alexa",
"amazon_polly",
"aws",
"aws_s3",
"fire_tv",
"route53"
]
}

View File

@@ -67,6 +67,7 @@ POLLEN_CATEGORY_MAP = {
2: "moderate",
3: "high",
4: "very_high",
5: "extreme",
}
UPDATE_INTERVAL_OBSERVATION = timedelta(minutes=40)
UPDATE_INTERVAL_DAILY_FORECAST = timedelta(hours=6)

View File

@@ -72,6 +72,7 @@
"level": {
"name": "Level",
"state": {
"extreme": "Extreme",
"high": "[%key:common::state::high%]",
"low": "[%key:common::state::low%]",
"moderate": "Moderate",
@@ -89,6 +90,7 @@
"level": {
"name": "[%key:component::accuweather::entity::sensor::grass_pollen::state_attributes::level::name%]",
"state": {
"extreme": "[%key:component::accuweather::entity::sensor::grass_pollen::state_attributes::level::state::extreme%]",
"high": "[%key:common::state::high%]",
"low": "[%key:common::state::low%]",
"moderate": "[%key:component::accuweather::entity::sensor::grass_pollen::state_attributes::level::state::moderate%]",
@@ -123,6 +125,7 @@
"level": {
"name": "[%key:component::accuweather::entity::sensor::grass_pollen::state_attributes::level::name%]",
"state": {
"extreme": "[%key:component::accuweather::entity::sensor::grass_pollen::state_attributes::level::state::extreme%]",
"high": "[%key:common::state::high%]",
"low": "[%key:common::state::low%]",
"moderate": "[%key:component::accuweather::entity::sensor::grass_pollen::state_attributes::level::state::moderate%]",
@@ -167,6 +170,7 @@
"level": {
"name": "[%key:component::accuweather::entity::sensor::grass_pollen::state_attributes::level::name%]",
"state": {
"extreme": "[%key:component::accuweather::entity::sensor::grass_pollen::state_attributes::level::state::extreme%]",
"high": "[%key:common::state::high%]",
"low": "[%key:common::state::low%]",
"moderate": "[%key:component::accuweather::entity::sensor::grass_pollen::state_attributes::level::state::moderate%]",
@@ -181,6 +185,7 @@
"level": {
"name": "[%key:component::accuweather::entity::sensor::grass_pollen::state_attributes::level::name%]",
"state": {
"extreme": "[%key:component::accuweather::entity::sensor::grass_pollen::state_attributes::level::state::extreme%]",
"high": "[%key:common::state::high%]",
"low": "[%key:common::state::low%]",
"moderate": "[%key:component::accuweather::entity::sensor::grass_pollen::state_attributes::level::state::moderate%]",
@@ -195,6 +200,7 @@
"level": {
"name": "[%key:component::accuweather::entity::sensor::grass_pollen::state_attributes::level::name%]",
"state": {
"extreme": "[%key:component::accuweather::entity::sensor::grass_pollen::state_attributes::level::state::extreme%]",
"high": "[%key:common::state::high%]",
"low": "[%key:common::state::low%]",
"moderate": "[%key:component::accuweather::entity::sensor::grass_pollen::state_attributes::level::state::moderate%]",

View File

@@ -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"],

View File

@@ -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"],

View File

@@ -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",

View File

@@ -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,

View File

@@ -1,4 +1,4 @@
"""The S3 integration."""
"""The AWS S3 integration."""
from __future__ import annotations

View File

@@ -1,4 +1,4 @@
"""Backup platform for the S3 integration."""
"""Backup platform for the AWS S3 integration."""
from collections.abc import AsyncIterator, Callable, Coroutine
import functools

View File

@@ -1,8 +1,9 @@
"""Config flow for the S3 integration."""
"""Config flow for the AWS S3 integration."""
from __future__ import annotations
from typing import Any
from urllib.parse import urlparse
from aiobotocore.session import AioSession
from botocore.exceptions import ClientError, ConnectionError, ParamValidationError
@@ -17,6 +18,7 @@ from homeassistant.helpers.selector import (
)
from .const import (
AWS_DOMAIN,
CONF_ACCESS_KEY_ID,
CONF_BUCKET,
CONF_ENDPOINT_URL,
@@ -57,28 +59,34 @@ class S3ConfigFlow(ConfigFlow, domain=DOMAIN):
CONF_ENDPOINT_URL: user_input[CONF_ENDPOINT_URL],
}
)
try:
session = AioSession()
async with session.create_client(
"s3",
endpoint_url=user_input.get(CONF_ENDPOINT_URL),
aws_secret_access_key=user_input[CONF_SECRET_ACCESS_KEY],
aws_access_key_id=user_input[CONF_ACCESS_KEY_ID],
) as client:
await client.head_bucket(Bucket=user_input[CONF_BUCKET])
except ClientError:
errors["base"] = "invalid_credentials"
except ParamValidationError as err:
if "Invalid bucket name" in str(err):
errors[CONF_BUCKET] = "invalid_bucket_name"
except ValueError:
if not urlparse(user_input[CONF_ENDPOINT_URL]).hostname.endswith(
AWS_DOMAIN
):
errors[CONF_ENDPOINT_URL] = "invalid_endpoint_url"
except ConnectionError:
errors[CONF_ENDPOINT_URL] = "cannot_connect"
else:
return self.async_create_entry(
title=user_input[CONF_BUCKET], data=user_input
)
try:
session = AioSession()
async with session.create_client(
"s3",
endpoint_url=user_input.get(CONF_ENDPOINT_URL),
aws_secret_access_key=user_input[CONF_SECRET_ACCESS_KEY],
aws_access_key_id=user_input[CONF_ACCESS_KEY_ID],
) as client:
await client.head_bucket(Bucket=user_input[CONF_BUCKET])
except ClientError:
errors["base"] = "invalid_credentials"
except ParamValidationError as err:
if "Invalid bucket name" in str(err):
errors[CONF_BUCKET] = "invalid_bucket_name"
except ValueError:
errors[CONF_ENDPOINT_URL] = "invalid_endpoint_url"
except ConnectionError:
errors[CONF_ENDPOINT_URL] = "cannot_connect"
else:
return self.async_create_entry(
title=user_input[CONF_BUCKET], data=user_input
)
return self.async_show_form(
step_id="user",

View File

@@ -1,18 +1,19 @@
"""Constants for the S3 integration."""
"""Constants for the AWS S3 integration."""
from collections.abc import Callable
from typing import Final
from homeassistant.util.hass_dict import HassKey
DOMAIN: Final = "s3"
DOMAIN: Final = "aws_s3"
CONF_ACCESS_KEY_ID = "access_key_id"
CONF_SECRET_ACCESS_KEY = "secret_access_key"
CONF_ENDPOINT_URL = "endpoint_url"
CONF_BUCKET = "bucket"
DEFAULT_ENDPOINT_URL = "https://s3.eu-central-1.amazonaws.com/"
AWS_DOMAIN = "amazonaws.com"
DEFAULT_ENDPOINT_URL = f"https://s3.eu-central-1.{AWS_DOMAIN}/"
DATA_BACKUP_AGENT_LISTENERS: HassKey[list[Callable[[], None]]] = HassKey(
f"{DOMAIN}.backup_agent_listeners"

View File

@@ -1,9 +1,9 @@
{
"domain": "s3",
"name": "S3",
"domain": "aws_s3",
"name": "AWS S3",
"codeowners": ["@tomasbedrich"],
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/s3",
"documentation": "https://www.home-assistant.io/integrations/aws_s3",
"integration_type": "service",
"iot_class": "cloud_push",
"loggers": ["aiobotocore"],

View File

@@ -9,19 +9,19 @@
"endpoint_url": "Endpoint URL"
},
"data_description": {
"access_key_id": "Access key ID to connect to S3 API",
"secret_access_key": "Secret access key to connect to S3 API",
"access_key_id": "Access key ID to connect to AWS S3 API",
"secret_access_key": "Secret access key to connect to AWS S3 API",
"bucket": "Bucket must already exist and be writable by the provided credentials.",
"endpoint_url": "Endpoint URL provided to [Boto3 Session]({boto3_docs_url}). Region-specific [AWS S3 endpoints]({aws_s3_docs_url}) are available in their docs."
},
"title": "Add S3 bucket"
"title": "Add AWS S3 bucket"
}
},
"error": {
"cannot_connect": "[%key:component::s3::exceptions::cannot_connect::message%]",
"invalid_bucket_name": "[%key:component::s3::exceptions::invalid_bucket_name::message%]",
"invalid_credentials": "[%key:component::s3::exceptions::invalid_credentials::message%]",
"invalid_endpoint_url": "Invalid endpoint URL"
"cannot_connect": "[%key:component::aws_s3::exceptions::cannot_connect::message%]",
"invalid_bucket_name": "[%key:component::aws_s3::exceptions::invalid_bucket_name::message%]",
"invalid_credentials": "[%key:component::aws_s3::exceptions::invalid_credentials::message%]",
"invalid_endpoint_url": "Invalid endpoint URL. Please make sure it's a valid AWS S3 endpoint URL."
},
"abort": {
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"

View File

@@ -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,
)

View File

@@ -202,7 +202,7 @@ class BackupConfig:
if agent_id not in self.data.agents:
old_agent_retention = None
self.data.agents[agent_id] = AgentConfig(
protected=agent_config.get("protected", False),
protected=agent_config.get("protected", True),
retention=new_agent_retention,
)
else:

View File

@@ -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,
)

View File

@@ -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,
),
)

View File

@@ -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"
}

View File

@@ -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."
}
}
}

View File

@@ -12,5 +12,5 @@
"dependencies": ["bluetooth_adapters"],
"documentation": "https://www.home-assistant.io/integrations/bluemaestro",
"iot_class": "local_push",
"requirements": ["bluemaestro-ble==0.4.0"]
"requirements": ["bluemaestro-ble==0.4.1"]
}

View File

@@ -18,9 +18,9 @@
"bleak==0.22.3",
"bleak-retry-connector==3.9.0",
"bluetooth-adapters==0.21.4",
"bluetooth-auto-recovery==1.4.5",
"bluetooth-auto-recovery==1.5.1",
"bluetooth-data-tools==1.28.1",
"dbus-fast==2.43.0",
"habluetooth==3.45.0"
"habluetooth==3.48.2"
]
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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:

View File

@@ -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])

View File

@@ -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": {

View File

@@ -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,
}
)

View File

@@ -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
@@ -409,3 +413,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)

View File

@@ -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"

View File

@@ -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,

View File

@@ -308,6 +308,51 @@ async def async_setup_entry(
async_add_entities([CloudTTSEntity(cloud)])
@callback
def _async_get_supported_voices(language: str) -> list[Voice] | None:
"""Return a list of supported voices for a language."""
if not (voices := TTS_VOICES.get(language)):
return None
result = []
for voice_id, voice_info in voices.items():
if isinstance(voice_info, str):
result.append(
Voice(
voice_id,
voice_info,
)
)
continue
name = voice_info["name"]
result.append(
Voice(
voice_id,
name,
)
)
if language == "pt-PT" and voice_id == "RaquelNeural":
# RaquelNeural variants don't seem to be different
# from the default voice
continue
result.extend(
[
Voice(
f"{voice_id}{VOICE_STYLE_SEPERATOR}{variant}",
f"{name} ({variant})",
)
for variant in voice_info.get("variants", [])
]
)
return result
class CloudTTSEntity(TextToSpeechEntity):
"""Home Assistant Cloud text-to-speech entity."""
@@ -369,40 +414,7 @@ class CloudTTSEntity(TextToSpeechEntity):
@callback
def async_get_supported_voices(self, language: str) -> list[Voice] | None:
"""Return a list of supported voices for a language."""
if not (voices := TTS_VOICES.get(language)):
return None
result = []
for voice_id, voice_info in voices.items():
if isinstance(voice_info, str):
result.append(
Voice(
voice_id,
voice_info,
)
)
continue
name = voice_info["name"]
result.append(
Voice(
voice_id,
name,
)
)
result.extend(
[
Voice(
f"{voice_id}{VOICE_STYLE_SEPERATOR}{variant}",
f"{name} ({variant})",
)
for variant in voice_info.get("variants", [])
]
)
return result
return _async_get_supported_voices(language)
async def async_get_tts_audio(
self, message: str, language: str, options: dict[str, Any]
@@ -418,9 +430,11 @@ class CloudTTSEntity(TextToSpeechEntity):
language=language,
voice=options.get(
ATTR_VOICE,
self._voice
if language == self._language
else DEFAULT_VOICES[language],
(
self._voice
if language == self._language
else DEFAULT_VOICES[language]
),
),
gender=options.get(ATTR_GENDER),
),
@@ -435,6 +449,8 @@ class CloudTTSEntity(TextToSpeechEntity):
class CloudProvider(Provider):
"""Home Assistant Cloud speech API provider."""
has_entity = True
def __init__(self, cloud: Cloud[CloudClient]) -> None:
"""Initialize cloud provider."""
self.cloud = cloud
@@ -465,40 +481,7 @@ class CloudProvider(Provider):
@callback
def async_get_supported_voices(self, language: str) -> list[Voice] | None:
"""Return a list of supported voices for a language."""
if not (voices := TTS_VOICES.get(language)):
return None
result = []
for voice_id, voice_info in voices.items():
if isinstance(voice_info, str):
result.append(
Voice(
voice_id,
voice_info,
)
)
continue
name = voice_info["name"]
result.append(
Voice(
voice_id,
name,
)
)
result.extend(
[
Voice(
f"{voice_id}{VOICE_STYLE_SEPERATOR}{variant}",
f"{name} ({variant})",
)
for variant in voice_info.get("variants", [])
]
)
return result
return _async_get_supported_voices(language)
@property
def default_options(self) -> dict[str, str]:

View File

@@ -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 = [
[

View File

@@ -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 = [
[

View File

@@ -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 = [
[

View File

@@ -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),
)

View File

@@ -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

View File

@@ -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",

View File

@@ -5,5 +5,5 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/dnsip",
"iot_class": "cloud_polling",
"requirements": ["aiodns==3.2.0"]
"requirements": ["aiodns==3.3.0"]
}

View File

@@ -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"
}
}
}

View File

@@ -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):

View File

@@ -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 = [

View File

@@ -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] = {

View File

@@ -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(

View File

@@ -22,5 +22,5 @@
"integration_type": "device",
"iot_class": "local_polling",
"loggers": ["eq3btsmart"],
"requirements": ["eq3btsmart==1.4.1", "bleak-esphome==2.14.0"]
"requirements": ["eq3btsmart==1.4.1", "bleak-esphome==2.15.1"]
}

View File

@@ -22,6 +22,7 @@ import voluptuous as vol
from homeassistant.components import zeroconf
from homeassistant.config_entries import (
SOURCE_IGNORE,
SOURCE_REAUTH,
SOURCE_RECONFIGURE,
ConfigEntry,
@@ -31,6 +32,7 @@ from homeassistant.config_entries import (
)
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT
from homeassistant.core import callback
from homeassistant.data_entry_flow import AbortFlow
from homeassistant.helpers.device_registry import format_mac
from homeassistant.helpers.service_info.dhcp import DhcpServiceInfo
from homeassistant.helpers.service_info.hassio import HassioServiceInfo
@@ -302,7 +304,15 @@ class EsphomeFlowHandler(ConfigFlow, domain=DOMAIN):
)
):
return
if entry.source == SOURCE_IGNORE:
# Don't call _fetch_device_info() for ignored entries
raise AbortFlow("already_configured")
configured_host: str | None = entry.data.get(CONF_HOST)
configured_port: int | None = entry.data.get(CONF_PORT)
if configured_host == host and configured_port == port:
# Don't probe to verify the mac is correct since
# the host and port matches.
raise AbortFlow("already_configured")
configured_psk: str | None = entry.data.get(CONF_NOISE_PSK)
await self._fetch_device_info(host, port or configured_port, configured_psk)
updates: dict[str, Any] = {}

View File

@@ -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:

View File

@@ -17,9 +17,9 @@
"mqtt": ["esphome/discover/#"],
"quality_scale": "platinum",
"requirements": [
"aioesphomeapi==30.1.0",
"aioesphomeapi==30.2.0",
"esphome-dashboard-api==1.3.0",
"bleak-esphome==2.14.0"
"bleak-esphome==2.15.1"
],
"zeroconf": ["_esphomelib._tcp.local."]
}

View File

@@ -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}."
}
}
}

View File

@@ -29,7 +29,6 @@ from homeassistant.util.enum import try_parse_enum
from .const import DOMAIN
from .coordinator import ESPHomeDashboardCoordinator
from .dashboard import async_get_dashboard
from .domain_data import DomainData
from .entity import (
EsphomeEntity,
convert_api_error_ha_error,
@@ -62,7 +61,7 @@ async def async_setup_entry(
if (dashboard := async_get_dashboard(hass)) is None:
return
entry_data = DomainData.get(hass).get_entry_data(entry)
entry_data = entry.runtime_data
assert entry_data.device_info is not None
device_name = entry_data.device_info.name
unsubs: list[CALLBACK_TYPE] = []
@@ -126,21 +125,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
@@ -179,6 +174,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()
@@ -193,17 +195,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,
@@ -212,14 +243,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()

View File

@@ -45,7 +45,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: FeedReaderConfigEntry)
# if this is the last entry, remove the storage
if len(entries) == 1:
hass.data.pop(MY_KEY)
return await hass.config_entries.async_unload_platforms(entry, Platform.EVENT)
return await hass.config_entries.async_unload_platforms(entry, [Platform.EVENT])
async def _async_update_listener(

View File

@@ -9,7 +9,7 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from homeassistant.helpers.restore_state import RestoreEntity
from .const import DOMAIN as FIRESERVICEROTA_DOMAIN
from .const import DOMAIN
from .coordinator import FireServiceConfigEntry, FireServiceRotaClient
_LOGGER = logging.getLogger(__name__)
@@ -106,7 +106,7 @@ class IncidentsSensor(RestoreEntity, SensorEntity):
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{FIRESERVICEROTA_DOMAIN}_{self._entry_id}_update",
f"{DOMAIN}_{self._entry_id}_update",
self.client_update,
)
)

View File

@@ -9,7 +9,7 @@ from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from .const import DOMAIN as FIRESERVICEROTA_DOMAIN
from .const import DOMAIN
from .coordinator import (
FireServiceConfigEntry,
FireServiceRotaClient,
@@ -122,7 +122,7 @@ class ResponseSwitch(SwitchEntity):
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{FIRESERVICEROTA_DOMAIN}_{self._entry_id}_update",
f"{DOMAIN}_{self._entry_id}_update",
self.client_update,
)
)

View File

@@ -16,7 +16,7 @@ from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from homeassistant.util import dt as dt_util
from .const import DOMAIN as FLO_DOMAIN, LOGGER
from .const import DOMAIN, LOGGER
type FloConfigEntry = ConfigEntry[FloRuntimeData]
@@ -55,7 +55,7 @@ class FloDeviceDataUpdateCoordinator(DataUpdateCoordinator):
hass,
LOGGER,
config_entry=config_entry,
name=f"{FLO_DOMAIN}-{device_id}",
name=f"{DOMAIN}-{device_id}",
update_interval=timedelta(seconds=60),
)

View File

@@ -5,7 +5,7 @@ from __future__ import annotations
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC, DeviceInfo
from homeassistant.helpers.entity import Entity
from .const import DOMAIN as FLO_DOMAIN
from .const import DOMAIN
from .coordinator import FloDeviceDataUpdateCoordinator
@@ -32,7 +32,7 @@ class FloEntity(Entity):
"""Return a device description for device registry."""
return DeviceInfo(
connections={(CONNECTION_NETWORK_MAC, self._device.mac_address)},
identifiers={(FLO_DOMAIN, self._device.id)},
identifiers={(DOMAIN, self._device.id)},
serial_number=self._device.serial_number,
manufacturer=self._device.manufacturer,
model=self._device.model,

View File

@@ -1,25 +1,21 @@
"""Support for Freebox devices (Freebox v6 and Freebox mini 4K)."""
from datetime import timedelta
import logging
from freebox_api.exceptions import HttpRequestError
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_STOP
from homeassistant.core import Event, HomeAssistant, ServiceCall
from homeassistant.core import Event, HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.event import async_track_time_interval
from .const import DOMAIN, PLATFORMS, SERVICE_REBOOT
from .router import FreeboxRouter, get_api
from .const import PLATFORMS
from .router import FreeboxConfigEntry, FreeboxRouter, get_api
SCAN_INTERVAL = timedelta(seconds=30)
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_setup_entry(hass: HomeAssistant, entry: FreeboxConfigEntry) -> bool:
"""Set up Freebox entry."""
api = await get_api(hass, entry.data[CONF_HOST])
try:
@@ -35,25 +31,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async_track_time_interval(hass, router.update_all, SCAN_INTERVAL)
)
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.unique_id] = router
entry.runtime_data = router
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
# Services
async def async_reboot(call: ServiceCall) -> None:
"""Handle reboot service call."""
# The Freebox reboot service has been replaced by a
# dedicated button entity and marked as deprecated
_LOGGER.warning(
"The 'freebox.reboot' service is deprecated and "
"replaced by a dedicated reboot button entity; please "
"use that entity to reboot the freebox instead"
)
await router.reboot()
hass.services.async_register(DOMAIN, SERVICE_REBOOT, async_reboot)
async def async_close_connection(event: Event) -> None:
"""Close Freebox connection on HA Stop."""
await router.close()
@@ -61,16 +42,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
entry.async_on_unload(
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, async_close_connection)
)
entry.async_on_unload(router.close)
return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_unload_entry(hass: HomeAssistant, entry: FreeboxConfigEntry) -> bool:
"""Unload a config entry."""
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
if unload_ok:
router: FreeboxRouter = hass.data[DOMAIN].pop(entry.unique_id)
await router.close()
hass.services.async_remove(DOMAIN, SERVICE_REBOOT)
return unload_ok
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)

View File

@@ -7,13 +7,12 @@ from homeassistant.components.alarm_control_panel import (
AlarmControlPanelEntityFeature,
AlarmControlPanelState,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from .const import DOMAIN, FreeboxHomeCategory
from .const import FreeboxHomeCategory
from .entity import FreeboxHomeEntity
from .router import FreeboxRouter
from .router import FreeboxConfigEntry, FreeboxRouter
FREEBOX_TO_STATUS = {
"alarm1_arming": AlarmControlPanelState.ARMING,
@@ -29,11 +28,11 @@ FREEBOX_TO_STATUS = {
async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
entry: FreeboxConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up alarm panel."""
router: FreeboxRouter = hass.data[DOMAIN][entry.unique_id]
router = entry.runtime_data
async_add_entities(
(

View File

@@ -10,15 +10,14 @@ from homeassistant.components.binary_sensor import (
BinarySensorEntity,
BinarySensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EntityCategory
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from .const import DOMAIN, FreeboxHomeCategory
from .const import FreeboxHomeCategory
from .entity import FreeboxHomeEntity
from .router import FreeboxRouter
from .router import FreeboxConfigEntry, FreeboxRouter
_LOGGER = logging.getLogger(__name__)
@@ -35,11 +34,11 @@ RAID_SENSORS: tuple[BinarySensorEntityDescription, ...] = (
async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
entry: FreeboxConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up binary sensors."""
router: FreeboxRouter = hass.data[DOMAIN][entry.unique_id]
router = entry.runtime_data
_LOGGER.debug("%s - %s - %s raid(s)", router.name, router.mac, len(router.raids))

View File

@@ -10,13 +10,11 @@ from homeassistant.components.button import (
ButtonEntity,
ButtonEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EntityCategory
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from .const import DOMAIN
from .router import FreeboxRouter
from .router import FreeboxConfigEntry, FreeboxRouter
@dataclass(frozen=True, kw_only=True)
@@ -45,11 +43,11 @@ BUTTON_DESCRIPTIONS: tuple[FreeboxButtonEntityDescription, ...] = (
async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
entry: FreeboxConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up the buttons."""
router: FreeboxRouter = hass.data[DOMAIN][entry.unique_id]
router = entry.runtime_data
entities = [
FreeboxButton(router, description) for description in BUTTON_DESCRIPTIONS
]

View File

@@ -12,27 +12,26 @@ from homeassistant.components.ffmpeg.camera import (
DEFAULT_ARGUMENTS,
FFmpegCamera,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_NAME
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import entity_platform
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from .const import ATTR_DETECTION, DOMAIN, FreeboxHomeCategory
from .const import ATTR_DETECTION, FreeboxHomeCategory
from .entity import FreeboxHomeEntity
from .router import FreeboxRouter
from .router import FreeboxConfigEntry, FreeboxRouter
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
entry: FreeboxConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up cameras."""
router: FreeboxRouter = hass.data[DOMAIN][entry.unique_id]
router = entry.runtime_data
tracked: set[str] = set()
@callback

View File

@@ -8,7 +8,6 @@ import socket
from homeassistant.const import Platform
DOMAIN = "freebox"
SERVICE_REBOOT = "reboot"
APP_DESC = {
"app_id": "hass",

View File

@@ -6,22 +6,21 @@ from datetime import datetime
from typing import Any
from homeassistant.components.device_tracker import ScannerEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from .const import DEFAULT_DEVICE_NAME, DEVICE_ICONS, DOMAIN
from .router import FreeboxRouter
from .const import DEFAULT_DEVICE_NAME, DEVICE_ICONS
from .router import FreeboxConfigEntry, FreeboxRouter
async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
entry: FreeboxConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up device tracker for Freebox component."""
router: FreeboxRouter = hass.data[DOMAIN][entry.unique_id]
router = entry.runtime_data
tracked: set[str] = set()
@callback

View File

@@ -38,6 +38,8 @@ from .const import (
_LOGGER = logging.getLogger(__name__)
type FreeboxConfigEntry = ConfigEntry[FreeboxRouter]
def is_json(json_str: str) -> bool:
"""Validate if a String is a JSON value or not."""
@@ -102,7 +104,7 @@ class FreeboxRouter:
def __init__(
self,
hass: HomeAssistant,
entry: ConfigEntry,
entry: FreeboxConfigEntry,
api: Freepybox,
freebox_config: Mapping[str, Any],
) -> None:

View File

@@ -10,7 +10,6 @@ from homeassistant.components.sensor import (
SensorEntity,
SensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import PERCENTAGE, UnitOfDataRate, UnitOfTemperature
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.device_registry import DeviceInfo
@@ -20,7 +19,7 @@ from homeassistant.util import dt as dt_util
from .const import DOMAIN
from .entity import FreeboxHomeEntity
from .router import FreeboxRouter
from .router import FreeboxConfigEntry, FreeboxRouter
_LOGGER = logging.getLogger(__name__)
@@ -61,11 +60,11 @@ DISK_PARTITION_SENSORS: tuple[SensorEntityDescription, ...] = (
async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
entry: FreeboxConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up the sensors."""
router: FreeboxRouter = hass.data[DOMAIN][entry.unique_id]
router = entry.runtime_data
entities: list[SensorEntity] = []
_LOGGER.debug(

View File

@@ -8,13 +8,11 @@ from typing import Any
from freebox_api.exceptions import InsufficientPermissionsError
from homeassistant.components.switch import SwitchEntity, SwitchEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EntityCategory
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from .const import DOMAIN
from .router import FreeboxRouter
from .router import FreeboxConfigEntry, FreeboxRouter
_LOGGER = logging.getLogger(__name__)
@@ -30,11 +28,11 @@ SWITCH_DESCRIPTIONS = [
async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
entry: FreeboxConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up the switch."""
router: FreeboxRouter = hass.data[DOMAIN][entry.unique_id]
router = entry.runtime_data
entities = [
FreeboxSwitch(router, entity_description)
for entity_description in SWITCH_DESCRIPTIONS

View File

@@ -15,6 +15,8 @@ from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.typing import ConfigType
from .const import (
CONF_FEATURE_DEVICE_TRACKING,
DEFAULT_CONF_FEATURE_DEVICE_TRACKING,
DEFAULT_SSL,
DOMAIN,
FRITZ_AUTH_EXCEPTIONS,
@@ -38,6 +40,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
async def async_setup_entry(hass: HomeAssistant, entry: FritzConfigEntry) -> bool:
"""Set up fritzboxtools from config entry."""
_LOGGER.debug("Setting up FRITZ!Box Tools component")
avm_wrapper = AvmWrapper(
hass=hass,
config_entry=entry,
@@ -46,6 +49,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: FritzConfigEntry) -> boo
username=entry.data[CONF_USERNAME],
password=entry.data[CONF_PASSWORD],
use_tls=entry.data.get(CONF_SSL, DEFAULT_SSL),
device_discovery_enabled=entry.options.get(
CONF_FEATURE_DEVICE_TRACKING, DEFAULT_CONF_FEATURE_DEVICE_TRACKING
),
)
try:
@@ -62,6 +68,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: FritzConfigEntry) -> boo
raise ConfigEntryAuthFailed("Missing UPnP configuration")
await avm_wrapper.async_config_entry_first_refresh()
await avm_wrapper.async_trigger_cleanup()
entry.runtime_data = avm_wrapper

View File

@@ -35,7 +35,9 @@ from homeassistant.helpers.service_info.ssdp import (
from homeassistant.helpers.typing import VolDictType
from .const import (
CONF_FEATURE_DEVICE_TRACKING,
CONF_OLD_DISCOVERY,
DEFAULT_CONF_FEATURE_DEVICE_TRACKING,
DEFAULT_CONF_OLD_DISCOVERY,
DEFAULT_HOST,
DEFAULT_HTTP_PORT,
@@ -72,7 +74,8 @@ class FritzBoxToolsFlowHandler(ConfigFlow, domain=DOMAIN):
"""Initialize FRITZ!Box Tools flow."""
self._name: str = ""
self._password: str = ""
self._use_tls: bool = False
self._use_tls: bool = DEFAULT_SSL
self._feature_device_discovery: bool = DEFAULT_CONF_FEATURE_DEVICE_TRACKING
self._port: int | None = None
self._username: str = ""
self._model: str = ""
@@ -141,6 +144,7 @@ class FritzBoxToolsFlowHandler(ConfigFlow, domain=DOMAIN):
options={
CONF_CONSIDER_HOME: DEFAULT_CONSIDER_HOME.total_seconds(),
CONF_OLD_DISCOVERY: DEFAULT_CONF_OLD_DISCOVERY,
CONF_FEATURE_DEVICE_TRACKING: self._feature_device_discovery,
},
)
@@ -204,6 +208,7 @@ class FritzBoxToolsFlowHandler(ConfigFlow, domain=DOMAIN):
self._username = user_input[CONF_USERNAME]
self._password = user_input[CONF_PASSWORD]
self._use_tls = user_input[CONF_SSL]
self._feature_device_discovery = user_input[CONF_FEATURE_DEVICE_TRACKING]
self._port = self._determine_port(user_input)
error = await self.async_fritz_tools_init()
@@ -234,6 +239,10 @@ class FritzBoxToolsFlowHandler(ConfigFlow, domain=DOMAIN):
vol.Required(CONF_USERNAME): str,
vol.Required(CONF_PASSWORD): str,
vol.Optional(CONF_SSL, default=DEFAULT_SSL): bool,
vol.Required(
CONF_FEATURE_DEVICE_TRACKING,
default=DEFAULT_CONF_FEATURE_DEVICE_TRACKING,
): bool,
}
),
errors=errors or {},
@@ -250,6 +259,10 @@ class FritzBoxToolsFlowHandler(ConfigFlow, domain=DOMAIN):
vol.Required(CONF_USERNAME): str,
vol.Required(CONF_PASSWORD): str,
vol.Optional(CONF_SSL, default=DEFAULT_SSL): bool,
vol.Required(
CONF_FEATURE_DEVICE_TRACKING,
default=DEFAULT_CONF_FEATURE_DEVICE_TRACKING,
): bool,
}
),
description_placeholders={"name": self._name},
@@ -405,7 +418,7 @@ class FritzBoxToolsOptionsFlowHandler(OptionsFlow):
"""Handle options flow."""
if user_input is not None:
return self.async_create_entry(title="", data=user_input)
return self.async_create_entry(data=user_input)
options = self.config_entry.options
data_schema = vol.Schema(
@@ -420,6 +433,13 @@ class FritzBoxToolsOptionsFlowHandler(OptionsFlow):
CONF_OLD_DISCOVERY,
default=options.get(CONF_OLD_DISCOVERY, DEFAULT_CONF_OLD_DISCOVERY),
): bool,
vol.Optional(
CONF_FEATURE_DEVICE_TRACKING,
default=options.get(
CONF_FEATURE_DEVICE_TRACKING,
DEFAULT_CONF_FEATURE_DEVICE_TRACKING,
),
): bool,
}
)
return self.async_show_form(step_id="init", data_schema=data_schema)

View File

@@ -40,6 +40,9 @@ PLATFORMS = [
CONF_OLD_DISCOVERY = "old_discovery"
DEFAULT_CONF_OLD_DISCOVERY = False
CONF_FEATURE_DEVICE_TRACKING = "feature_device_tracking"
DEFAULT_CONF_FEATURE_DEVICE_TRACKING = True
DSL_CONNECTION: Literal["dsl"] = "dsl"
DEFAULT_DEVICE_NAME = "Unknown device"

View File

@@ -39,6 +39,7 @@ from homeassistant.util.hass_dict import HassKey
from .const import (
CONF_OLD_DISCOVERY,
DEFAULT_CONF_FEATURE_DEVICE_TRACKING,
DEFAULT_CONF_OLD_DISCOVERY,
DEFAULT_HOST,
DEFAULT_SSL,
@@ -175,6 +176,7 @@ class FritzBoxTools(DataUpdateCoordinator[UpdateCoordinatorDataType]):
username: str = DEFAULT_USERNAME,
host: str = DEFAULT_HOST,
use_tls: bool = DEFAULT_SSL,
device_discovery_enabled: bool = DEFAULT_CONF_FEATURE_DEVICE_TRACKING,
) -> None:
"""Initialize FritzboxTools class."""
super().__init__(
@@ -202,6 +204,7 @@ class FritzBoxTools(DataUpdateCoordinator[UpdateCoordinatorDataType]):
self.port = port
self.username = username
self.use_tls = use_tls
self.device_discovery_enabled = device_discovery_enabled
self.has_call_deflections: bool = False
self._model: str | None = None
self._current_firmware: str | None = None
@@ -332,10 +335,15 @@ class FritzBoxTools(DataUpdateCoordinator[UpdateCoordinatorDataType]):
"entity_states": {},
}
try:
await self.async_scan_devices()
await self.async_update_device_info()
if self.device_discovery_enabled:
await self.async_scan_devices()
entity_data["entity_states"] = await self.hass.async_add_executor_job(
self._entity_states_update
)
if self.has_call_deflections:
entity_data[
"call_deflections"
@@ -521,7 +529,7 @@ class FritzBoxTools(DataUpdateCoordinator[UpdateCoordinatorDataType]):
return {}
def manage_device_info(
self, dev_info: Device, dev_mac: str, consider_home: bool
self, dev_info: Device, dev_mac: str, consider_home: float
) -> bool:
"""Update device lists and return if device is new."""
_LOGGER.debug("Client dev_info: %s", dev_info)
@@ -551,12 +559,8 @@ class FritzBoxTools(DataUpdateCoordinator[UpdateCoordinatorDataType]):
if new_device:
async_dispatcher_send(self.hass, self.signal_device_new)
async def async_scan_devices(self, now: datetime | None = None) -> None:
"""Scan for new devices and return a list of found device ids."""
if self.hass.is_stopping:
_ha_is_stopping("scan devices")
return
async def async_update_device_info(self, now: datetime | None = None) -> None:
"""Update own device information."""
_LOGGER.debug("Checking host info for FRITZ!Box device %s", self.host)
(
@@ -565,6 +569,13 @@ class FritzBoxTools(DataUpdateCoordinator[UpdateCoordinatorDataType]):
self._release_url,
) = await self._async_update_device_info()
async def async_scan_devices(self, now: datetime | None = None) -> None:
"""Scan for new network devices."""
if self.hass.is_stopping:
_ha_is_stopping("scan devices")
return
_LOGGER.debug("Checking devices for FRITZ!Box device %s", self.host)
_default_consider_home = DEFAULT_CONSIDER_HOME.total_seconds()
if self._options:
@@ -683,7 +694,10 @@ class FritzBoxTools(DataUpdateCoordinator[UpdateCoordinatorDataType]):
async def async_trigger_cleanup(self) -> None:
"""Trigger device trackers cleanup."""
device_hosts = await self._async_update_hosts_info()
_LOGGER.debug("Device tracker cleanup triggered")
device_hosts = {self.mac: Device(True, "", "", "", "", None)}
if self.device_discovery_enabled:
device_hosts = await self._async_update_hosts_info()
entity_reg: er.EntityRegistry = er.async_get(self.hass)
config_entry = self.config_entry

View File

@@ -4,7 +4,9 @@
"data_description_port": "Leave empty to use the default port.",
"data_description_username": "Username for the FRITZ!Box.",
"data_description_password": "Password for the FRITZ!Box.",
"data_description_ssl": "Use SSL to connect to the FRITZ!Box."
"data_description_ssl": "Use SSL to connect to the FRITZ!Box.",
"data_description_feature_device_tracking": "Enable or disable the network device tracking feature.",
"data_feature_device_tracking": "Enable network device tracking"
},
"config": {
"flow_title": "{name}",
@@ -15,12 +17,14 @@
"data": {
"username": "[%key:common::config_flow::data::username%]",
"password": "[%key:common::config_flow::data::password%]",
"ssl": "[%key:common::config_flow::data::ssl%]"
"ssl": "[%key:common::config_flow::data::ssl%]",
"feature_device_tracking": "[%key:component::fritz::common::data_feature_device_tracking%]"
},
"data_description": {
"username": "[%key:component::fritz::common::data_description_username%]",
"password": "[%key:component::fritz::common::data_description_password%]",
"ssl": "[%key:component::fritz::common::data_description_ssl%]"
"ssl": "[%key:component::fritz::common::data_description_ssl%]",
"feature_device_tracking": "[%key:component::fritz::common::data_description_feature_device_tracking%]"
}
},
"reauth_confirm": {
@@ -57,14 +61,16 @@
"port": "[%key:common::config_flow::data::port%]",
"username": "[%key:common::config_flow::data::username%]",
"password": "[%key:common::config_flow::data::password%]",
"ssl": "[%key:common::config_flow::data::ssl%]"
"ssl": "[%key:common::config_flow::data::ssl%]",
"feature_device_tracking": "[%key:component::fritz::common::data_feature_device_tracking%]"
},
"data_description": {
"host": "[%key:component::fritz::common::data_description_host%]",
"port": "[%key:component::fritz::common::data_description_port%]",
"username": "[%key:component::fritz::common::data_description_username%]",
"password": "[%key:component::fritz::common::data_description_password%]",
"ssl": "[%key:component::fritz::common::data_description_ssl%]"
"ssl": "[%key:component::fritz::common::data_description_ssl%]",
"feature_device_tracking": "[%key:component::fritz::common::data_description_feature_device_tracking%]"
}
}
},
@@ -89,11 +95,13 @@
"init": {
"data": {
"consider_home": "Seconds to consider a device at 'home'",
"old_discovery": "Enable old discovery method"
"old_discovery": "Enable old discovery method",
"feature_device_tracking": "[%key:component::fritz::common::data_feature_device_tracking%]"
},
"data_description": {
"consider_home": "Time in seconds to consider a device at home. Default is 180 seconds.",
"old_discovery": "Enable old discovery method. This is needed for some scenarios."
"old_discovery": "Enable old discovery method. This is needed for some scenarios.",
"feature_device_tracking": "[%key:component::fritz::common::data_description_feature_device_tracking%]"
}
}
}

View File

@@ -144,6 +144,7 @@ class FritzboxThermostat(FritzBoxDeviceEntity, ClimateEntity):
async def async_set_temperature(self, **kwargs: Any) -> None:
"""Set new target temperature."""
self.check_active_or_lock_mode()
if kwargs.get(ATTR_HVAC_MODE) is HVACMode.OFF:
await self.async_set_hkr_state("off")
elif (target_temp := kwargs.get(ATTR_TEMPERATURE)) is not None:
@@ -168,11 +169,7 @@ class FritzboxThermostat(FritzBoxDeviceEntity, ClimateEntity):
async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
"""Set new operation mode."""
if self.data.holiday_active or self.data.summer_active:
raise HomeAssistantError(
translation_domain=DOMAIN,
translation_key="change_hvac_while_active_mode",
)
self.check_active_or_lock_mode()
if self.hvac_mode is hvac_mode:
LOGGER.debug(
"%s is already in requested hvac mode %s", self.name, hvac_mode
@@ -204,11 +201,7 @@ class FritzboxThermostat(FritzBoxDeviceEntity, ClimateEntity):
async def async_set_preset_mode(self, preset_mode: str) -> None:
"""Set preset mode."""
if self.data.holiday_active or self.data.summer_active:
raise HomeAssistantError(
translation_domain=DOMAIN,
translation_key="change_preset_while_active_mode",
)
self.check_active_or_lock_mode()
await self.async_set_hkr_state(PRESET_API_HKR_STATE_MAPPING[preset_mode])
@property
@@ -230,3 +223,17 @@ class FritzboxThermostat(FritzBoxDeviceEntity, ClimateEntity):
attrs[ATTR_STATE_WINDOW_OPEN] = self.data.window_open
return attrs
def check_active_or_lock_mode(self) -> None:
"""Check if in summer/vacation mode or lock enabled."""
if self.data.holiday_active or self.data.summer_active:
raise HomeAssistantError(
translation_domain=DOMAIN,
translation_key="change_settings_while_active_mode",
)
if self.data.lock:
raise HomeAssistantError(
translation_domain=DOMAIN,
translation_key="change_settings_while_lock_enabled",
)

View File

@@ -88,11 +88,11 @@
"manual_switching_disabled": {
"message": "Can't toggle switch while manual switching is disabled for the device."
},
"change_preset_while_active_mode": {
"message": "Can't change preset while holiday or summer mode is active on the device."
"change_settings_while_lock_enabled": {
"message": "Can't change settings while manual access for telephone, app, or user interface is disabled on the device"
},
"change_hvac_while_active_mode": {
"message": "Can't change HVAC mode while holiday or summer mode is active on the device."
"change_settings_while_active_mode": {
"message": "Can't change settings while holiday or summer mode is active on the device."
}
}
}

View File

@@ -39,9 +39,9 @@
"options": {
"step": {
"init": {
"title": "Configure Prefixes",
"title": "Configure prefixes",
"data": {
"prefixes": "Prefixes (comma separated list)"
"prefixes": "Prefixes (comma-separated list)"
}
}
},

View File

@@ -140,16 +140,16 @@
"ac_module_temperature_sensor_faulty_l3": "AC module temperature sensor faulty (L3)",
"dc_module_temperature_sensor_faulty": "DC module temperature sensor faulty",
"internal_processor_status": "Warning about the internal processor status. See status code for more information",
"eeprom_reinitialised": "EEPROM has been re-initialised",
"initialisation_error_usb_flash_drive_not_supported": "Initialisation error USB flash drive is not supported",
"initialisation_error_usb_stick_over_current": "Initialisation error Overcurrent on USB stick",
"eeprom_reinitialised": "EEPROM has been re-initialized",
"initialisation_error_usb_flash_drive_not_supported": "Initialization error USB flash drive is not supported",
"initialisation_error_usb_stick_over_current": "Initialization error Overcurrent on USB stick",
"no_usb_flash_drive_connected": "No USB flash drive connected",
"update_file_not_recognised_or_missing": "Update file not recognised or not present",
"update_file_not_recognised_or_missing": "Update file not recognized or not present",
"update_file_does_not_match_device": "Update file does not match the device, update file too old",
"write_or_read_error_occurred": "Write or read error occurred",
"file_could_not_be_opened": "File could not be opened",
"log_file_cannot_be_saved": "Log file cannot be saved (e.g. USB flash drive is write protected or full)",
"initialisation_error_file_system_error_on_usb": "Initialisation error in file system on USB flash drive",
"initialisation_error_file_system_error_on_usb": "Initialization error in file system on USB flash drive",
"error_during_logging_data_recording": "Error during recording of logging data",
"error_during_update_process": "Error occurred during update process",
"update_file_corrupt": "Update file corrupt",

View File

@@ -20,5 +20,5 @@
"documentation": "https://www.home-assistant.io/integrations/frontend",
"integration_type": "system",
"quality_scale": "internal",
"requirements": ["home-assistant-frontend==20250430.2"]
"requirements": ["home-assistant-frontend==20250502.1"]
}

View File

@@ -1,5 +1,7 @@
"""Support for controlling Global Cache gc100."""
from __future__ import annotations
import gc100
import voluptuous as vol
@@ -7,13 +9,14 @@ from homeassistant.const import CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_STOP
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.typing import ConfigType
from homeassistant.util.hass_dict import HassKey
CONF_PORTS = "ports"
DEFAULT_PORT = 4998
DOMAIN = "gc100"
DATA_GC100 = "gc100"
DATA_GC100: HassKey[GC100Device] = HassKey("gc100")
CONFIG_SCHEMA = vol.Schema(
{

View File

@@ -14,7 +14,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 CONF_PORTS, DATA_GC100
from . import CONF_PORTS, DATA_GC100, GC100Device
_SENSORS_SCHEMA = vol.Schema({cv.string: cv.string})
@@ -31,7 +31,7 @@ def setup_platform(
) -> None:
"""Set up the GC100 devices."""
binary_sensors = []
ports = config[CONF_PORTS]
ports: list[dict[str, str]] = config[CONF_PORTS]
for port in ports:
for port_addr, port_name in port.items():
binary_sensors.append(
@@ -43,23 +43,23 @@ def setup_platform(
class GC100BinarySensor(BinarySensorEntity):
"""Representation of a binary sensor from GC100."""
def __init__(self, name, port_addr, gc100):
def __init__(self, name: str, port_addr: str, gc100: GC100Device) -> None:
"""Initialize the GC100 binary sensor."""
self._name = name or DEVICE_DEFAULT_NAME
self._port_addr = port_addr
self._gc100 = gc100
self._state = None
self._state: bool | None = None
# Subscribe to be notified about state changes (PUSH)
self._gc100.subscribe(self._port_addr, self.set_state)
@property
def name(self):
def name(self) -> str:
"""Return the name of the sensor."""
return self._name
@property
def is_on(self):
def is_on(self) -> bool | None:
"""Return the state of the entity."""
return self._state
@@ -67,7 +67,7 @@ class GC100BinarySensor(BinarySensorEntity):
"""Update the sensor state."""
self._gc100.read_sensor(self._port_addr, self.set_state)
def set_state(self, state):
def set_state(self, state: int) -> None:
"""Set the current state."""
self._state = state == 1
self.schedule_update_ha_state()

View File

@@ -16,7 +16,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 CONF_PORTS, DATA_GC100
from . import CONF_PORTS, DATA_GC100, GC100Device
_SWITCH_SCHEMA = vol.Schema({cv.string: cv.string})
@@ -33,7 +33,7 @@ def setup_platform(
) -> None:
"""Set up the GC100 devices."""
switches = []
ports = config[CONF_PORTS]
ports: list[dict[str, str]] = config[CONF_PORTS]
for port in ports:
for port_addr, port_name in port.items():
switches.append(GC100Switch(port_name, port_addr, hass.data[DATA_GC100]))
@@ -43,20 +43,20 @@ def setup_platform(
class GC100Switch(SwitchEntity):
"""Represent a switch/relay from GC100."""
def __init__(self, name, port_addr, gc100):
def __init__(self, name: str, port_addr: str, gc100: GC100Device) -> None:
"""Initialize the GC100 switch."""
self._name = name or DEVICE_DEFAULT_NAME
self._port_addr = port_addr
self._gc100 = gc100
self._state = None
self._state: bool | None = None
@property
def name(self):
def name(self) -> str:
"""Return the name of the switch."""
return self._name
@property
def is_on(self):
def is_on(self) -> bool | None:
"""Return the state of the entity."""
return self._state
@@ -72,7 +72,7 @@ class GC100Switch(SwitchEntity):
"""Update the sensor state."""
self._gc100.read_sensor(self._port_addr, self.set_state)
def set_state(self, state):
def set_state(self, state: int) -> None:
"""Set the current state."""
self._state = state == 1
self.schedule_update_ha_state()

View File

@@ -25,22 +25,17 @@ from homeassistant.helpers.event import async_track_time_interval
from homeassistant.util.unit_conversion import DistanceConverter
from homeassistant.util.unit_system import US_CUSTOMARY_SYSTEM
from .const import ( # noqa: F401
CONF_CATEGORIES,
DEFAULT_SCAN_INTERVAL,
DOMAIN,
FEED,
PLATFORMS,
)
from .const import CONF_CATEGORIES, DEFAULT_SCAN_INTERVAL, PLATFORMS # noqa: F401
_LOGGER = logging.getLogger(__name__)
type GdacsConfigEntry = ConfigEntry[GdacsFeedEntityManager]
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
async def async_setup_entry(
hass: HomeAssistant, config_entry: GdacsConfigEntry
) -> bool:
"""Set up the GDACS component as config entry."""
hass.data.setdefault(DOMAIN, {})
feeds = hass.data[DOMAIN].setdefault(FEED, {})
radius = config_entry.data[CONF_RADIUS]
if hass.config.units is US_CUSTOMARY_SYSTEM:
radius = DistanceConverter.convert(
@@ -48,16 +43,15 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
)
# Create feed entity manager for all platforms.
manager = GdacsFeedEntityManager(hass, config_entry, radius)
feeds[config_entry.entry_id] = manager
config_entry.runtime_data = manager
_LOGGER.debug("Feed entity manager added for %s", config_entry.entry_id)
await manager.async_init()
return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_unload_entry(hass: HomeAssistant, entry: GdacsConfigEntry) -> bool:
"""Unload an GDACS component config entry."""
manager: GdacsFeedEntityManager = hass.data[DOMAIN][FEED].pop(entry.entry_id)
await manager.async_stop()
await entry.runtime_data.async_stop()
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
@@ -65,7 +59,7 @@ class GdacsFeedEntityManager:
"""Feed Entity Manager for GDACS feed."""
def __init__(
self, hass: HomeAssistant, config_entry: ConfigEntry, radius_in_km: float
self, hass: HomeAssistant, config_entry: GdacsConfigEntry, radius_in_km: float
) -> None:
"""Initialize the Feed Entity Manager."""
self._hass = hass

View File

@@ -10,8 +10,6 @@ DOMAIN = "gdacs"
PLATFORMS = [Platform.GEO_LOCATION, Platform.SENSOR]
FEED = "feed"
CONF_CATEGORIES = "categories"
DEFAULT_ICON = "mdi:alert"

View File

@@ -7,26 +7,23 @@ from typing import Any
from aio_georss_client.status_update import StatusUpdate
from homeassistant.components.diagnostics import async_redact_data
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE
from homeassistant.core import HomeAssistant
from . import GdacsFeedEntityManager
from .const import DOMAIN, FEED
from . import GdacsConfigEntry
TO_REDACT = {CONF_LATITUDE, CONF_LONGITUDE}
async def async_get_config_entry_diagnostics(
hass: HomeAssistant, config_entry: ConfigEntry
hass: HomeAssistant, config_entry: GdacsConfigEntry
) -> dict[str, Any]:
"""Return diagnostics for a config entry."""
data: dict[str, Any] = {
"info": async_redact_data(config_entry.data, TO_REDACT),
}
manager: GdacsFeedEntityManager = hass.data[DOMAIN][FEED][config_entry.entry_id]
status_info: StatusUpdate = manager.status_info()
status_info: StatusUpdate = config_entry.runtime_data.status_info()
if status_info:
data["service"] = {
"status": status_info.status,

View File

@@ -10,7 +10,6 @@ from typing import Any
from aio_georss_gdacs.feed_entry import GdacsFeedEntry
from homeassistant.components.geo_location import GeolocationEvent
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import UnitOfLength
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import entity_registry as er
@@ -19,8 +18,8 @@ from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from homeassistant.util.unit_conversion import DistanceConverter
from homeassistant.util.unit_system import US_CUSTOMARY_SYSTEM
from . import GdacsFeedEntityManager
from .const import DEFAULT_ICON, DOMAIN, FEED
from . import GdacsConfigEntry, GdacsFeedEntityManager
from .const import DEFAULT_ICON
_LOGGER = logging.getLogger(__name__)
@@ -53,11 +52,11 @@ SOURCE = "gdacs"
async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
entry: GdacsConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up the GDACS Feed platform."""
manager: GdacsFeedEntityManager = hass.data[DOMAIN][FEED][entry.entry_id]
manager = entry.runtime_data
@callback
def async_add_geolocation(

View File

@@ -10,15 +10,14 @@ from typing import Any
from aio_georss_client.status_update import StatusUpdate
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from homeassistant.util import dt as dt_util
from . import GdacsFeedEntityManager
from .const import DOMAIN, FEED
from . import GdacsConfigEntry, GdacsFeedEntityManager
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
@@ -38,12 +37,11 @@ PARALLEL_UPDATES = 0
async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
entry: GdacsConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up the GDACS Feed platform."""
manager: GdacsFeedEntityManager = hass.data[DOMAIN][FEED][entry.entry_id]
sensor = GdacsSensor(entry, manager)
sensor = GdacsSensor(entry, entry.runtime_data)
async_add_entities([sensor])
@@ -57,7 +55,7 @@ class GdacsSensor(SensorEntity):
_attr_translation_key = "alerts"
def __init__(
self, config_entry: ConfigEntry, manager: GdacsFeedEntityManager
self, config_entry: GdacsConfigEntry, manager: GdacsFeedEntityManager
) -> None:
"""Initialize entity."""
assert config_entry.unique_id

View File

@@ -1,6 +1,5 @@
"""The Geocaching integration."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers.config_entry_oauth2_flow import (
@@ -8,13 +7,12 @@ from homeassistant.helpers.config_entry_oauth2_flow import (
async_get_config_entry_implementation,
)
from .const import DOMAIN
from .coordinator import GeocachingDataUpdateCoordinator
from .coordinator import GeocachingConfigEntry, GeocachingDataUpdateCoordinator
PLATFORMS = [Platform.SENSOR]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_setup_entry(hass: HomeAssistant, entry: GeocachingConfigEntry) -> bool:
"""Set up Geocaching from a config entry."""
implementation = await async_get_config_entry_implementation(hass, entry)
@@ -25,15 +23,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
await coordinator.async_config_entry_first_refresh()
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = coordinator
entry.runtime_data = coordinator
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_unload_entry(hass: HomeAssistant, entry: GeocachingConfigEntry) -> bool:
"""Unload a config entry."""
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
del hass.data[DOMAIN][entry.entry_id]
return unload_ok
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)

View File

@@ -14,14 +14,20 @@ from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, Upda
from .const import DOMAIN, ENVIRONMENT, LOGGER, UPDATE_INTERVAL
type GeocachingConfigEntry = ConfigEntry[GeocachingDataUpdateCoordinator]
class GeocachingDataUpdateCoordinator(DataUpdateCoordinator[GeocachingStatus]):
"""Class to manage fetching Geocaching data from single endpoint."""
config_entry: ConfigEntry
config_entry: GeocachingConfigEntry
def __init__(
self, hass: HomeAssistant, *, entry: ConfigEntry, session: OAuth2Session
self,
hass: HomeAssistant,
*,
entry: GeocachingConfigEntry,
session: OAuth2Session,
) -> None:
"""Initialize global Geocaching data updater."""
self.session = session

View File

@@ -9,14 +9,13 @@ from typing import cast
from geocachingapi.models import GeocachingStatus
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import DOMAIN
from .coordinator import GeocachingDataUpdateCoordinator
from .coordinator import GeocachingConfigEntry, GeocachingDataUpdateCoordinator
@dataclass(frozen=True, kw_only=True)
@@ -65,11 +64,11 @@ SENSORS: tuple[GeocachingSensorEntityDescription, ...] = (
async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
entry: GeocachingConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up a Geocaching sensor entry."""
coordinator = hass.data[DOMAIN][entry.entry_id]
coordinator = entry.runtime_data
async_add_entities(
GeocachingSensor(coordinator, description) for description in SENSORS
)

View File

@@ -10,7 +10,7 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from homeassistant.helpers.restore_state import RestoreEntity
from . import DOMAIN as GF_DOMAIN, TRACKER_UPDATE
from . import DOMAIN, TRACKER_UPDATE
async def async_setup_entry(
@@ -23,14 +23,14 @@ async def async_setup_entry(
@callback
def _receive_data(device, gps, location_name, attributes):
"""Fire HA event to set location."""
if device in hass.data[GF_DOMAIN]["devices"]:
if device in hass.data[DOMAIN]["devices"]:
return
hass.data[GF_DOMAIN]["devices"].add(device)
hass.data[DOMAIN]["devices"].add(device)
async_add_entities([GeofencyEntity(device, gps, location_name, attributes)])
hass.data[GF_DOMAIN]["unsub_device_tracker"][config_entry.entry_id] = (
hass.data[DOMAIN]["unsub_device_tracker"][config_entry.entry_id] = (
async_dispatcher_connect(hass, TRACKER_UPDATE, _receive_data)
)
@@ -45,7 +45,7 @@ async def async_setup_entry(
}
if dev_ids:
hass.data[GF_DOMAIN]["devices"].update(dev_ids)
hass.data[DOMAIN]["devices"].update(dev_ids)
async_add_entities(GeofencyEntity(dev_id) for dev_id in dev_ids)
@@ -66,7 +66,7 @@ class GeofencyEntity(TrackerEntity, RestoreEntity):
self._unsub_dispatcher = None
self._attr_unique_id = device
self._attr_device_info = DeviceInfo(
identifiers={(GF_DOMAIN, device)},
identifiers={(DOMAIN, device)},
name=device,
)
@@ -93,7 +93,7 @@ class GeofencyEntity(TrackerEntity, RestoreEntity):
"""Clean up after entity before removal."""
await super().async_will_remove_from_hass()
self._unsub_dispatcher()
self.hass.data[GF_DOMAIN]["devices"].remove(self.unique_id)
self.hass.data[DOMAIN]["devices"].remove(self.unique_id)
@callback
def _async_receive_data(self, device, gps, location_name, attributes):

View File

@@ -31,7 +31,6 @@ from .const import (
DEFAULT_RADIUS,
DEFAULT_SCAN_INTERVAL,
DOMAIN,
FEED,
PLATFORMS,
)
@@ -59,6 +58,8 @@ CONFIG_SCHEMA = vol.Schema(
extra=vol.ALLOW_EXTRA,
)
type GeonetnzQuakesConfigEntry = ConfigEntry[GeonetnzQuakesFeedEntityManager]
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the GeoNet NZ Quakes component."""
@@ -89,11 +90,10 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
return True
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
async def async_setup_entry(
hass: HomeAssistant, config_entry: GeonetnzQuakesConfigEntry
) -> bool:
"""Set up the GeoNet NZ Quakes component as config entry."""
hass.data.setdefault(DOMAIN, {})
feeds = hass.data[DOMAIN].setdefault(FEED, {})
radius = config_entry.data[CONF_RADIUS]
if hass.config.units is US_CUSTOMARY_SYSTEM:
radius = DistanceConverter.convert(
@@ -101,16 +101,17 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
)
# Create feed entity manager for all platforms.
manager = GeonetnzQuakesFeedEntityManager(hass, config_entry, radius)
feeds[config_entry.entry_id] = manager
config_entry.runtime_data = manager
_LOGGER.debug("Feed entity manager added for %s", config_entry.entry_id)
await manager.async_init()
return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_unload_entry(
hass: HomeAssistant, entry: GeonetnzQuakesConfigEntry
) -> bool:
"""Unload an GeoNet NZ Quakes component config entry."""
manager = hass.data[DOMAIN][FEED].pop(entry.entry_id)
await manager.async_stop()
await entry.runtime_data.async_stop()
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)

View File

@@ -11,8 +11,6 @@ PLATFORMS = [Platform.GEO_LOCATION, Platform.SENSOR]
CONF_MINIMUM_MAGNITUDE = "minimum_magnitude"
CONF_MMI = "mmi"
FEED = "feed"
DEFAULT_FILTER_TIME_INTERVAL = timedelta(days=7)
DEFAULT_MINIMUM_MAGNITUDE = 0.0
DEFAULT_MMI = 3

View File

@@ -5,28 +5,23 @@ from __future__ import annotations
from typing import Any
from homeassistant.components.diagnostics import async_redact_data
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE
from homeassistant.core import HomeAssistant
from . import GeonetnzQuakesFeedEntityManager
from .const import DOMAIN, FEED
from . import GeonetnzQuakesConfigEntry
TO_REDACT = {CONF_LATITUDE, CONF_LONGITUDE}
async def async_get_config_entry_diagnostics(
hass: HomeAssistant, config_entry: ConfigEntry
hass: HomeAssistant, config_entry: GeonetnzQuakesConfigEntry
) -> dict[str, Any]:
"""Return diagnostics for a config entry."""
data: dict[str, Any] = {
"info": async_redact_data(config_entry.data, TO_REDACT),
}
manager: GeonetnzQuakesFeedEntityManager = hass.data[DOMAIN][FEED][
config_entry.entry_id
]
status_info = manager.status_info()
status_info = config_entry.runtime_data.status_info()
if status_info:
data["service"] = {
"status": status_info.status,

View File

@@ -9,7 +9,6 @@ from typing import Any
from aio_geojson_geonetnz_quakes.feed_entry import GeonetnzQuakesFeedEntry
from homeassistant.components.geo_location import GeolocationEvent
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TIME, UnitOfLength
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import entity_registry as er
@@ -18,8 +17,7 @@ from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from homeassistant.util.unit_conversion import DistanceConverter
from homeassistant.util.unit_system import US_CUSTOMARY_SYSTEM
from . import GeonetnzQuakesFeedEntityManager
from .const import DOMAIN, FEED
from . import GeonetnzQuakesConfigEntry, GeonetnzQuakesFeedEntityManager
_LOGGER = logging.getLogger(__name__)
@@ -39,11 +37,11 @@ SOURCE = "geonetnz_quakes"
async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
entry: GeonetnzQuakesConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up the GeoNet NZ Quakes Feed platform."""
manager: GeonetnzQuakesFeedEntityManager = hass.data[DOMAIN][FEED][entry.entry_id]
manager = entry.runtime_data
@callback
def async_add_geolocation(

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