Compare commits

...

587 Commits

Author SHA1 Message Date
Erik
95b532df41 Make ConfigFlow.async_set_unique_id smarter 2024-08-20 15:26:44 +02:00
Erik Montnemery
a1e3e7f24f Deduplicate OTBR test fixtures (#124293) 2024-08-20 14:58:34 +02:00
Erik Montnemery
15976b8207 Disable expensive pskc computation in all otbr tests (#124292)
* Disable expensive pskc computation in all otbr tests

* Update tests and fixtures which patched compute_pskc
2024-08-20 14:53:06 +02:00
mvn23
b1d9e5580c Update opentherm_gw.sensor to use entity_description (#124283) 2024-08-20 14:51:08 +02:00
epenet
3dc83ef19d Add missing hass type hint in component tests (t) (#124274) 2024-08-20 12:55:39 +02:00
epenet
14775c822f Add missing hass type hint in component tests (y) (#124286) 2024-08-20 12:55:14 +02:00
epenet
69a5605551 Add missing hass type hint in component tests (x) (#124285) 2024-08-20 12:54:57 +02:00
epenet
c2dc4ef215 Add missing hass type hint in component tests (w) (#124284) 2024-08-20 12:54:42 +02:00
epenet
e6eedc0717 Add missing hass type hint in component tests (v) (#124281) 2024-08-20 12:54:15 +02:00
epenet
d901cb04b8 Add missing hass type hint in component tests (u) (#124275) 2024-08-20 12:53:48 +02:00
epenet
f66b539027 Add missing hass type hint in component tests (s) (#124272) 2024-08-20 12:53:29 +02:00
epenet
d961e20b15 Add missing hass type hint in component tests (p) (#124227) 2024-08-20 12:52:33 +02:00
epenet
93f791e5d0 Add missing hass type hint in component tests (n) (#124225) 2024-08-20 12:48:06 +02:00
epenet
db92f29c00 Improve type hints in homekit and homekit_controller tests (#124213)
Add missing hass type hint in homekit and homekit_controller tests
2024-08-20 12:47:41 +02:00
Stefan Agner
be255613de Add additional tests for Matter update entity (#122575)
* Add additional tests for Matter update entity

Extend test coverage for Matter update entity. This includes tests for
error handling and state store/restore.

* Improve test descriptions

* Add restore test only (using mock_restore_cache_with_extra_data)

* Fix test_update_state_save_and_restore test

* Use homeassistant constants

* Use update component constants

* Use freezer to skip time for device update check

We check device updates every 12h currently. Use the freezer to skip
time.

Still add a test which uses the service call to make sure this works
too.
2024-08-20 12:10:25 +02:00
TimL
98a007cb2f New Integration: SMLIGHT SLZB-06 Adapters Integration (#118675)
* Initial SMLIGHT integration

Signed-off-by: Tim Lunn <tl@smlight.tech>

* Generated content

Signed-off-by: Tim Lunn <tl@smlight.tech>

* Cleanup LOGGING

* Use runtime data

* Call super first

* coordinator instance attributes

* Move coordinatorEntity and attr to base class

* cleanup sensors

* update strings to use sentence case

* Improve reauth flow on incorrect credentials

* Use fixture for config_flow tests and test to completion

* Split uptime hndling into a new uptime sensor entity

* Drop server side events and internet callback

will bring this back with binary sensor Platform

* consolidate coordinator setup

* entity always include connections

* get_hostname tweak

* Add tests for init, coordinator and sensor

* Use custom type SmConfigEntry

* update sensor snapshot

* Drop reauth flow for later PR

* Use _async_setup for initial setup

* drop internet to be set later

* sensor fixes

* config flow re

* typing fixes

* Bump pysmlight dependency to 0.0.12

* dont trigger invalid auth message when first loading auth step

* Merge uptime sensors back into main sensor class

* clarify uptime handling

* Apply suggestions from code review

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

* address review comments

* pass host as parameter to the dataCoordinator

* drop uptime sensors for a later PR

* update sensor test snapshot

* move coordinator unique_id to _async_setup

* fix CI

* Apply suggestions from code review

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

* drop invalid_auth test tag

* use snapshot_platform, update fixtures

* Finish all tests with abort or create entry

* drop coordinator tests and remove hostname support

* add test for update failure on connection error

* use freezer for update_failed test

* fix pysmlight imports

---------

Signed-off-by: Tim Lunn <tl@smlight.tech>
Co-authored-by: Tim Lunn <tim@feathertop.org>
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-08-20 10:44:06 +02:00
Erik Montnemery
b4648136c5 Deduplicate otbr tests (#124270) 2024-08-20 10:33:16 +02:00
Erik Montnemery
d3deaa6a82 Improve otbr error handling (#124277) 2024-08-20 10:33:02 +02:00
mvn23
e81aa1cdb2 Update opentherm_gw.binary_sensor to use entity_description (#121969)
* Update opentherm_gw.binary_sensor to use entity_description

* Move binary_sensor related code to binary_sensor.py
Move common entity code to entity.py

* Remove unused logger from binary_sensor.py

* Add type hints
Address feedback
2024-08-20 10:20:27 +02:00
Allen Porter
24f0c88123 Bump python-roborock to 2.6.0 (#124268) 2024-08-20 09:51:44 +02:00
Erik Montnemery
b31c6012ae Use HassKey in otbr (#124240) 2024-08-20 08:16:59 +02:00
Ian
d99f1631ca Add Uplink info to UniFi Device tracker attributes (#123032)
Add device uplink mac sensor
2024-08-20 07:57:03 +02:00
IceBotYT
8260264416 Bump nice-go to 0.3.0 (#124262) 2024-08-19 22:38:10 -07:00
Yuxin Wang
097162eceb Add handling for RoborockTooFrequentCodeRequests for roborock integration (#123759)
* Add handling for RoborockTooFrequentCodeRequests

* Add tests for coverage
2024-08-19 21:09:01 -07:00
J. Nick Koston
d8cbb3540f Bump aioshelly to 11.2.4 (#124080) 2024-08-19 19:13:35 -05:00
J. Nick Koston
0f90a3cf60 Bump aiohttp to 3.10.5 (#124254) 2024-08-19 15:40:32 -05:00
J. Nick Koston
108a54a4a8 Handle WebSocket client disconnect during prepare (#124173) 2024-08-19 15:28:05 -05:00
IceBotYT
fc767ee562 Add event platform to Nice G.O. (#124253)
* Add event platform to Nice G.O.

* Add icon for barrier obstructed event

* Better assertions

* More test improvements
2024-08-19 22:09:22 +02:00
Sid
566c00ef12 Skip interfaces without mac in enigma2 device_info (#124249) 2024-08-19 22:05:43 +02:00
Artur Pragacz
407e4f6ca2 Add entity matching to intent_script (#120973) 2024-08-19 15:01:35 -05:00
Andrii Mitnovych
254aa8c9ea Add entity deduplication by assist device ID in conversation agent (#123957)
* Add entities deduplication by assist device ID in default conversation agent

* Updated test.
2024-08-19 15:00:23 -05:00
epenet
b4afca3e7e Add missing hass type hint in component tests (r) (#124231) 2024-08-19 21:38:41 +02:00
IceBotYT
20f7af25e9 Add switch platform to Nice G.O. (#124237)
* Add switch platform to Nice G.O.

* Replace cover with switch in switch.py

* Use  icon translations

* Fix tests

* Use constants in test_switch.py

* Use ATTR_ENTITY_ID
2024-08-19 21:25:11 +02:00
Erik Montnemery
69652ca2ca Use PEP 695 for decorator typing with type aliases in esphome (#124234) 2024-08-19 14:13:48 -05:00
IceBotYT
89728f41e1 Bump nice-go to 0.2.1 (#124238)
* Bump nice-go to 0.2.0

* Bump nice-go to 0.2.1
2024-08-19 20:45:25 +02:00
Sid
9283d766d3 Bump ruff to 0.6.1 (#124250)
* Bump ruff to 0.6.0

* Bump ruff to 0.6.1
2024-08-19 20:43:50 +02:00
Joost Lekkerkerker
bcd92b43ce Bump aiowithings to 3.0.3 (#124154) 2024-08-19 20:40:23 +02:00
Christopher Fenner
de82f21446 Use library fork for ViCare integration (#124107)
* switch dependency to fork

* Update manifest.json

* Update requirements_all.txt

* Update requirements_test_all.txt
2024-08-19 20:14:33 +02:00
Marlon
984a534300 Bump apsystems-ez1 to 2.2.1 (#124243)
* Update apsystems library

* Bump apsystems library to 2.2.1
2024-08-19 19:44:28 +02:00
Erik Montnemery
50f3c891fa Prepare otbr.silabs_multiprotocol for multiple config entries (#124219)
* Prepare otbr.silabs_multiprotocol for multiple config entries

* Simplify
2024-08-19 17:30:48 +02:00
Marlon
e3ab30a2a5 Add support for whole apsystems ez1 series (#123356)
* Add support for whole apsystems ez1 series by configuring the max_output at setup to match the value by the inverter

* Check Max output for apsystems on startup, not setup

* Move max output check into coordinator

* Raise UpdateFailed on error in apsystems
2024-08-19 16:57:43 +02:00
Erik Montnemery
f2d41bd99c Minor improvements of otbr tests (#124224) 2024-08-19 16:29:34 +02:00
epenet
b53ae884a6 Add missing hass type hint in component tests (o) (#124226) 2024-08-19 16:16:34 +02:00
Marlon
f4997e46fb Bump apsystems-ez1 to 2.1.0 (#123225)
Library update for apsystems fixing breaking changes
2024-08-19 16:15:27 +02:00
Erik Montnemery
110ee9ff35 Strip trailing / from OTBR url (#124223) 2024-08-19 16:06:20 +02:00
epenet
c76d68503a Add missing hass type hint in history and recorder tests (#124204) 2024-08-19 15:41:09 +02:00
epenet
5470d14a11 Add missing hass type hint in component tests (m) (#124222) 2024-08-19 15:36:37 +02:00
epenet
02139fcca6 Add missing hass type hint in component tests (l) (#124220) 2024-08-19 15:36:23 +02:00
cnico
16e52f0427 Allow manually updating entity state in chacon dio (#124187)
* Addition of a reload service to manually retrieve the status of the devices.

* Removal of reload_state service replaced by the homeassistant.update_entity supported service

* remove api update to v1.2.1 for another PR

* Review corrections

* Review corrections
2024-08-19 14:05:12 +02:00
Erik Montnemery
96edaebdd3 Remove unused function otbr.async_get_active_dataset_tlvs (#124210) 2024-08-19 13:15:50 +02:00
cnico
8907b7e911 Bump dio-chacon-wifi-api to 1.2.1 (#124215)
* chacon_dio api version to 1.2.1

* corrected CI for PR
2024-08-19 12:58:00 +02:00
Philip Vanloo
fd0f093e10 Bump python-linkplay to 0.0.8 (#123875)
* Bump python-linkplay to 0.0.7

* Bump python-linkplay to 0.0.8
2024-08-19 12:45:11 +02:00
Erik Montnemery
e88007af2d Improve suggested values in homeworks config flow (#124200) 2024-08-19 12:41:47 +02:00
epenet
a24fdd1c2b Add missing hass type hint in component tests (h) (#124209)
* Add missing hass type hint in component tests (h)

* Fix import
2024-08-19 12:40:56 +02:00
epenet
f0af33bd2b Add missing hass type hint in component tests (i) (#124216) 2024-08-19 12:40:17 +02:00
Shai Ungar
057f31132b Bump pyseventeentrack to 1.0.1 (#124211) 2024-08-19 12:02:34 +02:00
epenet
197e65c3a9 Improve type hints in homematicip_cloud tests (#124207)
Add missing hass type hint in homematicip_cloud tests
2024-08-19 11:06:50 +02:00
Antoine Reversat
d9aa931fac Add reauth to fujitsu_fglair (#124166)
* Add reauth to fujitsu_fglair

* Add test for reauth when an exception occurs.

* Address comments

* Always assert

* Address comments
2024-08-19 11:04:34 +02:00
Joost Lekkerkerker
2577fb804b Add sonos snapshot test (#124036) 2024-08-19 11:00:33 +02:00
Erik Montnemery
bab930a456 Fix flapping ista_ecotrend tests (#124205) 2024-08-19 10:37:17 +02:00
Erik Montnemery
511ec4ba8a Remove test helper get_test_home_assistant (#124177) 2024-08-19 10:23:25 +02:00
IceBotYT
013b91394e Add diagnostics to Nice G.O. (#124194) 2024-08-19 10:22:36 +02:00
Erik Montnemery
d9c98316fd Bump pyhomeworks to 1.1.2 (#124199) 2024-08-19 10:20:58 +02:00
Erik Montnemery
88d79d35eb Simplify bring todo service schema (#124206) 2024-08-19 10:18:09 +02:00
epenet
25d33e96cc Add missing hass type hint in component tests (g) (#124203) 2024-08-19 00:29:26 -07:00
tdfountain
1fdcbc3f15 Fix comment typo for _serial_from_status() in NUT (#124175)
Fix comment typo for _serial_from_status()
2024-08-18 22:14:54 +01:00
G Johansson
05aeb3fbd1 Bump yalesmartalarmclient to 0.4.0 (#124165)
* Bump yalesmartalarmclient to 0.4.0

* Fix various
2024-08-18 22:41:45 +02:00
G Johansson
50f9c1e5a4 Fix Pure AQI value sensor in Sensibo (#124151)
* fix Pure AQI value sensor in Sensibo

* Fix tests

* Make enum
2024-08-18 22:41:31 +02:00
Dylan Corrales
02b26ac4e6 Add state for alarm_control_panel in Prometheus (#123753)
* Prometheus: Add state for alarm_control_panel

* Prometheus: Add pytest for alarm_control_panel
2024-08-18 22:11:37 +02:00
G Johansson
11d2258afc Improve code quality in Manual alarm (#123142)
* Improve code quality in Manual alarm

* Review

* Remove helper

* Remove unique id

* Reset demo and fix unique id

* next_state variable

* Fixes

* Is helper

* Fix unique id

* exception message

* Fix mypy
2024-08-18 21:31:44 +02:00
J. Nick Koston
14c2ca85ec Refactor websocket handler to reduce complexity (#124174) 2024-08-18 14:17:17 -05:00
ilan
1010edf4bd Add reconfigure flow to Madvr (#122477)
* feat: add reconfigure

* feat: add reconfigure step

* fix: don't abort unique on reconfigure

* fix: add success string

* fix: improve reconfigure

* fix: entry will never be none

* fix: update ip in abort

* fix: check unique id on reconfigure

* feat: add test in case of new device

* fix: fail reconfigure if mac changes

* fix: abort instead of form

* feat: use is, dont mock config flow

* fix: implement comments
2024-08-18 21:17:10 +02:00
Erik Montnemery
9e8260736b Fix schema for input_datetime.set_datetime action (#124108) 2024-08-18 21:14:57 +02:00
Erik Montnemery
06d1bbc20f Update recorder tests to async (#124161) 2024-08-18 21:14:41 +02:00
epenet
135ebaafa0 Add missing hass type hint in august tests (#124062) 2024-08-18 13:21:38 -05:00
Erik Montnemery
ce2ffde22e Update sensor recorder tests to async (#124061) 2024-08-18 13:20:58 -05:00
G Johansson
7d5ddbf51c Bump python-holidays to 0.54 (#124170) 2024-08-18 20:05:41 +02:00
Ryan Mattson
df58068e84 Update aiolyric to 2.0.1 (#123424)
update aiolyric to 2.0.1
2024-08-18 20:05:30 +02:00
epenet
7d326ff076 Add missing hass type hint in component tests (d) (#124074) 2024-08-18 18:57:29 +02:00
Shay Levy
49c59339d9 Shelly RPC - do not stop BLE scanner if a sleeping device (#124147) 2024-08-18 18:35:02 +03:00
John Hollowell
4ab3f1f41f Add Venstar air filter sensors (#115832)
* Add sensors for HVAC filter usage

The number of hours and the number of days are not linked.
The number of hours is a sum of the hours the filter has been in use (fan running). The days is just the number of days since the filter was reset.

* Update filter sensors' names

* Split consumables entity descriptions and move names to translations

* Scale filterHours to match real-world time

It looks like the integer returned by the thermostat is actually 100 times the number of hours.

* Address review comments/changes
2024-08-18 17:22:44 +02:00
Artur Pragacz
e6c61f207d Rework Onkyo discovery and interview (#120668)
* Rework Onkyo discovery and interview

* Move class outside setup function

* Revert changing default name

* Rename to volume resolution
2024-08-18 17:14:33 +02:00
Lenn
4e7e896601 Disable entities for Motiontionblinds Bluetooth (#124159)
* Set entity_registry_enabled_default to False for RSSI sensor

* Use entity description

* Update homeassistant/components/motionblinds_ble/sensor.py

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

* Update homeassistant/components/motionblinds_ble/sensor.py

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

* Use entity_registry_enabled_by_default fixture for tests

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-08-18 17:14:05 +02:00
IceBotYT
55cf3b60eb Add light platform to Nice G.O. (#124019)
* Add light platform to Nice G.O.

* Update homeassistant/components/nice_go/light.py

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-08-18 15:57:05 +02:00
epenet
1a628588b4 Improve type hints in scripts/auth (#124049) 2024-08-18 15:43:15 +02:00
epenet
ba3872ff87 Add missing hass type in tests/*.py (#124048) 2024-08-18 15:42:41 +02:00
Eric Trudeau
69843e9ac4 Add support for Levoit EverestAir air purifiers (#123428) 2024-08-18 15:42:05 +02:00
J. Nick Koston
a4fb4e76cb Bump aiohttp to 3.10.4 (#124137)
changelog: https://github.com/aio-libs/aiohttp/compare/v3.10.3...v3.10.4
2024-08-18 08:39:56 -05:00
epenet
489ceab4b5 Add missing hass type hint in component tests (b) (#124065) 2024-08-18 15:39:26 +02:00
Antoine Reversat
1afed8ae15 Add Fujitsu FGLair integration (#109335)
* Add support for Fujitsu HVAC devices

* Add the entity code to .coveragerc

* Only include code that can fail in the try/except block

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

* Remove empty keys from manifest

* Remove VERSION as it's already the default

* Remve the get_devices function and use asyncio.gather to parallelize dev updates

* Move initial step to a function

* Let KeyError bubble up. If we are passed an invalid mode it's probably worth raising an exception.

* Await the gather

* Use the async version of the refresh_auth call

* Use the serial number as unique id

* Use HA constant for precision

* Use dev instead of self._dev

* Move to property decorated methods

* Remove bidict dependency

* Setup one config entry for our api credentials instead of per device

* Remove bidict from requirements

* Signout and remove our api object on unload

* Use app credentials from ayla_iot_unofficial

* Use entry_id as a key to store our API object

* Delete unused code

* Create reverse mappings from forward mapping instead of hardcoding them

* Clean up the property methods

* Only import part of config_entries we are using

* Implement suggested changes

* Fix tests to use new API consts

* Add support for reauth

* Use a coordinator instead of doing per-entity refresh

* Auto is equivalent to HEAT_COOL not AUTO

* Add ON and OFF to list of supported features

* Use the mock_setup_entry fixture for the reauth tests

* Parametrize testing of config flow exceptions

* Only wrap fallable code in try/except

* Add tests for coordinator

* Use self.coordinator_context instead of self._dev.device_serial_number

* Move timeout to ayla_iot_unofficial

* Add description for is_europe field

* Bump version of ayla-iot-unofficial

* Remove turn_on/turn_off warning

* Move coordinator creating to __init__

* Add the type of coordinator to the CoordiatorEntity

* Update docstring for FujitsuHVACDevice constructor

* Fix missed self._dev to dev

* Abort instead of showing the form again with an error when usernames are different

* Remove useless argument

* Fix tests

* Implement some suggestions

* Use a device property the maps to the coordinator data

* Fix api sign out when unloading the entry

* Address comments

* Fix device lookup

* Move API sign in to coordinator setup

* Get rid of FujitsuHVACConfigData

* Fix async_setup_entry signature

* Fix mock_ayla_api

* Cleanup common errors

* Add test to check that re adding the same account fails

* Also patch new_ayla_api in __init__.py

* Create a fixture to generate test devices

* Add a setup_integration function that does the setup for a mock config entry

* Rework unit tests for the coordinator

* Fix typos

* Use hass session

* Rework reauth config flow to only modify password

* Update name to be more use-friendly

* Fix wrong type for entry in async_unload_entry

* Let TimeoutError bubble up as teh base class handles it

* Make the mock ayla api return some devices by default

* Move test to test_climate.py

* Move tests to test_init.py

* Remove reauth flow

* Remove useless mock setup

* Make our mock devices look real

* Fix tests

* Rename fujitsu_hvac to fujitsu_fglair and rename the integration to FGLair

* Add the Fujitsu brand

* Add a helper function to generate an entity_id from a device

* Use entity_id to remove hardcoded entity ids

* Add a test to increase code coverage

---------

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Joostlek <joostlek@outlook.com>
2024-08-18 15:37:33 +02:00
cdnninja
10c27c3189 Add Alt Core300s model to vesync integration (#124091) 2024-08-18 15:36:03 +02:00
epenet
975363b660 Add missing hass type hint in component tests (c) (#124067) 2024-08-18 15:35:31 +02:00
epenet
c8797298ea Add missing hass type hint in component tests (e) (#124075) 2024-08-18 15:34:59 +02:00
Duco Sebel
565f271c5c Bumb python-homewizard-energy to 6.3.0 (#124150) 2024-08-18 15:21:04 +02:00
Michael
0c5a3fab22 Cleanup the Fritz!Smarthome light entity (#123488)
* use self.data when ever possible

* use short hand attributes for color mode and supported color modes

* color mode can change during runtime

* group executer jobs
2024-08-18 14:53:35 +02:00
Daniel Rozycki
04b0760e27 Skip NextBus update if integration is still loading (#123564)
* Skip NextBus update if integration is still loading

Fixes a race between the loading thread and
update thread leading to an unrecoverable error

* Use async_at_started

* Use local copy of _route_stops to avoid NextBus race condition

* Update homeassistant/components/nextbus/coordinator.py

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-08-18 14:24:44 +02:00
MarkGodwin
e3287b93a5 Bump tplink-omada-api to 1.4.2 (#124136)
Fix for bad pre-registered clients
2024-08-18 14:23:47 +02:00
epenet
c4fee124b3 Add missing hass type hint in flux tests (#124078) 2024-08-18 13:53:59 +02:00
Maciej Bieniek
ec0012209d Add missing sensors for Shelly Plus RGBW PM (#123589)
* Add missing sensors for Shelly Plus RGBW PM

* Add tests
2024-08-18 12:58:51 +03:00
Michael
59d72bb4ed Use better config validation for integrations with legacy setup method, but only config entry setup (#123203)
use config_entry_only_config_schema over cv.removed

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-08-18 00:49:39 +02:00
J. Nick Koston
3b2893f2f4 Fix blocking I/O while validating core config schema (#124125) 2024-08-17 15:14:28 -05:00
Erik Montnemery
63d1cc10e2 Update homeassistant integration tests to async (#124117) 2024-08-17 12:11:32 -07:00
Allen Porter
d72d4286db Bump nest to 4.0.7 to increase subscriber deadline (#124131)
Bump nest to 4.0.7
2024-08-17 12:11:19 -07:00
Jordi
23fb4b50c9 Add brand selection to support additional brands who use the same API for AquaCell integration (#121817)
* Support harvey brand

* Update tests

* Moved the brand selection step to the same step as credentials

* Update tests/components/aquacell/test_init.py

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-08-17 20:45:24 +02:00
Erik Montnemery
08a76133c2 Simplify water_heater.set_temperature service schema (#124101) 2024-08-17 19:24:35 +02:00
J. Nick Koston
08234efedf Bump aiohomekit to 3.2.3 (#124115) 2024-08-17 10:32:58 -05:00
J. Nick Koston
1bab373707 Revert "Exclude aiohappyeyeballs from license check" (#124116) 2024-08-17 10:10:45 -05:00
Artem Draft
85a47ffb68 Bump pybravia to 0.3.4 (#124113) 2024-08-17 16:30:26 +02:00
Pete Sage
153eef16bb Add Sonos Test for plex media player enqueue options (#124120)
initial commit
2024-08-17 16:29:27 +02:00
Pete Sage
7efd8089c8 Add Sonos test for media_player play, pause, stop, previous, next (#122978)
* initial commit

* update to use constant

* retrigger checks
2024-08-17 13:47:27 +02:00
Erik Montnemery
533442f33e Add async friendly helper for validating config schemas (#123800)
* Add async friendly helper for validating config schemas

* Improve docstrings

* Add tests
2024-08-17 11:01:49 +02:00
Erik Montnemery
a7bca9bcea Use BIGINT SQL type for ID columns (#123973)
Redo recorder ID migration from INT to BIGINT
2024-08-17 11:01:14 +02:00
Erik Montnemery
6c01e4b99c Use BaseEventLoop._thread_id instead of a custom attribute (#124054)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-08-17 10:59:39 +02:00
Erik Montnemery
7deb9bf30f Do not override hass.loop_thread_id in tests (#124053) 2024-08-16 16:59:21 -05:00
Joost Lekkerkerker
1614e2c825 Use constants in Sonos media player tests (#124037) 2024-08-16 16:58:42 -05:00
Maciej Bieniek
69700f068f Migrate back from pysnmp-lextudio to pysnmp (#123579) 2024-08-16 16:57:10 -05:00
J. Nick Koston
91951ed734 Speed up initializing config flows (#124015) 2024-08-16 16:48:03 -05:00
epenet
24680b731f Add missing hass type hint in component tests (f) (#124076) 2024-08-16 21:51:58 +02:00
Kim de Vos
a8a7d01a84 Add temperature sensors for unifi device (#122518)
* Add temperature sensors for device

* Move to single line

* Use right reference

* Always return a value

* Update tests

* Use slugify for id name

* Return default value if not present

* Make _device_temperature return value

* Add default value if temperatures is None

* Set value to go over all code paths

* Add test for no matching temperatures

* make first part deterministic
2024-08-16 21:37:24 +02:00
epenet
9b11aaf1eb Add missing hass type hint in alexa tests (#124064)
* Add missing hass type hint in alexa tests

* One more
2024-08-16 19:00:44 +02:00
dontinelli
8a110abc82 Bump fyta_cli to 0.6.0 (#123816)
* Bump fyta_cli to 0.5.1

* Code adjustments to enable strit typing

* Update homeassistant/components/fyta/__init__.py

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

* Update diagnostics

* Update config_flow + init (ruff)

* Update sensor

* Update coordinator

* Update homeassistant/components/fyta/diagnostics.py

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

* Update homeassistant/components/fyta/diagnostics.py

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

* Update homeassistant/components/fyta/sensor.py

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

* Set one ph sensor to null/none

* Update sensor

* Clean-up (ruff)

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-08-16 17:46:37 +02:00
Erik Montnemery
e07768412a Update ffmpeg tests to async (#124058) 2024-08-16 10:16:56 -05:00
epenet
56b4a7f291 Add missing hass type in tests/helpers (#124039) 2024-08-16 17:09:12 +02:00
epenet
2cd4456762 Add missing hass type hint in component tests (a) (#124059) 2024-08-16 17:07:57 +02:00
Erik Montnemery
115c5d1704 Fix threading in get_test_home_assistant test helper (#124056) 2024-08-16 16:59:33 +02:00
Joost Lekkerkerker
06209dd94c Bump ruff to 0.6.0 (#123985) 2024-08-16 16:54:20 +02:00
J. Nick Koston
c8b0c939e4 Ensure event entities are allowed for linked homekit config via YAML (#123994) 2024-08-16 16:48:59 +02:00
Joost Lekkerkerker
e8d57bf636 Bump aiomealie to 0.8.1 (#124047) 2024-08-16 16:48:33 +02:00
Joost Lekkerkerker
0cb0af496e Re-enable concord232 (#124000) 2024-08-16 16:46:58 +02:00
Mr. Bubbles
ea4443f79e Add statistics import to Ista EcoTrend integration (#118788)
* Add statistics import to Ista EcoTrend integration

* Use decorator for fixtures

* define recorder as after_dependency

* Increase test coverage

* remember initial statistic_id

* fix type checking
2024-08-16 16:12:15 +02:00
J. Nick Koston
cb8a6af12d Add additional blocking operations to loop protection (#124017) 2024-08-16 09:03:24 -05:00
Erik Montnemery
14a3217d7e Improve entity platform tests (#124051) 2024-08-16 15:08:37 +02:00
J. Nick Koston
c717e7a6f6 Bump bluetooth-adapters to 0.19.4 (#124018)
Fixes a call to enumerate USB devices that did blocking
I/O
2024-08-16 07:12:17 -05:00
Erik Montnemery
f1b7847d1c Simplify cv._make_entity_service_schema (#124046) 2024-08-16 14:09:09 +02:00
Erik Montnemery
69943af68a Deduplicate async_register_entity_service (#124045) 2024-08-16 14:06:35 +02:00
Sid
738cc5095d Bump openwebifpy to 4.2.7 (#123995)
* Bump openwebifpy to 4.2.6

* Bump openwebifpy to 4.2.7

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-08-16 13:53:11 +02:00
Joost Lekkerkerker
4cc4ec44b0 Exclude aiohappyeyeballs from license check (#124041) 2024-08-16 13:50:02 +02:00
epenet
0a846cfca8 Add missing hass type in tests/test_util (#124043) 2024-08-16 13:43:43 +02:00
Matthias Alphart
ea52acd7bd Fix loading KNX integration actions when not using YAML (#124027)
* Fix loading KNX integration services when not using YAML

* remove unnecessary comment

* Remove unreachable test
2024-08-16 13:43:02 +02:00
Erik Montnemery
799e95c1bd Do sanity check in EntityComponent.async_register_entity_service schema (#124029)
* Do sanity check in EntityComponent.async_register_entity_service schema

* Improve test
2024-08-16 13:39:25 +02:00
Jan Bouwhuis
183c191d63 Allow raw mqtt payload to be in mqtt publish action (#123900)
* Publish raw rendered mqtt payload as raw for mqtt publish action

* Move check out of try block

* Only try to eval `bytes` is payload starts with supported string

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Improve docst

* Add `evaluate_bytes` option to publish action

* Rename to `evaluate_payload`

* Update homeassistant/components/mqtt/strings.json

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Extend test to assert literal_eval is called or not

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-08-16 13:34:14 +02:00
epenet
f3e2d06922 Add missing hass type in tests/scripts (#124042) 2024-08-16 13:21:39 +02:00
Erik Montnemery
99ab2566c2 Correct water heater service schemas (#124038)
* Correct water heater service schemas

* Update tests
2024-08-16 12:58:05 +02:00
starkillerOG
0093276e93 Reolink add 100% coverage of binary_sensor platfrom (#123862)
* Implement 100% coverage of binary_sensor

* fix styling

* Apply suggestions from code review

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

* use get().state instead of is_state

* Remove unneeded "is True"

* Remove unneeded "is True"

* reset the mock and use assert_not_called

* use freezer

* fix styling

* fix styling

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-08-16 12:46:51 +02:00
WebSpider
461ef33553 Bump meteoalert to 0.3.1 (#123848)
Bump meteoalertapi to 0.3.1
2024-08-16 12:27:20 +02:00
J. Nick Koston
723ea6173e Add Python-2.0.1 license to list of approved licenses (#124020)
https://spdx.org/licenses/Python-2.0.1.html
2024-08-16 12:04:57 +02:00
Pete Sage
1f214bec93 Add Sonos tests for media_player shuffle and repeat (#122816)
* initial commit

* initial commit

* update comments
2024-08-16 11:49:00 +02:00
Mr. Bubbles
4b62dcfd19 Improve rate limit handling in Habitica integration (#121763)
* Adjustments to requests and update interval due to rate limiting

* Use debounced refresh for to-do lists

* Use debounced refresh in switch and buttons

* Request refresh only if a to-do was changed

* Update task order provisionally in the coordinator
2024-08-16 11:41:04 +02:00
epenet
66a8733333 Add missing return type in test __init__ method (part 4) (#123947) 2024-08-16 10:26:12 +02:00
Erik Montnemery
f9ade788eb Do sanity check EntityPlatform.async_register_entity_service schema (#123058)
* Do a sanity check of schema passed to EntityPlatform.async_register_entity_service

* Only attempt to check schema of Schema

* Handle All/Any wrapped in schema

* Clarify comment

* Apply suggestions from code review

Co-authored-by: Robert Resch <robert@resch.dev>

---------

Co-authored-by: Robert Resch <robert@resch.dev>
2024-08-16 10:01:12 +02:00
Andre Lengwenus
6d9764185b Bump pypck to 0.7.21 (#124023) 2024-08-16 09:22:00 +02:00
Robert Svensson
a944541c58 Bump aiounifi to v80 (#124004) 2024-08-15 21:36:06 -05:00
Brett Adams
2f8766a9ec Fix rear trunk logic in Tessie (#124011)
Allow open to be anything not zero
2024-08-15 23:52:18 +02:00
Robert Svensson
37328c78c1 Use snapshot in UniFi switch tests (#122871)
* Use snapshot in UniFi switch tests

* Fix review comment
2024-08-15 21:29:32 +02:00
Austin Mroczek
142469be95 TotalConnect state attribute deprecation warning (#122320)
* add warning comment

* make comments smaller and put at top

* Update homeassistant/components/totalconnect/alarm_control_panel.py

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-08-15 20:25:56 +02:00
Mr. Bubbles
7d552b64f7 Use clearCompletedTodos API endpoint for deleting Habitica todos (#121877)
Use clearCompletedTodos endpoint for deleting multiple completed todo items
2024-08-15 20:06:23 +02:00
Noah Husby
65fa4a34ed Add configuration url to russound device (#124001)
feat: add configuration url
2024-08-15 20:05:28 +02:00
dougiteixeira
f581066747 Add config flow for platform number in Template (#121849)
* Add config flow to select platform in Template

* Remove device id duplicate in schema

* Add config flow for number platform in Template

* Remove mode
2024-08-15 20:02:51 +02:00
Noah Husby
29c0a7f324 Bump aiorussound to 2.3.2 (#123997) 2024-08-15 19:23:35 +02:00
Mr. Bubbles
bf9d621939 Revert "Rename sensor to finished downloads in pyLoad integration" (#121483)
Revert "Rename sensor to finished downloads in pyLoad integration (#120483)"

This reverts commit 8e598ec3ff.
2024-08-15 19:09:21 +02:00
Erik Montnemery
64a68b17f4 Simplify recorder.migration._drop_foreign_key_constraints (#123968) 2024-08-15 11:58:52 -05:00
IceBotYT
46357519e0 Add Nice G.O. integration (#122748)
* Convert Linear Garage Door to Nice G.O.

* Remove useless fixtures

* Update manifest (now cloud push! 🎉)

* Fix entry unload

* Extend config entry type

* Fix circular import

* Bump nice-go (hopefully fix dep conflict)

* Bump nice-go (moves type stubs to dev deps)

* Remove lingering mentions of Linear

* Add nice-go as logger

* Convert nice_go into a new integration and restore linear_garage_door

* Add missing new lines to snapshots

* Fixes suggested by @joostlek

* More fixes

* Fixes

* Fixes

* Fix coordinator tests

* Move coordinator tests

* Move test_no_connection_state from test_cover to test_init

---------

Co-authored-by: Joostlek <joostlek@outlook.com>
2024-08-15 18:46:06 +02:00
G Johansson
24a20c75eb Add options flow to File (#120269)
* Add options flow to File

* Review comments
2024-08-15 18:21:07 +02:00
Michael
e39bfeac08 Allow shared Synology DSM Photo albums shown in media browser (#123613) 2024-08-15 18:18:05 +02:00
Joost Lekkerkerker
874ae15d6a Fix motionblinds ble test (#123990)
* Fix motionblinds ble test

* Fix motionblinds ble test
2024-08-15 18:16:49 +02:00
Glenn Waters
a50aeb0a66 Environment Canada weather format fix (#123960)
* Add missing isoformat.

* Move fixture loading to common conftest.py

* Add deepcopy.
2024-08-15 16:14:01 +02:00
Philip Vanloo
983806817b Add ArtSound as a virtual integration (#122636)
* Add ArtSound as a virtual integration and brand

* Remove ArtSound as brand

* Add docstring for __init__

* Address hassfest
2024-08-15 15:48:02 +02:00
cnico
21c9cd1caa Add switch platform to chacon_dio integration (#122514)
* Adding switch platform for dio devices

* Remove useless logger

* Review corrections

* review corrections
2024-08-15 15:44:49 +02:00
Lenn
c674a25eba Add Motionblinds Bluetooth full test coverage (#121878)
* Add tests

* Fix entity test

* Format

* Fix sensor tests

* Fix sensor tests

* Fix sensor tests

* Add init tests

* Change service info

* Rename test_sensor parameters

* Removce ConfigEntryState.LOADED assertion

* Remove platforms parameter from setup_platform

* Rename setup_platform to setup_integration

* Fixture for blind_type and mock_config_entry

* Use mock for MotionDevice

* Use mock for MotionDevice

* Add type hint

* Use Mock instead of patch

* Use mock_config_entry fixture

* Move constants to init

* Fix entity_id name

* Use fixture

* Use fixtures instead of constants

* Use display_name fixture

* Rename mac to mac_code

* Remove one patch

* Use fixtures for mock_config_entry

* Apply suggestion

* Replace patch with mock

* Replace patch with mock

* Replace patch with mock

* Fix

* Use pytest.mark.usefixtures if parameter not used

* Base mac code on address

* Remove if statement from entity test

---------

Co-authored-by: Joostlek <joostlek@outlook.com>
2024-08-15 15:39:47 +02:00
Erik Montnemery
f72d9a2c02 Raise on database error in recorder.migration._modify_columns (#123642)
* Raise on database error in recorder.migration._modify_columns

* Improve test coverage
2024-08-15 14:46:23 +02:00
Erik Montnemery
ab163c356f Bump pyhomeworks to 1.1.1 (#123981) 2024-08-15 12:39:01 +02:00
Brett Adams
b3399082a8 Gold quality for Tesla Fleet (#122235)
gold quality
2024-08-15 11:33:31 +02:00
Erik Montnemery
26e80cec3d Deduplicate some recorder migration tests (#123972) 2024-08-15 11:09:24 +02:00
Michael Hansen
f2d39feec0 Adjust VAD seconds better for microVAD (#123942) 2024-08-15 11:08:40 +02:00
Brett Adams
9b78ae5908 Handle InvalidRegion in Tesla Fleet (#123958) 2024-08-15 11:00:07 +02:00
Erik Montnemery
72e235ad9f Improve some comments in recorder migration code (#123969) 2024-08-15 10:56:56 +02:00
Erik Montnemery
629b919707 Remove unnecessary assignment of Template.hass from knx (#123977) 2024-08-15 10:56:04 +02:00
Matthias Alphart
d6d016e029 Fix KNX UI Light color temperature DPT (#123778) 2024-08-15 10:52:55 +02:00
Erik Montnemery
81c4bb5f72 Fix flaky recorder migration tests (#123971) 2024-08-15 10:32:40 +02:00
Erik Montnemery
5836f8edb5 Pass None instead of empty dict when registering entity services (#123879)
* Pass None instead of empty dict when registering entity services

* Update rainmachine
2024-08-15 10:11:43 +02:00
Phill (pssc)
2c3d97d373 Handle Yamaha ValueError (#123547)
* fix yamaha remove info logging

* ruff

* fix yamnaha supress rxv.find UnicodeDecodeError

* fix formatting

* make more realistic

* make more realistic and use parms

* add value error after more feedback

* ruff format

* Update homeassistant/components/yamaha/media_player.py

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

* remove unused method

* add more debugging

* Increase discovery timeout add more debug allow config to overrite dicovery for name

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-08-15 10:03:03 +02:00
Brett Adams
dde1ecbf5b Improve code quality of Tesla Fleet tests (#123959) 2024-08-15 09:59:08 +02:00
dependabot[bot]
ac30efb5ac Bump home-assistant/builder from 2024.03.5 to 2024.08.1 (#123967)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-15 09:31:42 +02:00
dependabot[bot]
1f684330e0 Bump github/codeql-action from 3.26.0 to 3.26.2 (#123966)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-15 09:18:20 +02:00
Matthias Alphart
b042ebe4ff Rename KNX Climate preset modes according to specification (#123964)
* Rename KNX Climate preset modes according to specification

* change icon for "standby"
2024-08-15 08:37:10 +02:00
Thomas55555
9911aa4ede Enable confirm error button in Husqvarna Automower by default (#123927) 2024-08-15 08:29:06 +02:00
Erik Montnemery
667414a457 Raise on database error in recorder.migration._drop_foreign_key_constraints (#123645)
* Raise on database error in recorder.migration._drop_foreign_key_constraints

* Fix test

* Fix test

* Revert "Fix test"

This reverts commit 940b8cb506e912826d43d09d7697c10888bdf685.

* Update test

* Improve test coverage

* Disable test for SQLite
2024-08-15 08:25:18 +02:00
Lars
e6b3d35cdf Remove unnecessary check in fritz light (#123829)
* Remove unnecessary check in fritz light

* Revert remove SUPPORTED_COLOR_MODES
2024-08-14 22:53:29 +02:00
Erik Montnemery
e6ed3c8c5c Raise on database error in recorder.migration function (#123644)
* Raise on database error in recorder.migration._update_states_table_with_foreign_key_options

* Improve test coverage

* Fix test

* Fix test
2024-08-14 22:37:23 +02:00
ilan
392f64d33e Fix Madvr sensor values on startup (#122479)
* fix: add startup values

* fix: update snap

* fix: use native value to show None
2024-08-14 22:06:57 +02:00
Jan Bouwhuis
aee1be1e64 Use elif in alexa handlers code to avoid additional checks (#123853) 2024-08-14 21:47:47 +02:00
Andre Lengwenus
58851f0048 Bump pypck to 0.7.20 (#123948) 2024-08-14 21:36:11 +02:00
Erik Montnemery
9c4677a3c6 Add comment clarifying recorder migration to schema version 16 (#123902) 2024-08-14 14:22:06 -05:00
Michael
0790611b93 Fix PI-Hole update entity when no update available (#123930)
show installed version when no update available
2024-08-14 20:39:15 +02:00
J. Nick Koston
9b33d2f17e Fix paste error in homekit climate update (#123943) 2024-08-14 11:00:11 -05:00
epenet
3e967700fd Add missing return type in test __init__ method (part 2) (#123939)
* Add missing return type in test __init__ method (part 2)

* Adjust

* One more

* One more

* More
2024-08-14 17:59:15 +02:00
IceBotYT
3322fa0294 Bump LaCrosse View to 1.0.2, fixes blocking call (#123935) 2024-08-14 10:39:23 -05:00
epenet
178482068d Add missing return type in test __init__ method (part 3) (#123940) 2024-08-14 17:38:30 +02:00
Noah Husby
5e6f8373e1 Set quality scale to silver for Russound RIO (#123937) 2024-08-14 17:22:36 +02:00
J. Nick Koston
5958ef363f Bump pylutron_caseta to 0.21.1 (#123924) 2024-08-14 10:02:44 -05:00
epenet
5608301178 Add missing return type in test __init__ methods (#123932)
* Add missing return type in test __init__ methods

* Adjust
2024-08-14 16:48:52 +02:00
Noah Husby
faacfe3f90 Set available property in russound base entity (#123933)
* Set available property in Russound base entity

* Fix

* Fix
2024-08-14 16:38:40 +02:00
Noah Husby
bb88961968 Bump aiorussound to 2.3.1 (#123929) 2024-08-14 16:10:59 +02:00
starkillerOG
bba298a44d Add favorite position buttons to Motion Blinds (#123489) 2024-08-14 16:08:34 +02:00
epenet
ae6ac31d02 Improve type hints in smarttub tests (#123910) 2024-08-14 16:02:47 +02:00
Robert Resch
c761d75550 Fix blocking I/O of SSLContext.load_default_certs in Ecovacs (#123856) 2024-08-14 15:55:59 +02:00
epenet
e33a7ecefa Improve type hints in websocket_api tests (#123922) 2024-08-14 15:54:00 +02:00
Robert Svensson
04598c6fb1 Use more snapshot in UniFi sensor tests (#122875)
* Use more snapshot in UniFi sensor tests

* Fix comment
2024-08-14 15:45:08 +02:00
epenet
ff4dac8f3a Improve type hints in watttime tests (#123921) 2024-08-14 15:42:53 +02:00
epenet
1227cd8693 Improve type hints in zerproc tests (#123925) 2024-08-14 15:41:15 +02:00
epenet
c65f845329 Improve type hints in wemo tests (#123923)
* Improve type hints in wemo tests

* typo
2024-08-14 15:40:57 +02:00
epenet
e6fc34325d Improve type hints in zha tests (#123926) 2024-08-14 15:39:52 +02:00
J. Nick Koston
17f0d9ce45 Map pre-heating and defrosting hvac actions in homekit (#123907)
closes #123864
2024-08-14 15:36:49 +02:00
epenet
f7e017aa73 Improve type hints in sia tests (#123909) 2024-08-14 15:08:55 +02:00
epenet
3e5d0eb632 Improve type hints in owntracks tests (#123905) 2024-08-14 15:08:10 +02:00
epenet
fa8f86b672 Improve type hints in smartthings tests (#123912) 2024-08-14 15:07:55 +02:00
epenet
2c99bd178c Improve type hints in subaru tests (#123911) 2024-08-14 15:06:33 +02:00
epenet
99b1fc75d3 Improve type hints in traccar tests (#123919) 2024-08-14 15:04:51 +02:00
epenet
78c868c075 Improve type hints in tile tests (#123916) 2024-08-14 15:03:51 +02:00
epenet
1e5762fbf7 Improve type hints in tod tests (#123917) 2024-08-14 15:03:38 +02:00
epenet
7f6bf95aa6 Improve type hints in universal tests (#123920) 2024-08-14 15:02:52 +02:00
epenet
67f761c0e9 Improve type hints in template tests (#123915) 2024-08-14 14:58:16 +02:00
epenet
324b6529e8 Improve type hints in telegram_bot tests (#123914) 2024-08-14 14:56:58 +02:00
epenet
ccde51da85 Improve type hints in tasmota tests (#123913) 2024-08-14 14:56:03 +02:00
J. Nick Koston
f6cb28eb5b Bump aioesphomeapi to 25.1.0 (#123851) 2024-08-14 07:42:20 -05:00
Erik Montnemery
e050d187c4 Clarify SQLite can't drop foreign key constraints (#123898) 2024-08-14 07:04:53 -05:00
Erik Montnemery
ea7e88d000 Pass None instead of empty dict when registering entity services (#123878) 2024-08-14 07:04:29 -05:00
Erik Montnemery
80f5683cd6 Raise on database error in recorder.migration._add_constraint (#123646)
* Raise on database error in recorder.migration._add_constraint

* Fix test
2024-08-14 13:59:06 +02:00
Joost Lekkerkerker
b698dd8f32 Bump pyflic to 2.0.4 (#123895) 2024-08-14 13:49:10 +02:00
Thomas55555
3b1b600606 Bump aioautomower to 2024.8.0 (#123826) 2024-08-14 13:47:49 +02:00
G Johansson
dc2886d9b1 Use coordinator setup method in yale_smart_alarm (#123819) 2024-08-14 13:27:21 +02:00
epenet
1ddc723274 Improve type hints in powerwall tests (#123872) 2024-08-14 13:12:24 +02:00
epenet
d4082aee5a Improve type hints in owntracks tests (#123866) 2024-08-14 13:08:54 +02:00
Álvaro Fernández Rojas
903342b394 Handle timeouts on Airzone DHCP config flow (#123869)
airzone: config_flow: dhcp: catch timeout exception

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-08-14 13:06:52 +02:00
epenet
5f1d7e5566 Improve type hints in purpleair tests (#123874) 2024-08-14 13:05:52 +02:00
epenet
1af6528f4f Improve type hints in prusalink tests (#123873) 2024-08-14 13:05:43 +02:00
epenet
f414f5d77a Improve type hints in person tests (#123871) 2024-08-14 13:00:07 +02:00
epenet
8117532cc7 Improve type hints in rainforest_eagle tests (#123880) 2024-08-14 12:58:49 +02:00
Andrew Jackson
ac223e64f9 Migrate Mastodon unique id (#123877)
* Migrate unique id

* Fix unique id check

* Switch to minor version and other fixes
2024-08-14 12:55:59 +02:00
epenet
d50bac3b3e Improve type hints in rainmachine tests (#123881) 2024-08-14 12:52:09 +02:00
epenet
6626c63bb5 Improve type hints in recollect_waste tests (#123882) 2024-08-14 12:51:52 +02:00
epenet
7fe2f175aa Improve type hints in ridwell tests (#123886) 2024-08-14 12:50:51 +02:00
epenet
13b071fd72 Improve type hints in risco tests (#123887) 2024-08-14 12:50:29 +02:00
epenet
7ff368fe0d Improve type hints in sharkiq tests (#123888) 2024-08-14 12:50:08 +02:00
epenet
f8879a51fe Improve type hints in sma tests (#123889) 2024-08-14 12:49:53 +02:00
epenet
57902fed22 Improve type hints in smart_meter_texas tests (#123890) 2024-08-14 12:49:27 +02:00
epenet
24a8060f43 Improve type hints in sonos tests (#123891) 2024-08-14 12:48:36 +02:00
epenet
165ec62405 Improve type hints in ssdp tests (#123892) 2024-08-14 12:48:10 +02:00
epenet
a712eca70a Improve type hints in stream tests (#123894) 2024-08-14 12:47:38 +02:00
epenet
36f9b69923 Improve type hints in rfxtrx tests (#123885) 2024-08-14 12:33:26 +02:00
kingy444
cd382bcdda Bump pydaikin to 2.13.4 (#123623)
* bump pydaikin to 2.13.3

* bump pydaikin to 2.13.4
2024-08-14 12:31:18 +02:00
epenet
bd509469ab Improve type hints in reolink tests (#123883) 2024-08-14 12:16:38 +02:00
Michael
82c705e188 Fix translation for integration not found repair issue (#123868)
* correct setp id in strings

* add issue_ignored string
2024-08-14 12:09:46 +02:00
Erik Montnemery
e1a0a855d5 Support None schema in EntityComponent.async_register_entity_service (#123867) 2024-08-14 11:44:38 +02:00
Erik Montnemery
7063541733 Support None schema in EntityPlatform.async_register_entity_service (#123064) 2024-08-14 10:46:29 +02:00
Andrew Jackson
5f967fdee2 Correct case of config strings in Mastodon (#123859)
Fix string casing
2024-08-14 10:11:11 +02:00
Erik Montnemery
b7bbc938d3 Drop violating rows before adding foreign constraints in DB schema 44 migration (#123454)
* Drop violating rows before adding foreign constraints

* Don't delete rows with null-references

* Only delete rows when integrityerror is caught

* Move restore of dropped foreign key constraints to a separate migration step

* Use aliases for tables

* Update homeassistant/components/recorder/migration.py

* Update test

* Don't use alias for table we're deleting from, improve test

* Fix MySQL

* Update instead of deleting in case of self references

* Improve log messages

* Batch updates

* Add workaround for unsupported LIMIT in PostgreSQL

* Simplify

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-08-14 09:31:37 +02:00
Noah Husby
29887c2a17 Add base entity to Russound RIO integration (#123842)
* Add base entity to Russound RIO integration

* Set entity back to primary mac addr

* Switch to type shorthand
2024-08-13 23:40:51 +02:00
J. Nick Koston
2b6949f3c7 Bump uiprotect to 6.0.2 (#123808)
changelog: https://github.com/uilibs/uiprotect/compare/v6.0.1...v6.0.2
2024-08-13 16:29:26 -05:00
Michael
4a6e812963 Bump py-synologydsm-api to 2.4.5 (#123815)
bump py-synologydsm-api to 2.4.5
2024-08-13 22:21:48 +02:00
Paarth Shah
f8bc662620 Bump matrix-nio to 0.25.0 (#123832)
Bump matrix-nio to 0.25.0

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-08-13 14:31:59 -05:00
J. Nick Koston
f14d5ba5f2 Bump yalexs to 8.0.2 (#123817) 2024-08-13 14:06:38 -05:00
Joost Lekkerkerker
493859e589 Add update platform to AirGradient (#123534) 2024-08-13 18:44:12 +02:00
epenet
ba54a19d4b Simplify mock_tts_cache_dir_autouse fixture (#123783) 2024-08-13 18:01:06 +02:00
Noah Husby
995ed77849 Add error handling for Russound RIO async calls (#123756)
Add better error handling to Russound RIO
2024-08-13 16:23:13 +02:00
epenet
679baddd3d Improve type hints in openalpr_cloud tests (#123812) 2024-08-13 16:08:36 +02:00
epenet
e8157ed9a2 Improve type hints in otbr tests (#123814) 2024-08-13 16:08:15 +02:00
epenet
4cc3f7211b Improve type hints in openuv tests (#123813) 2024-08-13 16:07:17 +02:00
epenet
135f15fdc3 Improve type hints in openai_conversation tests (#123811) 2024-08-13 16:01:24 +02:00
epenet
04b1d2414d Improve type hints in mobile_app tests (#123793) 2024-08-13 15:19:08 +02:00
epenet
ae74fdf252 Improve type hints in nzbget tests (#123798) 2024-08-13 14:57:24 +02:00
Erik Montnemery
f0247e942e Remove unnecessary assignment of Template.hass from alert (#123766) 2024-08-13 14:31:12 +02:00
J. Nick Koston
2859dde697 Remove unifiprotect deprecate_package_sensor repair (#123807) 2024-08-13 06:56:10 -05:00
epenet
2c4b7c2577 Improve type hints in knx tests (#123787) 2024-08-13 13:32:44 +02:00
Matthias Alphart
b3d1d79a49 Update xknx to 3.1.0 and fix climate read only mode (#123776) 2024-08-13 13:28:37 +02:00
Aidan Timson
71e23e7849 System Bridge package updates (#123657) 2024-08-13 13:15:58 +02:00
epenet
8e0dfbcd13 Improve type hints in modbus tests (#123795) 2024-08-13 13:15:35 +02:00
Louis Christ
30994710e6 Fix status update loop in bluesound integration (#123790)
* Fix retry loop for status update

* Use 'available' instead of _is_online

* Fix tests
2024-08-13 12:55:01 +02:00
epenet
193a7b7360 Improve type hints in dsmr tests (#123785) 2024-08-13 12:18:59 +02:00
epenet
e15ac2fbe0 Improve type hints in elevenlabs tests (#123786) 2024-08-13 12:10:15 +02:00
Erik Montnemery
78f7b3340d Remove unnecessary assignment of Template.hass from event helper (#123777) 2024-08-13 12:09:30 +02:00
epenet
4ceb9b9dbf Improve type hints in anthropic tests (#123784) 2024-08-13 11:59:48 +02:00
epenet
3660c2dbb4 Improve type hints in mailgun tests (#123789) 2024-08-13 11:59:22 +02:00
epenet
2b968dfd9a Improve type hints in mfi tests (#123792) 2024-08-13 11:56:55 +02:00
epenet
5f694d9a84 Improve type hints in mochad tests (#123794) 2024-08-13 11:56:18 +02:00
Erik Montnemery
992de497f2 Remove unnecessary assignment of Template.hass from script helper (#123780) 2024-08-13 11:55:37 +02:00
Erik Montnemery
e9682fe003 Remove unnecessary assignment of Template.hass from xiaomi (#123774) 2024-08-13 11:54:56 +02:00
Erik Montnemery
dc462aa529 Remove unnecessary assignment of Template.hass from template (#123773) 2024-08-13 11:54:36 +02:00
Erik Montnemery
5837450a05 Remove unnecessary assignment of Template.hass from influxdb (#123768) 2024-08-13 11:53:39 +02:00
Erik Montnemery
f97fc8a907 Remove unnecessary assignment of Template.hass from rest (#123772) 2024-08-13 11:53:24 +02:00
Erik Montnemery
314ee9c74c Remove unnecessary assignment of Template.hass from manual_mqtt (#123771) 2024-08-13 11:53:06 +02:00
Erik Montnemery
a6f3e587bc Remove unnecessary assignment of Template.hass from manual (#123770) 2024-08-13 11:52:46 +02:00
Erik Montnemery
6317053cc6 Remove unnecessary assignment of Template.hass from condition helper (#123775) 2024-08-13 11:52:27 +02:00
Erik Montnemery
04570edb3f Remove unnecessary assignment of Template.hass from generic camera (#123767) 2024-08-13 11:00:33 +02:00
Jan Rieger
86322973d0 Migrate GPSD extra state attributes to separate states (#122193)
* Migrate GPSD extra state attributes to separate states

* Use common translations

* Address feedback
2024-08-13 10:37:43 +02:00
Ian
6406065e1f Bump py-nextbusnext to 2.0.4 (#123750) 2024-08-13 08:51:41 +02:00
Michael
a988cd050b Fix error message in html5 (#123749) 2024-08-13 08:50:02 +02:00
Allen Porter
dee06d5777 Bump python-nest-sdm to 4.0.6 (#123762) 2024-08-13 08:47:47 +02:00
Franck Nijhof
7eccb38851 Update wled to 0.20.2 (#123746) 2024-08-12 23:23:34 +02:00
J. Nick Koston
e06e9bb39c Bump pyatv to 0.15.0 (#123674) 2024-08-12 22:41:19 +02:00
J. Nick Koston
831c28e890 Bump yalexs to 6.5.0 (#123739) 2024-08-12 22:40:35 +02:00
David F. Mulcahey
732b4b95db Bump ZHA lib to 0.0.31 (#123743) 2024-08-12 22:38:59 +02:00
G Johansson
52f52394d5 Remove demo mailbox (#123741) 2024-08-12 22:36:36 +02:00
epenet
416d2fb82a Improve type hints in locative tests (#123643) 2024-08-12 21:55:44 +02:00
epenet
b0d1d7bdb2 Improve type hints in lcn tests (#123648) 2024-08-12 21:53:32 +02:00
J. Nick Koston
31dcc6f685 Bump protobuf to 4.25.4 (#123675) 2024-08-12 21:51:45 +02:00
Erik Montnemery
c49a31e0de Remove unnecessary assignment of Template.hass from script variables helper (#123712) 2024-08-12 21:51:24 +02:00
Erik Montnemery
c5e8710889 Remove unnecessary assignment of Template.hass from service helper (#123710) 2024-08-12 21:51:02 +02:00
Erik Montnemery
6caec89793 Remove unnecessary assignment of Template.hass from trigger entity helper (#123709) 2024-08-12 21:50:50 +02:00
Erik Montnemery
5e75c5faff Remove unnecessary assignment of Template.hass from mobile_app (#123702) 2024-08-12 21:50:34 +02:00
Erik Montnemery
6bde80ad65 Remove unnecessary assignment of Template.hass from esphome (#123701) 2024-08-12 21:50:23 +02:00
Erik Montnemery
bf55cc605a Remove unnecessary assignment of Template.hass from velbus (#123696) 2024-08-12 21:50:11 +02:00
Erik Montnemery
9d67956fc8 Remove unnecessary assignment of Template.hass from tensorflow (#123695) 2024-08-12 21:49:58 +02:00
Erik Montnemery
b62f216c53 Remove unnecessary assignment of Template.hass from telnet (#123694) 2024-08-12 21:49:46 +02:00
epenet
3c864322f7 Combine requirements files in CI (#123687) 2024-08-12 21:49:10 +02:00
Noah Husby
7cf5d12ec0 Fix secondary russound controller discovery failure (#123590) 2024-08-12 21:45:05 +02:00
G Johansson
b09c6654ec Replace not needed guard in command_line with type check (#123722) 2024-08-12 21:42:00 +02:00
G Johansson
178cb0659a Guard for no discovery info in command_line (#123717) 2024-08-12 21:35:02 +02:00
Álvaro Fernández Rojas
d1dff95ac8 Update aioairzone to v0.8.2 (#123718) 2024-08-12 21:33:56 +02:00
G Johansson
f46fe7eeb2 Remove deprecated yaml import for velux (#123724) 2024-08-12 21:32:28 +02:00
G Johansson
d8b13c8c02 Remove deprecated yaml import for gpsd (#123725) 2024-08-12 21:31:42 +02:00
G Johansson
05c4b1a6a9 Remove deprecated logi_circle integration (#123727) 2024-08-12 21:31:10 +02:00
Shay Levy
ff0a44cc12 Bump aioswitcher to 4.0.2 (#123734) 2024-08-12 21:28:39 +02:00
G Johansson
a4f0234841 Reduce logging in command_line (#123723) 2024-08-12 13:42:39 -05:00
Jan Bouwhuis
21987a67e7 Cleanup unneeded assignment of hass property on MQTT Template objects (#123706)
* Cleanup unneeded assignment of hass property on MQTT Template objects

* Commented out code and unneeded checks

* Consistent assign hass to Template in mqtt tests

* Remove unused hass attribute

* Missed line
2024-08-12 19:20:21 +02:00
David Knowles
74a09073c2 Bump pyschlage to 2024.8.0 (#123714) 2024-08-12 19:01:07 +02:00
Álvaro Fernández Rojas
138d229fef Update AEMET-OpenData to v0.5.4 (#123716) 2024-08-12 18:59:31 +02:00
Álvaro Fernández Rojas
93eb74d970 Update aioairzone-cloud to v0.6.2 (#123719) 2024-08-12 18:57:34 +02:00
Álvaro Fernández Rojas
b7a0bf152b Update aioqsw to v0.4.1 (#123721) 2024-08-12 18:56:54 +02:00
Erik Montnemery
5fb6c65d23 Remove unnecessary assignment of Template.hass from alexa (#123699) 2024-08-12 17:01:31 +02:00
Cyrill Raccaud
200f04bf21 Fix startup block from Swiss public transport (#123704) 2024-08-12 17:01:06 +02:00
Shay Levy
26a69458b0 Bump aioswitcher to 4.0.1 (#123697) 2024-08-12 16:52:37 +02:00
Cyrill Raccaud
5cb9901134 Cleaner unit tests for Swiss public transport (#123660)
cleaner unit tests
2024-08-12 16:19:36 +02:00
Erik Montnemery
342ba1b599 Remove unnecessary assignment of Template.hass from telegram_bot (#123693) 2024-08-12 16:06:19 +02:00
J. Nick Koston
7985974a58 Bump aiohomekit to 3.2.2 (#123669) 2024-08-12 09:02:23 -05:00
Erik Montnemery
2d41723cfe Remove unnecessary assignment of Template.hass from minio (#123679) 2024-08-12 15:54:35 +02:00
Erik Montnemery
c47fdf7074 Remove unnecessary assignment of Template.hass from intent_script (#123676) 2024-08-12 15:54:20 +02:00
Erik Montnemery
4dadf0ea1b Remove unnecessary assignment of Template.hass from snmp (#123689) 2024-08-12 15:54:06 +02:00
Erik Montnemery
81788790df Remove unnecessary assignment of Template.hass from rss_feed_template (#123683) 2024-08-12 15:53:32 +02:00
Erik Montnemery
268044cd01 Remove unnecessary assignment of Template.hass from notify (#123680) 2024-08-12 15:53:19 +02:00
Erik Montnemery
b04e3dc6fd Remove unnecessary assignment of Template.hass from serial (#123686) 2024-08-12 15:52:41 +02:00
Erik Montnemery
ecd061d46f Remove unnecessary assignment of Template.hass from rest (#123682) 2024-08-12 15:52:03 +02:00
Erik Montnemery
1c9a1c71d3 Remove unnecessary assignment of Template.hass from scrape (#123685) 2024-08-12 15:51:37 +02:00
Erik Montnemery
efa3f228a5 Remove unnecessary assignment of Template.hass from slack (#123688) 2024-08-12 15:51:26 +02:00
Erik Montnemery
533e383d5d Remove unnecessary assignment of Template.hass from sql (#123690) 2024-08-12 15:51:02 +02:00
Erik Montnemery
4639e7d5c7 Remove unnecessary assignment of Template.hass from tcp (#123691) 2024-08-12 08:49:37 -05:00
Erik Montnemery
78b6cdb201 Remove unnecessary assignment of Template.hass from logi_circle (#123678) 2024-08-12 15:39:34 +02:00
Erik Montnemery
11fd1086af Remove unnecessary assignment of Template.hass from logbook (#123677) 2024-08-12 15:39:18 +02:00
Erik Montnemery
5b5b9ac4ef Remove unnecessary assignment of Template.hass from influxdb (#123673) 2024-08-12 14:56:29 +02:00
J. Nick Koston
b20623447e Ensure HomeKit connection is kept alive for devices that timeout too quickly (#123601) 2024-08-12 14:54:57 +02:00
Erik Montnemery
f6e82ae0ba Remove unnecessary assignment of Template.hass from camera (#123663) 2024-08-12 14:54:41 +02:00
Erik Montnemery
82bedb1ab5 Remove unnecessary assignment of Template.hass from dweet (#123667) 2024-08-12 14:54:31 +02:00
Erik Montnemery
33a22ae208 Remove unnecessary assignment of Template.hass from triggers (#123672) 2024-08-12 14:54:03 +02:00
Erik Montnemery
77e9acd864 Remove unnecessary assignment of Template.hass from emulated_kasa (#123670) 2024-08-12 14:53:22 +02:00
Erik Montnemery
b9010e96a0 Remove unnecessary assignment of Template.hass from emoncms (#123668) 2024-08-12 14:52:51 +02:00
Erik Montnemery
27d76f5953 Remove unnecessary assignment of Template.hass from history_stats (#123671) 2024-08-12 14:52:34 +02:00
Robert Resch
64ceb11f8c Remove libcst constraint (#123661) 2024-08-12 14:44:52 +02:00
Erik Montnemery
32d2218ff0 Remove unnecessary assignment of Template.hass from doods (#123666) 2024-08-12 14:31:11 +02:00
Erik Montnemery
ecc308c326 Remove unnecessary assignment of Template.hass from command_line (#123664) 2024-08-12 14:30:48 +02:00
Erik Montnemery
840d9a0923 Remove unnecessary assignment of Template.hass from arest (#123662) 2024-08-12 14:30:35 +02:00
Barry vd. Heuvel
81faf1b582 Add homematicip_cloud service set cooling home (#121943)
* [homematicip_cloud] Add service to set cooling mode

* Create seperate test for cooling

* Rename service to set_home_cooling_mode

* Raise exception when accesspoint not found
2024-08-12 14:01:12 +02:00
epenet
ecf22e4c4f Improve type hints in logbook tests (#123652) 2024-08-12 13:29:38 +02:00
Joost Lekkerkerker
e8d7eb05ae Delete unused snapshots (#123656)
* Delete unused snapshots

* Delete unused snapshots
2024-08-12 13:28:09 +02:00
Robert Resch
8c5748dcc1 Remove regex constraint (#123650) 2024-08-12 13:23:10 +02:00
Cyrill Raccaud
0803ac9b0b Add Swiss public transport fetch connections service (#114671)
* add service to fetch more connections

* improve error messages

* better errors

* wip

* fix service register

* add working tests

* improve tests

* temp availability

* test availability

* remove availability test

* change error type for coordinator update

* fix missed coverage

* convert from entity service to integration service

* cleanup changes

* add more tests for the service
2024-08-12 11:26:42 +02:00
Willem-Jan van Rootselaar
8cfac68317 Bump BSBLan to 0.6.2 (#123594)
* chore: Update bsblan library to version 0.6.1

* add dataclass BSBLANConfig

remove session as bsblan has it's own session

* Update temperature unit handling in BSBLANClimate

* chore: Remove unused constant in bsblan/const.py

* chore: Update python-bsblan library to version 0.6.2

* feat: Add async_get_clientsession to BSBLAN initialization

This commit adds the `async_get_clientsession` function to the initialization of the `BSBLAN` class in both `__init__.py` and `config_flow.py` files. This allows the `BSBLAN` instance to have its own session for making HTTP requests. This change improves the performance and reliability of the BSBLAN integration.
2024-08-12 10:57:51 +02:00
epenet
e64ca7c274 Enable implicit-return (RET503) rule in ruff (#122771) 2024-08-12 10:04:16 +02:00
epenet
0bb8c4832d Enable raise-within-try (TRY301) rule in ruff (#123351) 2024-08-12 09:16:33 +02:00
J. Nick Koston
b15ea58851 Relocate code to get scheduled TimerHandles (#123546) 2024-08-12 09:15:33 +02:00
G Johansson
86df43879c Define Manual alarm as a helper (#123587) 2024-08-12 09:14:48 +02:00
Amit Finkelstein
4527de18d5 Bump pycoolmasternet-async to 0.2.2 (#123634) 2024-08-12 09:13:52 +02:00
G Johansson
bbefe47aeb Add unique id to Manual alarm (#123588) 2024-08-12 09:12:26 +02:00
G Johansson
b19758ff71 Change WoL to be secondary on device info (#123591) 2024-08-12 09:11:44 +02:00
G Johansson
401e36b885 Remove deprecated yaml import from Ecovacs (#123605) 2024-08-12 09:09:51 +02:00
G Johansson
6343a086e4 Remove deprecated process sensor from System monitor (#123616) 2024-08-12 09:08:40 +02:00
Joost Lekkerkerker
5b6bfa9ac8 Remove Spotify scope check (#123545) 2024-08-12 09:04:12 +02:00
Matthias Alphart
e1336a1975 Update knx-frontend to 2024.8.9.225351 (#123557) 2024-08-12 08:55:24 +02:00
G Johansson
ca34bac479 Remove deprecated horn switch in starline (#123608) 2024-08-11 22:38:59 +02:00
G Johansson
4a099ab942 Remove deprecated yaml import from lupusec (#123606) 2024-08-11 22:38:20 +02:00
G Johansson
4daefe0b6e Remove deprecated fan as light in lutron (#123607)
* Remove deprecated fan as light in lutron

* Remove more
2024-08-11 22:37:33 +02:00
Maciej Bieniek
a040f1a9d1 Bump aioshelly to version 11.2.0 (#123602)
Bump aioshelly to version 11.2.0
2024-08-11 20:56:12 +03:00
wittypluck
766733b3b2 Avoid Exception on Glances missing key (#114628)
* Handle case of sensors removed server side

* Update available state on value update

* Set uptime to None if key is missing

* Replace _attr_available by _data_valid
2024-08-11 19:14:43 +02:00
Carlos Gustavo Sarmiento
b392d61391 Update MPD Player to use HOST and PORT to detect duplicate configs (#123410)
* Allow Monetary device_class to accept `Measurement` state_class

* Update MPD Player to use HOST and PORT to detect duplicate configs
2024-08-11 18:50:11 +02:00
Andrew Jackson
be3e720c57 Add diagnostics platform to Mastodon (#123592)
Diagnostics
2024-08-11 14:53:44 +02:00
G Johansson
e93d0dfdfc Use setup method in coordinator for Trafikverket Train (#123138)
* Use setup method in coordinator for Trafikverket Train

* Overwrite types
2024-08-11 14:15:20 +02:00
Pavel Skuratovich
9be8616cc0 Add state_class to starline sensors to generate long-term statistics (#123540)
* starline: Add state_class to sensors to generate long-term statistics

* starline: Add 'errors' unit to 'errors' sensor
2024-08-11 12:54:31 +02:00
J. Nick Koston
7aed35b3f0 Bump aiohttp to 3.10.3 (#123549) 2024-08-10 15:09:18 -05:00
Joakim Plate
f69507527b Make sure diagnostic data is output in deterministic order ZHA (#123551)
Make sure diagnostic data is output in deterministic order

Sets are not ordered, so the tests for this failed sporadically since it is
converted into a list when converted to json.
2024-08-10 20:55:31 +02:00
Joakim Plate
f53da62026 Extend ZHA attribute diagnostic information (#123199)
* Include full attribute representation in in data

* Extend attribute diagnostics for zha
2024-08-10 19:25:21 +02:00
Franck Nijhof
0558c85b5d Revert "Remove ESPHome legacy entity naming" (#123453) 2024-08-10 18:38:20 +02:00
J. Nick Koston
ef2ddbf86d Revert "Bump chacha20poly1305-reuseable to 0.13.2" (#123505) 2024-08-10 18:37:00 +02:00
Joost Lekkerkerker
778194f7a0 Bump AirGradient to 0.8.0 (#123527) 2024-08-10 18:31:17 +02:00
Joost Lekkerkerker
13b12a7657 Clean up codespell words (#123541) 2024-08-10 18:28:01 +02:00
Michael
257742de46 Fix cleanup of old orphan device entries in AVM Fritz!Tools (#123516)
fix cleanup of old orphan device entries
2024-08-10 18:01:15 +02:00
cnico
ace6385f5e Upgrade chacon_dio_api to version 1.2.0 (#123528)
Upgrade api version 1.2.0 with the first user feedback improvement
2024-08-10 17:01:49 +02:00
Evgeny
4f8a6979d9 Bump OpenWeatherMap to 0.1.1 (#120178)
* add owm modes

* fix tests

* fix modes

* remove sensors

* Update homeassistant/components/openweathermap/sensor.py

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

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-08-10 17:01:26 +02:00
Duco Sebel
f02fceed5b Bumb python-homewizard-energy to 6.2.0 (#123514) 2024-08-10 17:01:17 +02:00
David F. Mulcahey
cfd2ca3abb Bump zha lib to 0.0.30 (#123499) 2024-08-10 08:07:08 -04:00
Sid
9b678e474b Bump ruff to 0.5.7 (#123531) 2024-08-10 14:04:27 +02:00
Michael
5f73c73a88 Improve test coverage for Proximity (#123523)
* remove unneccessary type checking

* remove unused method after #123158

* test when tracked zone is removed
2024-08-10 13:21:01 +02:00
Matt Way
5f03589d3e Bump pydaikin to 2.13.2 (#123519) 2024-08-10 13:06:29 +02:00
Willem-Jan van Rootselaar
089d855c47 Bump bsblan to 0.5.19 (#123515)
* bump bsblan lib version

* chore: Update bsblan diagnostics to use to_dict() instead of dict() method
2024-08-10 12:28:48 +02:00
dupondje
750bce2b86 Also migrate dsmr entries for devices with correct serial (#123407)
dsmr: also migrate entries for devices with correct serial

When the dsmr code could not find the serial_nr for the gas meter,
it creates the gas meter device with the entry_id as identifier.

But when there is a correct serial_nr, it will use that as identifier
for the dsmr gas device.

Now the migration code did not take this into account, so migration to
the new name failed since it didn't look for the device with correct
serial_nr.

This commit fixes this and adds a test for this.
2024-08-10 10:40:11 +02:00
Michael
94af95c95b Post merge review for Proximity (#123500)
remove commented code
2024-08-10 01:25:38 +02:00
Brett Adams
ec9944b92a Add missing logger to Tessie (#123413) 2024-08-09 20:33:13 +02:00
J. Nick Koston
2b95a642fc Remove august IPv6 workaround (#123408) 2024-08-09 20:32:11 +02:00
Franck Nijhof
eb1c2f5d9f Update frontend to 20240809.0 (#123485) 2024-08-09 20:30:39 +02:00
Michael
ac28d34ad5 Improve test coverage for AVM Fritz!Smarthome (#122974) 2024-08-09 20:23:00 +02:00
starkillerOG
65f33f58e9 Bump motionblinds to 0.6.24 (#123395) 2024-08-09 20:22:16 +02:00
Louis Christ
86c4ded4cd Fix startup blocked by bluesound integration (#123483) 2024-08-09 19:36:58 +02:00
YogevBokobza
57da71c537 Bump aioswitcher to 4.0.0 (#123260)
* Bump aioswitcher to 4.0.0

* switcher fix version

* swithcer fix test

* switcher fix tests
2024-08-09 20:04:11 +03:00
Jake Martin
8e34a0d3c7 Bump monzopy to 1.3.2 (#123480) 2024-08-09 11:52:07 -05:00
Steve Easley
1ad1a2d51e Bump pyjvcprojector to 1.0.12 to fix blocking call (#123473) 2024-08-09 11:51:50 -05:00
J. Nick Koston
acda7bc5c4 Bump uiprotect to 6.0.1 (#123481) 2024-08-09 11:50:05 -05:00
yangqian
618efdb326 Bump chacha20poly1305-reuseable to 0.13.2 (#123471)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-08-09 11:25:53 -05:00
J. Nick Koston
b445517244 Bump orjson to 3.10.7 (#123465) 2024-08-09 17:34:21 +02:00
J. Nick Koston
6e1978971a Bump PyYAML to 6.0.2 (#123466) 2024-08-09 17:33:48 +02:00
J. Nick Koston
572293fb8b Bump uiprotect to 6.0.0 (#123402) 2024-08-09 17:27:16 +02:00
David Knowles
85cbc2437c Bump pydrawise to 2024.8.0 (#123461) 2024-08-09 17:25:25 +02:00
Franck Nijhof
228db1c063 Support action YAML syntax in old-style notify groups (#123457) 2024-08-09 17:18:42 +02:00
puddly
97410474f5 Bump ZHA library to 0.0.29 (#123464)
* Bump zha to 0.0.29

* Pass the Core timezone to ZHA

* Add a unit test
2024-08-09 10:31:55 -04:00
Andrew Jackson
e6e985af24 Remove type checking of config entry in Mastodon (#123467)
Remove type checking of configentry
2024-08-09 16:28:55 +02:00
Andrew Jackson
aee5d5126f Add sensor platform for Mastodon (#123434)
* Add account sensors

* Sensor icons

* Change sensors to use value_fn

* Add native unit of measurement

* Update native unit of measurement

* Change toots to posts

* Fix sensor icons

* Add device entry type

* Explain conditional naming

* Fixes from review

* Remove unnecessary constructor
2024-08-09 16:02:27 +02:00
Matrix
55eb11055c Bump YoLink API to 0.4.7 (#123441) 2024-08-09 12:21:49 +02:00
Jesse Hills
84d6f5ed07 Remove ESPHome legacy entity naming (#123436)
* Remove ESPHome legacy entity naming

* Update test entity_ids to use sanitized name instead of object_id
2024-08-09 11:43:02 +02:00
Brett Adams
f8e1c2cfd4 Rework OAuth in Tesla Fleet (#123324)
* Rework Oauth

* Improve docstrings

* Update homeassistant/components/tesla_fleet/oauth.py

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

* review feedback

* Add tests for user creds

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-08-09 08:38:12 +02:00
J. Nick Koston
00c1a3fd4e Ensure legacy event foreign key is removed from the states table when a previous rebuild failed (#123388)
* Ensure legacy event foreign key is removed from the states table

If the system ran out of disk space removing the FK, it would
fail. #121938 fixed that to try again, however that PR was made
ineffective by #122069 since it will never reach the check.

To solve this, the migration version is incremented to 2, and
the migration is no longer marked as done unless the rebuild
/fk removal is successful.

* fix logic for mysql

* fix test

* asserts

* coverage

* coverage

* narrow test

* fixes

* split tests

* should have skipped

* fixture must be used
2024-08-09 06:19:12 +02:00
J. Nick Koston
03ba8f6173 Bump aiohttp to 3.10.2 (#123394) 2024-08-08 17:07:22 -05:00
J. Nick Koston
69740e865c Reduce number of aiohttp.TCPConnector cleanup_closed checks to one per minute (#123268) 2024-08-08 15:52:09 -05:00
starkillerOG
2343f5e40f Reolink Chime online status and ability to remove (#123301)
* Add chime available

* allow removing a Reolink chime

* Allow removal if doorbell itself removed

* fix tests

* Add tests

* fix styling
2024-08-08 19:28:46 +02:00
Álvaro Fernández Rojas
634a2b22dc Improve Airzone Cloud sensors availability (#123383)
airzone_cloud: improve sensors availability

Make sensor entities unavailable instead of providing an unknown state.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-08-08 19:23:52 +02:00
epenet
b498c89860 Fix raise-within-try in language util (#123354) 2024-08-08 18:51:19 +02:00
epenet
ddc94030a6 Fix raise-within-try in config validation helper (#123353) 2024-08-08 18:50:49 +02:00
fustom
c2f2a868c4 Fix limit and order property for transmission integration (#123305) 2024-08-08 18:49:47 +02:00
Erik Montnemery
60117ae150 Revert "Fix blocking I/O while validating config schema" (#123377) 2024-08-08 17:30:39 +02:00
epenet
a406068f13 Fix implicit-return in homematic (#122922) 2024-08-08 16:32:46 +02:00
Tom Brien
baceb2a92a Add support for v3 Coinbase API (#116345)
* Add support for v3 Coinbase API

* Add deps

* Move tests
2024-08-08 12:26:03 +02:00
Sid
d08f4fbace Enable Ruff RET501 (#115031)
* Enable Ruff RET501

* add noqa and type hints

* use Any for fixtures

* Review comments, typing fixes

* Review comments

* fix new occurrences, clean up

* Fix typing

* clean up rebase

* more cleanup

* Remove old occurrences

---------

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2024-08-08 11:56:18 +02:00
epenet
02a404081a Fix implicit-return in yeelight (#122943) 2024-08-08 11:33:49 +02:00
Franck Nijhof
8a8fac46e0 Remove unneeded logs from Yamaha (#123349) 2024-08-08 11:32:22 +02:00
dependabot[bot]
984bbf60ef Bump sigstore/cosign-installer from 3.5.0 to 3.6.0 (#123335)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-08 10:25:32 +02:00
epenet
b7f5236a0a Fix implicit-return in konnected (#122915)
* Fix implicit-return in konnected

* Adjust

* Adjust

* Adjust tests
2024-08-08 10:09:36 +02:00
Franck Nijhof
6a89080ce7 Merge branch 'master' into dev 2024-08-08 09:12:16 +02:00
Joost Lekkerkerker
7dea5d2fe6 Refactor spc tests (#123287) 2024-08-08 08:59:30 +02:00
J. Nick Koston
135c80186f Fix doorbird with externally added events (#123313) 2024-08-08 08:56:40 +02:00
Noah Husby
2144a9a7b2 Bump aiorussound to 2.2.2 (#123319) 2024-08-08 08:56:02 +02:00
Michael Hansen
f8fa6e4309 Bump intents to 2024.8.7 (#123295) 2024-08-07 10:42:59 -05:00
Stefan Agner
f1029596d2 Drop Matter Microwave Oven Mode select entity (#123294) 2024-08-07 16:45:46 +02:00
ashalita
4cd3fce555 Revert "Upgrade pycoolmasternet-async to 0.2.0" (#123286) 2024-08-07 14:19:05 +02:00
Franck Nijhof
9717a867a7 Update wled to 0.20.1 (#123283) 2024-08-07 13:12:29 +02:00
Brett Adams
764166342e Add missing application credential to Tesla Fleet (#123271)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2024-08-07 13:11:03 +02:00
Paulus Schoutsen
45ce0fed0a Reload config entry for anthropic on update (#123280)
* Reload config entry for anthropic on update

* Fix tests
2024-08-07 12:22:50 +02:00
lunmay
799888df2f Fix typo on one of islamic_prayer_times calculation_method option (#123281) 2024-08-07 11:20:36 +02:00
Paulus Schoutsen
933fba84a9 Reload conversation entries on update (#123279) 2024-08-07 11:18:48 +02:00
Erwin Douna
cba6273ac6 Tado change repair issue (#123256) 2024-08-07 11:18:09 +02:00
Jesse Hills
bf28419851 Update ESPHome voice assistant pipeline log warning (#123269) 2024-08-07 10:17:01 +02:00
tronikos
27b9965b10 Fix Google Cloud TTS not respecting config values (#123275) 2024-08-07 10:16:07 +02:00
Terence Honles
be7f3ca439 remove unneeded type attributes on WebsocketNotification (#123238) 2024-08-07 10:10:18 +02:00
J. Nick Koston
185b6e5908 Allow non-admins to subscribe to newer registry update events (#123267) 2024-08-07 09:13:23 +02:00
Matthias Alphart
7ec0b8b331 Update knx-frontend to 2024.8.6.211307 (#123261) 2024-08-07 09:12:20 +02:00
dependabot[bot]
95f92ababf Bump actions/upload-artifact from 4.3.5 to 4.3.6 (#123272)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-07 09:05:23 +02:00
dependabot[bot]
89337091b2 Bump github/codeql-action from 3.25.15 to 3.26.0 (#123273)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-07 09:04:48 +02:00
puddly
78154f5daf Bump ZHA to 0.0.28 (#123259)
* Bump ZHA to 0.0.28

* Drop redundant radio schema conversion
2024-08-06 21:46:25 -04:00
starkillerOG
f4db9e09c8 Bump reolink-aio to 0.9.7 (#123263) 2024-08-07 00:16:57 +02:00
Franck Nijhof
abaac519c9 Update frontend to 20240806.1 (#123252) 2024-08-06 17:54:40 +02:00
Joost Lekkerkerker
f9f3c7fb51 Bump mficlient to 0.5.0 (#123250) 2024-08-06 16:28:37 +02:00
Yehazkel
2000db57c8 Fix Tami4 device name is None (#123156)
Co-authored-by: Robert Resch <robert@resch.dev>
2024-08-06 16:21:34 +02:00
Steve Repsher
9414e6d472 Adapt static resource handler to aiohttp 3.10 (#123166) 2024-08-06 09:17:54 -05:00
Robert Resch
4627a565d3 Bump deebot-client to 8.3.0 (#123249) 2024-08-06 16:16:22 +02:00
Franck Nijhof
c612cf95a8 Mark FFmpeg integration as system type (#123241) 2024-08-06 16:04:29 +02:00
J. Nick Koston
1eaaa00687 Detect blocking ssl context creation in the event loop (#123240) 2024-08-06 16:00:37 +02:00
J. Nick Koston
fe4e6f24f5 Fix sense doing blocking I/O in the event loop (#123247) 2024-08-06 15:32:58 +02:00
Franck Nijhof
f94bf51bb5 Remove myself from DSMR codeowners (#123243) 2024-08-06 14:55:37 +02:00
Robert Resch
260642345d Delete mobile_app cloudhook if not logged into the cloud (#123234) 2024-08-06 14:55:14 +02:00
Joost Lekkerkerker
7cb94e6392 Bump uvcclient to 0.12.1 (#123237) 2024-08-06 14:01:48 +02:00
Franck Nijhof
9d2c2d90c8 Mark Google Assistant integration as system type (#123233) 2024-08-06 13:20:32 +02:00
Franck Nijhof
d24a87145d Mark Alexa integration as system type (#123232) 2024-08-06 13:18:22 +02:00
Franck Nijhof
bc380859e8 Update frontend to 20240806.0 (#123230) 2024-08-06 12:48:15 +02:00
Petro31
1fc6ce3acd Fix yamaha legacy receivers (#122985) 2024-08-06 12:35:47 +02:00
Joost Lekkerkerker
78d1cd79af Bump yt-dlp to 2023.08.06 (#123229) 2024-08-06 12:22:14 +02:00
Guy Lowe
a2dd017229 Add unit tests for SNMP integer Switches (#123094)
* Add unit tests for SNMP Switches (integer only)

* Add unit test for SNMP switches (integer unknown)

* log a warning when SNMP response is not a recognised payload

* Use a single configuration for all test_integer_switch tests

* Tweak unknown SNMP response warning

* Apply suggestions from code review

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

* import STATE_ consts

* rename tests/components/snmp/test_integer_switch.py to test_switch.py

* check that a warning is logged if the SNMP response payload is unknown

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-08-06 11:56:39 +02:00
Matthias Alphart
86d8c3b31a Update knx-frontend to 2024.8.6.85349 (#123226) 2024-08-06 11:51:04 +02:00
flopp999
bc02925630 Fix growatt server tlx battery api key (#123191) 2024-08-06 10:21:48 +02:00
dontinelli
b9251e94a9 Bump solarlog_cli to v0.1.6 (#123218)
bump solarlog_cli to v0.1.6
2024-08-06 10:15:48 +02:00
Michael
0d4ca35784 Remove unused async_setup method in insteon (#123201) 2024-08-06 10:13:12 +02:00
Jesse Hills
164cfa85da Add support for ESPHome update entities to be checked on demand (#123161) 2024-08-06 10:12:31 +02:00
Jesse Hills
21da79a249 Show project version as sw_version in ESPHome (#123183) 2024-08-06 10:11:08 +02:00
Clifford Roche
1b73b2a12a Update greeclimate to 2.1.0 (#123210) 2024-08-06 10:06:35 +02:00
J. Nick Koston
54f8f24c2c Bump PyJWT to 2.9.0 (#123209) 2024-08-05 15:51:15 -05:00
Franck Nijhof
5142cb5e98 Mark assist_pipeline as a system integration type (#123202) 2024-08-05 21:07:11 +02:00
Franck Nijhof
bb1efe56b6 Mark webhook as a system integration type (#123204) 2024-08-05 21:06:58 +02:00
Franck Nijhof
9c2ba9b157 Mark tag to be an entity component (#123200) 2024-08-05 20:40:44 +02:00
Joakim Plate
f51cc8fe12 Change zha diagnostic to snapshot (#123198) 2024-08-05 19:02:07 +02:00
Bram Kragten
537d7728a7 Update frontend to 20240805.1 (#123196) 2024-08-05 18:23:44 +02:00
Michael
844ccf461f Remove unnecessary config schema definitions (#123197) 2024-08-05 17:44:14 +02:00
Marius
94542d42fa Fix state icon for closed valve entities (#123190) 2024-08-05 17:17:46 +02:00
Michael
b223931ac0 Remove deprecated proximity entity (#123158) 2024-08-05 15:44:00 +02:00
Joost Lekkerkerker
42ab8d0445 Remove deprecated asterisk_mbox integration (#123174) 2024-08-05 15:28:49 +02:00
Joost Lekkerkerker
ef237a8431 Fix MPD issue creation (#123187) 2024-08-05 15:07:01 +02:00
Joost Lekkerkerker
96364f0452 Remove deprecated asterisk_cdr integration (#123180) 2024-08-05 14:43:39 +02:00
Joost Lekkerkerker
b73ca874bb Bump uvcclient to 0.11.1 (#123185) 2024-08-05 14:23:07 +02:00
musapinar
a6dfa6d4e0 Add Matter Leedarson RGBTW Bulb to the transition blocklist (#123182) 2024-08-05 14:21:01 +02:00
Matthias Alphart
f2d99cb059 Use KNX UI entity platform controller class (#123128) 2024-08-05 12:34:48 +02:00
J. Nick Koston
5b7fd29797 Improve performance of logbook processor humanify (#123157) 2024-08-05 11:33:37 +02:00
Chris Buckley
ab811f70b1 Todoist service validation error consistency (#123122) 2024-08-05 11:24:49 +02:00
Artur Pragacz
67e3139dcf Clean up useless logging handler setting (#120974)
Setting level of the handler does effectively nothing,
because HomeAssistantQueueHandler ignores this setting.
Also make the convention of getting the root logger uniform.
2024-08-05 11:22:13 +02:00
David F. Mulcahey
3257bdeed2 Bump ZHA lib to 0.0.27 (#123125) 2024-08-05 11:19:57 +02:00
Clifford Roche
1163cc7cab Update greeclimate to 2.0.0 (#121030)
Co-authored-by: Joostlek <joostlek@outlook.com>
2024-08-05 11:18:34 +02:00
Barry vd. Heuvel
e9e357b12e Add spaces for readability in licenses.py (#123173) 2024-08-05 11:18:04 +02:00
Simon Hörrle
d246d02ab8 Add apsystems diagnostic binary sensors (#123045)
* add diagnostic sensors

* select output_data from data

* split sensor and binary_sensor configurations

* adjust module description

* convert values to bool

* add strings

* add tests

* add tests

* update translations

* remove already available _attr_has_entity_name

* use dataclass instead of TypedDict

* Update tests/components/apsystems/test_binary_sensor.py

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-08-05 11:08:27 +02:00
dupondje
a7fbac5185 dsmr: migrate hourly_gas_meter_reading to mbus device (#123149) 2024-08-05 10:32:58 +02:00
Calvin Walton
b45fe0ec73 Add Govee H612B to the Matter transition blocklist (#123163) 2024-08-05 10:02:15 +02:00
Brett Adams
d7e3df1974 Fix class attribute condition in Tesla Fleet (#123162) 2024-08-05 09:59:33 +02:00
dependabot[bot]
31fd4efa36 Bump actions/upload-artifact from 4.3.4 to 4.3.5 (#123170) 2024-08-05 09:21:37 +02:00
Mr. Bubbles
7308912b39 Catch exception in coordinator setup of IronOS integration (#123079) 2024-08-05 08:43:29 +02:00
J. Nick Koston
4d103c1fc2 Bump aiohttp to 3.10.1 (#123159) 2024-08-05 08:39:04 +02:00
J. Nick Koston
4fd92c17f0 Optimize logbook row matching (#123127) 2024-08-04 17:06:32 -05:00
J. Nick Koston
6b7307df81 Speed up logbook timestamp processing (#123126) 2024-08-04 16:43:43 -05:00
J. Nick Koston
b09dd95dbd Improve alignment of live logbook and historical logbook models (#123070)
* Improve alignment of live logbook and historical logbook models

- Make EventAsRow as NamedType which is better aligned with
  sqlalchemy Row
- Use getitem to fetch results for both Row and EventAsRow
  since its an order of magnitude faster fetching sqlalchemy
  Row object values.

* final

* fix

* unused

* fix more tests

* cleanup

* reduce

* tweak
2024-08-04 23:09:10 +02:00
J. Nick Koston
3353c3c205 Remove unneeded formatter argument from logbook websocket_api (#123095) 2024-08-04 23:05:56 +02:00
G Johansson
ccd157dc26 Use coordinator setup method in filesize (#123139) 2024-08-04 23:03:40 +02:00
Maciej Bieniek
a9d8e47979 Support DeviceInfo.model_id in MQTT integration (#123152)
Add support for model_id
2024-08-04 23:02:41 +02:00
epenet
30f4d1b958 Fix implicit-return in overkiz (#123000) 2024-08-04 20:18:19 +02:00
Yaroslav Halchenko
e682d8c6e2 Handle command_line missing discovery_info (#116873)
* command_line: Do not lead to erroring out code indexing None or empty discovery_info

* Apply suggestions from code review

Co-authored-by: Franck Nijhof <frenck@frenck.nl>

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2024-08-04 16:39:41 +02:00
c0ffeeca7
70704f67d3 Recorder system info: fix capitalization (#123141)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-08-04 15:17:54 +02:00
Steve Repsher
232f78e7b6 Restore old service worker URL (#123131) 2024-08-04 07:28:45 -05:00
J. Nick Koston
b6de2cd741 Unpack non-performant any expressions in config flow discovery path (#123124) 2024-08-03 17:33:46 -05:00
Louis Christ
02f81ec481 Fix wrong DeviceInfo in bluesound integration (#123101)
Fix bluesound device info
2024-08-03 22:32:47 +02:00
Arie Catsman
b7d56ad38a Bump pyenphase to 1.22.0 (#123103) 2024-08-03 10:21:12 -05:00
Kim de Vos
eb5ee1ffd1 Use slugify to create id for UniFi WAN latency (#123108)
Use slugify to create id for latency
2024-08-03 15:08:01 +02:00
J. Nick Koston
cdec43ec06 Remove unreachable suppress in logbook (#123096) 2024-08-03 08:03:28 -05:00
J. Nick Koston
0fe23c82a4 Remove unused variables in logbook LazyEventPartialState (#123097) 2024-08-03 06:26:54 -05:00
J. Nick Koston
61cbb77042 Remove unneeded cast in logbook rest api (#123098) 2024-08-03 06:26:32 -05:00
David Bonnes
bb31fc1ec7 Test storage save and load for evohome (#122510)
* test storage save and load

* fix bug exposed by test

* refactor test

* add JSON for test account/location

* create helpers to load JSON

* refactor test

* baseline refactor

* tweak

* update requiremenst

* rationalise code

* remove conditional in test

* refactor test

* mypy fix

* tweak tests

* working test

* working test 4

* working test 5

* add typed dicts

* working dtms

* lint

* fix dtm asserts

* doc strings

* list

* tweak conditional

* tweak test data sets to extend coverage

* leverage conftest.py for subsequent tests

* revert test storage

* revert part two

* rename symbols

* remove anachronism

* stop unwanted DNS lookup

* Clean up type ignores

* Format

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-08-03 10:41:30 +02:00
Chris Buckley
6684f61a54 Add support for Todoist sections (#115671)
* Add support for Todoist sections

* ServiceValidationError & section name tweaks from PR comments

* Remove whitespace

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* More natural error message

Co-authored-by: Erik Montnemery <erik@montnemery.com>

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-08-03 09:07:13 +02:00
Paulus Schoutsen
aa6f0cd55a Add CONTROL supported feature to Google conversation when API access (#123046)
* Add CONTROL supported feature to Google conversation when API access

* Better function name

* Handle entry update inline

* Reload instead of update
2024-08-02 23:16:30 -07:00
Denis Shulyaka
f6ad018f8f Change enum type to string for Google Generative AI Conversation (#123069) 2024-08-02 23:14:24 -07:00
Shay Levy
8687c32c15 Ignore Shelly IPv6 address in zeroconf (#123081) 2024-08-02 21:56:49 +03:00
epenet
34b561b211 Bump ruff to 0.5.6 (#123073) 2024-08-02 19:04:00 +02:00
epenet
e32a48ac55 Improve type hints in google_assistant (#122895) 2024-08-02 17:55:46 +02:00
Markus Jacobsen
b0ece4bbaa Improve Bang olufsen media_player dispatcher formatting (#123065)
* Avoid repeating almost the same command 8 times

* Remove debugging
2024-08-02 17:07:23 +02:00
Bram Kragten
a18166e3f8 Update frontend to 20240802.0 (#123072) 2024-08-02 16:48:37 +02:00
Robert Resch
b89a859f14 Fix and improve tedee lock states (#123022)
Improve tedee lock states
2024-08-02 15:58:41 +02:00
Matrix
a4aefe43dc Yolink device model adaptation (#122824) 2024-08-02 15:57:15 +02:00
Christopher Fenner
115303faf5 Fix translation key for power exchange sensor in ViCare (#122339) 2024-08-02 15:44:19 +02:00
epenet
1eadb00fce Fix implicit-return in google_assistant (#123002) 2024-08-02 15:31:09 +02:00
epenet
b609f8e962 Fix implicit-return in macos script (#122945) 2024-08-02 15:30:29 +02:00
epenet
e734971d33 Enable collections-named-tuple (PYI024) rule in ruff (#123019) 2024-08-02 15:28:32 +02:00
Paulus Schoutsen
b6c9fe86e1 Ensure claude supported feature reflect latest config entry options (#123050) 2024-08-02 15:27:11 +02:00
Ryan Mattson
db238a75e3 Lyric: Properly tie room accessories to the data coordinator (#115902)
* properly tie lyric accessories to the data coordinator so sensors recieve updates

* only check for accessories for LCC devices

* revert: meant to give it its own branch and PR
2024-08-02 15:13:56 +02:00
karwosts
fb76e70c3f Use text/multiple selector for input_select.set_options (#122539) 2024-08-02 15:10:04 +02:00
H. Árkosi Róbert
a40dce449f Add LinkPlay models (#123056)
* Add some LinkPlay models

* Update utils.py

* Update utils.py

* Update utils.py

* Update homeassistant/components/linkplay/utils.py

* Update homeassistant/components/linkplay/utils.py

* Update utils.py

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-08-02 14:25:43 +02:00
Joost Lekkerkerker
d2dd5ba0e6 Do not raise repair issue about missing integration in safe mode (#123066) 2024-08-02 13:38:56 +02:00
Philip Vanloo
3de8828358 Add additional items to REPEAT_MAP in LinkPlay (#123063)
* Upgrade python-linkplay, add items to REPEAT_MAP

* Undo dependency bump
2024-08-02 13:38:05 +02:00
Philip Vanloo
b610b29d28 LinkPlay: Bump python-linkplay to 0.0.6 (#123062)
Bump python-linkplay to 0.0.6
2024-08-02 13:23:45 +02:00
Matthias Alphart
42234e6a09 Address post-merge reviews for KNX integration (#123038) 2024-08-02 12:53:39 +02:00
Paulus Schoutsen
4a06e20318 Ollama implement CONTROL supported feature (#123049) 2024-08-02 12:31:31 +02:00
epenet
ad26db7dc8 Replace pylint broad-exception-raised rule with ruff (#123021) 2024-08-02 12:24:03 +02:00
David F. Mulcahey
5446dd92a9 Make ZHA load quirks earlier (#123027) 2024-08-02 12:22:36 +02:00
Fabian
7670ad0a72 Add device class (#123059) 2024-08-02 12:19:55 +02:00
Marc Mueller
b2d5f9c742 Update generator typing (#123052) 2024-08-02 12:17:51 +02:00
Paulus Schoutsen
adf8515698 OpenAI make supported features reflect the config entry options (#123047) 2024-08-02 12:08:44 +02:00
Erik Montnemery
449afe9e6f Correct type annotation for EntityPlatform.async_register_entity_service (#123054)
Correct type annotation for EntityPlatform.async_register_entity_service

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2024-08-02 11:58:07 +02:00
Erik Montnemery
0058d42ca2 Correct squeezebox service (#123060) 2024-08-02 11:49:47 +02:00
Matthias Alphart
4da385898b Mitigate breaking change for KNX climate schema (#123043) 2024-08-02 08:50:19 +02:00
Matthias Alphart
8ec8aef02e Use freezer in KNX tests (#123044)
use freezer in tests
2024-08-02 08:48:41 +02:00
Denis Shulyaka
ed6d6575d7 Add aliases to script llm tool description (#122380)
* Add aliases to script llm tool description

* Also add name
2024-08-02 08:05:06 +02:00
Denis Shulyaka
262d778a38 Anthropic Claude conversation integration (#122526)
* Initial commit

* Use add_suggested_values

* Update homeassistant/components/anthropic/conversation.py

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

* Update strings.json

* Update config_flow.py

* Update config_flow.py

* Fix tests

* Update homeassistant/components/anthropic/conversation.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Removed agent registration

* Moved message_convert inline function outside

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2024-08-01 22:50:10 +02:00
Michael Hansen
80aa2c269b Standardize assist pipelines on 10ms chunk size (#123024)
* Make chunk size always 10ms

* Fix voip
2024-08-01 22:39:17 +02:00
J. Nick Koston
a3b5dcc21b Fix doorbird models are missing the schedule API (#123033)
* Fix doorbird models are missing the schedule API

fixes #122997

* cover
2024-08-01 22:37:26 +02:00
amccook
fef9c92eb7 Fix handling of directory type playlists in Plex (#122990)
Ignore type directory
2024-08-01 10:24:09 -04:00
epenet
4f3d624353 Enable pytest-fixture-param-without-value (PT019) rule in ruff (#122953) 2024-08-01 14:46:15 +02:00
DeerMaximum
f5e88b8293 Velux use node id as fallback for unique id (#117508)
Co-authored-by: Robert Resch <robert@resch.dev>
2024-08-01 14:32:37 +02:00
epenet
faedba0407 Rename variable in knx tests (#122994)
* Rename variable in knx tests

* Type hints

* Type hints
2024-08-01 13:44:30 +02:00
epenet
adf20b60dc Rename variable in landisgyr_heat_meter tests (#122995) 2024-08-01 13:43:09 +02:00
karwosts
ab522dab71 Restrict nws.get_forecasts_extra selector to nws weather entities (#122986) 2024-08-01 12:59:19 +02:00
epenet
c2a23bce50 Fix implicit-return in python_script (#123004) 2024-08-01 12:20:05 +02:00
Paulus Schoutsen
bc91bd3293 Make the Android timer notification high priority (#123006) 2024-08-01 11:51:45 +02:00
Matrix
6bf59a8dfc Bump yolink api to 0.4.6 (#123012) 2024-08-01 11:49:58 +02:00
Marc Mueller
cd80cd5caa Update audit licenses run conditions [ci] (#123009) 2024-08-01 11:30:29 +02:00
Ivan Belokobylskiy
25d4dd82a0 Bump aioymaps to 1.2.5 (#123005)
Bump aiomaps, fix sessionId parsing
2024-08-01 10:51:41 +02:00
epenet
d16a2fac80 Rename variable in async tests (#122996) 2024-08-01 09:20:21 +02:00
epenet
2fd3c42e63 Fix implicit-return in squeezebox (#122928) 2024-08-01 09:19:16 +02:00
Matrix
55e5428443 Fix yolink protocol changed (#122989) 2024-08-01 08:32:16 +02:00
J. Nick Koston
8375b58eac Update doorbird error notification to be a repair flow (#122987) 2024-08-01 08:31:22 +02:00
Franck Nijhof
352f0953f3 Skip binary wheels for pymicro-vad (#122982) 2024-08-01 01:00:17 +02:00
Franck Nijhof
bdd6f57975 Bump version to 2024.9.0dev0 (#122975) 2024-07-31 23:24:30 +02:00
1307 changed files with 32266 additions and 41484 deletions

View File

@@ -146,6 +146,7 @@ requirements: &requirements
- homeassistant/package_constraints.txt
- requirements*.txt
- pyproject.toml
- script/licenses.py
any:
- *base_platforms

View File

@@ -69,7 +69,7 @@ jobs:
run: find ./homeassistant/components/*/translations -name "*.json" | tar zcvf translations.tar.gz -T -
- name: Upload translations
uses: actions/upload-artifact@v4.3.4
uses: actions/upload-artifact@v4.3.6
with:
name: translations
path: translations.tar.gz
@@ -197,7 +197,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build base image
uses: home-assistant/builder@2024.03.5
uses: home-assistant/builder@2024.08.1
with:
args: |
$BUILD_ARGS \
@@ -263,7 +263,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build base image
uses: home-assistant/builder@2024.03.5
uses: home-assistant/builder@2024.08.1
with:
args: |
$BUILD_ARGS \
@@ -323,7 +323,7 @@ jobs:
uses: actions/checkout@v4.1.7
- name: Install Cosign
uses: sigstore/cosign-installer@v3.5.0
uses: sigstore/cosign-installer@v3.6.0
with:
cosign-release: "v2.2.3"

View File

@@ -31,12 +31,16 @@ on:
description: "Only run mypy"
default: false
type: boolean
audit-licenses-only:
description: "Only run audit licenses"
default: false
type: boolean
env:
CACHE_VERSION: 9
CACHE_VERSION: 10
UV_CACHE_VERSION: 1
MYPY_CACHE_VERSION: 8
HA_SHORT_VERSION: "2024.8"
HA_SHORT_VERSION: "2024.9"
DEFAULT_PYTHON: "3.12"
ALL_PYTHON_VERSIONS: "['3.12']"
# 10.3 is the oldest supported version
@@ -222,6 +226,7 @@ jobs:
if: |
github.event.inputs.pylint-only != 'true'
&& github.event.inputs.mypy-only != 'true'
&& github.event.inputs.audit-licenses-only != 'true'
needs:
- info
steps:
@@ -343,6 +348,7 @@ jobs:
pre-commit run --hook-stage manual ruff --all-files --show-diff-on-failure
env:
RUFF_OUTPUT_FORMAT: github
lint-other:
name: Check other linters
runs-on: ubuntu-24.04
@@ -508,8 +514,7 @@ jobs:
uv pip install -U "pip>=21.3.1" setuptools wheel
uv pip install -r requirements.txt
python -m script.gen_requirements_all ci
uv pip install -r requirements_all_pytest.txt
uv pip install -r requirements_test.txt
uv pip install -r requirements_all_pytest.txt -r requirements_test.txt
uv pip install -e . --config-settings editable_mode=compat
hassfest:
@@ -518,6 +523,7 @@ jobs:
if: |
github.event.inputs.pylint-only != 'true'
&& github.event.inputs.mypy-only != 'true'
&& github.event.inputs.audit-licenses-only != 'true'
needs:
- info
- base
@@ -556,6 +562,7 @@ jobs:
if: |
github.event.inputs.pylint-only != 'true'
&& github.event.inputs.mypy-only != 'true'
&& github.event.inputs.audit-licenses-only != 'true'
needs:
- info
- base
@@ -589,7 +596,10 @@ jobs:
- info
- base
if: |
needs.info.outputs.requirements == 'true'
(github.event.inputs.pylint-only != 'true'
&& github.event.inputs.mypy-only != 'true'
|| github.event.inputs.audit-licenses-only == 'true')
&& needs.info.outputs.requirements == 'true'
steps:
- name: Check out code from GitHub
uses: actions/checkout@v4.1.7
@@ -613,7 +623,7 @@ jobs:
. venv/bin/activate
pip-licenses --format=json --output-file=licenses.json
- name: Upload licenses
uses: actions/upload-artifact@v4.3.4
uses: actions/upload-artifact@v4.3.6
with:
name: licenses
path: licenses.json
@@ -628,6 +638,7 @@ jobs:
timeout-minutes: 20
if: |
github.event.inputs.mypy-only != 'true'
&& github.event.inputs.audit-licenses-only != 'true'
|| github.event.inputs.pylint-only == 'true'
needs:
- info
@@ -672,7 +683,9 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 20
if: |
(github.event.inputs.mypy-only != 'true' || github.event.inputs.pylint-only == 'true')
(github.event.inputs.mypy-only != 'true'
&& github.event.inputs.audit-licenses-only != 'true'
|| github.event.inputs.pylint-only == 'true')
&& (needs.info.outputs.tests_glob || needs.info.outputs.test_full_suite == 'true')
needs:
- info
@@ -717,6 +730,7 @@ jobs:
runs-on: ubuntu-24.04
if: |
github.event.inputs.pylint-only != 'true'
&& github.event.inputs.audit-licenses-only != 'true'
|| github.event.inputs.mypy-only == 'true'
needs:
- info
@@ -781,6 +795,7 @@ jobs:
&& github.event.inputs.lint-only != 'true'
&& github.event.inputs.pylint-only != 'true'
&& github.event.inputs.mypy-only != 'true'
&& github.event.inputs.audit-licenses-only != 'true'
&& needs.info.outputs.test_full_suite == 'true'
needs:
- info
@@ -818,7 +833,7 @@ jobs:
. venv/bin/activate
python -m script.split_tests ${{ needs.info.outputs.test_group_count }} tests
- name: Upload pytest_buckets
uses: actions/upload-artifact@v4.3.4
uses: actions/upload-artifact@v4.3.6
with:
name: pytest_buckets
path: pytest_buckets.txt
@@ -831,6 +846,7 @@ jobs:
&& github.event.inputs.lint-only != 'true'
&& github.event.inputs.pylint-only != 'true'
&& github.event.inputs.mypy-only != 'true'
&& github.event.inputs.audit-licenses-only != 'true'
&& needs.info.outputs.test_full_suite == 'true'
needs:
- info
@@ -918,14 +934,14 @@ jobs:
2>&1 | tee pytest-${{ matrix.python-version }}-${{ matrix.group }}.txt
- name: Upload pytest output
if: success() || failure() && steps.pytest-full.conclusion == 'failure'
uses: actions/upload-artifact@v4.3.4
uses: actions/upload-artifact@v4.3.6
with:
name: pytest-${{ github.run_number }}-${{ matrix.python-version }}-${{ matrix.group }}
path: pytest-*.txt
overwrite: true
- name: Upload coverage artifact
if: needs.info.outputs.skip_coverage != 'true'
uses: actions/upload-artifact@v4.3.4
uses: actions/upload-artifact@v4.3.6
with:
name: coverage-${{ matrix.python-version }}-${{ matrix.group }}
path: coverage.xml
@@ -951,6 +967,7 @@ jobs:
&& github.event.inputs.lint-only != 'true'
&& github.event.inputs.pylint-only != 'true'
&& github.event.inputs.mypy-only != 'true'
&& github.event.inputs.audit-licenses-only != 'true'
&& needs.info.outputs.mariadb_groups != '[]'
needs:
- info
@@ -1043,7 +1060,7 @@ jobs:
2>&1 | tee pytest-${{ matrix.python-version }}-${mariadb}.txt
- name: Upload pytest output
if: success() || failure() && steps.pytest-partial.conclusion == 'failure'
uses: actions/upload-artifact@v4.3.4
uses: actions/upload-artifact@v4.3.6
with:
name: pytest-${{ github.run_number }}-${{ matrix.python-version }}-${{
steps.pytest-partial.outputs.mariadb }}
@@ -1051,7 +1068,7 @@ jobs:
overwrite: true
- name: Upload coverage artifact
if: needs.info.outputs.skip_coverage != 'true'
uses: actions/upload-artifact@v4.3.4
uses: actions/upload-artifact@v4.3.6
with:
name: coverage-${{ matrix.python-version }}-${{
steps.pytest-partial.outputs.mariadb }}
@@ -1076,6 +1093,7 @@ jobs:
&& github.event.inputs.lint-only != 'true'
&& github.event.inputs.pylint-only != 'true'
&& github.event.inputs.mypy-only != 'true'
&& github.event.inputs.audit-licenses-only != 'true'
&& needs.info.outputs.postgresql_groups != '[]'
needs:
- info
@@ -1169,7 +1187,7 @@ jobs:
2>&1 | tee pytest-${{ matrix.python-version }}-${postgresql}.txt
- name: Upload pytest output
if: success() || failure() && steps.pytest-partial.conclusion == 'failure'
uses: actions/upload-artifact@v4.3.4
uses: actions/upload-artifact@v4.3.6
with:
name: pytest-${{ github.run_number }}-${{ matrix.python-version }}-${{
steps.pytest-partial.outputs.postgresql }}
@@ -1177,7 +1195,7 @@ jobs:
overwrite: true
- name: Upload coverage artifact
if: needs.info.outputs.skip_coverage != 'true'
uses: actions/upload-artifact@v4.3.4
uses: actions/upload-artifact@v4.3.6
with:
name: coverage-${{ matrix.python-version }}-${{
steps.pytest-partial.outputs.postgresql }}
@@ -1220,6 +1238,7 @@ jobs:
&& github.event.inputs.lint-only != 'true'
&& github.event.inputs.pylint-only != 'true'
&& github.event.inputs.mypy-only != 'true'
&& github.event.inputs.audit-licenses-only != 'true'
&& needs.info.outputs.tests_glob
&& needs.info.outputs.test_full_suite == 'false'
needs:
@@ -1310,14 +1329,14 @@ jobs:
2>&1 | tee pytest-${{ matrix.python-version }}-${{ matrix.group }}.txt
- name: Upload pytest output
if: success() || failure() && steps.pytest-partial.conclusion == 'failure'
uses: actions/upload-artifact@v4.3.4
uses: actions/upload-artifact@v4.3.6
with:
name: pytest-${{ github.run_number }}-${{ matrix.python-version }}-${{ matrix.group }}
path: pytest-*.txt
overwrite: true
- name: Upload coverage artifact
if: needs.info.outputs.skip_coverage != 'true'
uses: actions/upload-artifact@v4.3.4
uses: actions/upload-artifact@v4.3.6
with:
name: coverage-${{ matrix.python-version }}-${{ matrix.group }}
path: coverage.xml

View File

@@ -24,11 +24,11 @@ jobs:
uses: actions/checkout@v4.1.7
- name: Initialize CodeQL
uses: github/codeql-action/init@v3.25.15
uses: github/codeql-action/init@v3.26.2
with:
languages: python
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3.25.15
uses: github/codeql-action/analyze@v3.26.2
with:
category: "/language:python"

View File

@@ -82,14 +82,14 @@ jobs:
) > .env_file
- name: Upload env_file
uses: actions/upload-artifact@v4.3.4
uses: actions/upload-artifact@v4.3.6
with:
name: env_file
path: ./.env_file
overwrite: true
- name: Upload requirements_diff
uses: actions/upload-artifact@v4.3.4
uses: actions/upload-artifact@v4.3.6
with:
name: requirements_diff
path: ./requirements_diff.txt
@@ -101,7 +101,7 @@ jobs:
python -m script.gen_requirements_all ci
- name: Upload requirements_all_wheels
uses: actions/upload-artifact@v4.3.4
uses: actions/upload-artifact@v4.3.6
with:
name: requirements_all_wheels
path: ./requirements_all_wheels_*.txt
@@ -211,7 +211,7 @@ jobs:
wheels-key: ${{ secrets.WHEELS_KEY }}
env-file: true
apk: "bluez-dev;libffi-dev;openssl-dev;glib-dev;eudev-dev;libxml2-dev;libxslt-dev;libpng-dev;libjpeg-turbo-dev;tiff-dev;cups-dev;gmp-dev;mpfr-dev;mpc1-dev;ffmpeg-dev;gammu-dev;yaml-dev;openblas-dev;fftw-dev;lapack-dev;gfortran;blas-dev;eigen-dev;freetype-dev;glew-dev;harfbuzz-dev;hdf5-dev;libdc1394-dev;libtbb-dev;mesa-dev;openexr-dev;openjpeg-dev;uchardet-dev"
skip-binary: aiohttp;charset-normalizer;grpcio;SQLAlchemy;protobuf;pydantic
skip-binary: aiohttp;charset-normalizer;grpcio;SQLAlchemy;protobuf;pydantic;pymicro-vad
constraints: "homeassistant/package_constraints.txt"
requirements-diff: "requirements_diff.txt"
requirements: "requirements_old-cython.txt"
@@ -226,7 +226,7 @@ jobs:
wheels-key: ${{ secrets.WHEELS_KEY }}
env-file: true
apk: "bluez-dev;libffi-dev;openssl-dev;glib-dev;eudev-dev;libxml2-dev;libxslt-dev;libpng-dev;libjpeg-turbo-dev;tiff-dev;cups-dev;gmp-dev;mpfr-dev;mpc1-dev;ffmpeg-dev;gammu-dev;yaml-dev;openblas-dev;fftw-dev;lapack-dev;gfortran;blas-dev;eigen-dev;freetype-dev;glew-dev;harfbuzz-dev;hdf5-dev;libdc1394-dev;libtbb-dev;mesa-dev;openexr-dev;openjpeg-dev;uchardet-dev;nasm"
skip-binary: aiohttp;charset-normalizer;grpcio;SQLAlchemy;protobuf;pydantic
skip-binary: aiohttp;charset-normalizer;grpcio;SQLAlchemy;protobuf;pydantic;pymicro-vad
constraints: "homeassistant/package_constraints.txt"
requirements-diff: "requirements_diff.txt"
requirements: "requirements_all.txtaa"
@@ -240,7 +240,7 @@ jobs:
wheels-key: ${{ secrets.WHEELS_KEY }}
env-file: true
apk: "bluez-dev;libffi-dev;openssl-dev;glib-dev;eudev-dev;libxml2-dev;libxslt-dev;libpng-dev;libjpeg-turbo-dev;tiff-dev;cups-dev;gmp-dev;mpfr-dev;mpc1-dev;ffmpeg-dev;gammu-dev;yaml-dev;openblas-dev;fftw-dev;lapack-dev;gfortran;blas-dev;eigen-dev;freetype-dev;glew-dev;harfbuzz-dev;hdf5-dev;libdc1394-dev;libtbb-dev;mesa-dev;openexr-dev;openjpeg-dev;uchardet-dev;nasm"
skip-binary: aiohttp;charset-normalizer;grpcio;SQLAlchemy;protobuf;pydantic
skip-binary: aiohttp;charset-normalizer;grpcio;SQLAlchemy;protobuf;pydantic;pymicro-vad
constraints: "homeassistant/package_constraints.txt"
requirements-diff: "requirements_diff.txt"
requirements: "requirements_all.txtab"
@@ -254,7 +254,7 @@ jobs:
wheels-key: ${{ secrets.WHEELS_KEY }}
env-file: true
apk: "bluez-dev;libffi-dev;openssl-dev;glib-dev;eudev-dev;libxml2-dev;libxslt-dev;libpng-dev;libjpeg-turbo-dev;tiff-dev;cups-dev;gmp-dev;mpfr-dev;mpc1-dev;ffmpeg-dev;gammu-dev;yaml-dev;openblas-dev;fftw-dev;lapack-dev;gfortran;blas-dev;eigen-dev;freetype-dev;glew-dev;harfbuzz-dev;hdf5-dev;libdc1394-dev;libtbb-dev;mesa-dev;openexr-dev;openjpeg-dev;uchardet-dev;nasm"
skip-binary: aiohttp;charset-normalizer;grpcio;SQLAlchemy;protobuf;pydantic
skip-binary: aiohttp;charset-normalizer;grpcio;SQLAlchemy;protobuf;pydantic;pymicro-vad
constraints: "homeassistant/package_constraints.txt"
requirements-diff: "requirements_diff.txt"
requirements: "requirements_all.txtac"

View File

@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.5
rev: v0.6.1
hooks:
- id: ruff
args:
@@ -12,7 +12,7 @@ repos:
hooks:
- id: codespell
args:
- --ignore-words-list=astroid,checkin,currenty,hass,iif,incomfort,lookin,nam,NotIn,pres,ser,ue
- --ignore-words-list=astroid,checkin,currenty,hass,iif,incomfort,lookin,nam,NotIn
- --skip="./.*,*.csv,*.json,*.ambr"
- --quiet-level=2
exclude_types: [csv, json, html]

View File

@@ -95,8 +95,6 @@ homeassistant.components.aruba.*
homeassistant.components.arwn.*
homeassistant.components.aseko_pool_live.*
homeassistant.components.assist_pipeline.*
homeassistant.components.asterisk_cdr.*
homeassistant.components.asterisk_mbox.*
homeassistant.components.asuswrt.*
homeassistant.components.autarco.*
homeassistant.components.auth.*
@@ -198,7 +196,9 @@ homeassistant.components.fritzbox.*
homeassistant.components.fritzbox_callmonitor.*
homeassistant.components.fronius.*
homeassistant.components.frontend.*
homeassistant.components.fujitsu_fglair.*
homeassistant.components.fully_kiosk.*
homeassistant.components.fyta.*
homeassistant.components.generic_hygrostat.*
homeassistant.components.generic_thermostat.*
homeassistant.components.geo_location.*
@@ -295,6 +295,7 @@ homeassistant.components.lookin.*
homeassistant.components.luftdaten.*
homeassistant.components.madvr.*
homeassistant.components.mailbox.*
homeassistant.components.manual.*
homeassistant.components.map.*
homeassistant.components.mastodon.*
homeassistant.components.matrix.*

View File

@@ -108,6 +108,8 @@ build.json @home-assistant/supervisor
/tests/components/anova/ @Lash-L
/homeassistant/components/anthemav/ @hyralex
/tests/components/anthemav/ @hyralex
/homeassistant/components/anthropic/ @Shulyaka
/tests/components/anthropic/ @Shulyaka
/homeassistant/components/aosmith/ @bdr99
/tests/components/aosmith/ @bdr99
/homeassistant/components/apache_kafka/ @bachya
@@ -347,8 +349,8 @@ build.json @home-assistant/supervisor
/tests/components/dremel_3d_printer/ @tkdrob
/homeassistant/components/drop_connect/ @ChandlerSystems @pfrazer
/tests/components/drop_connect/ @ChandlerSystems @pfrazer
/homeassistant/components/dsmr/ @Robbie1221 @frenck
/tests/components/dsmr/ @Robbie1221 @frenck
/homeassistant/components/dsmr/ @Robbie1221
/tests/components/dsmr/ @Robbie1221
/homeassistant/components/dsmr_reader/ @sorted-bits @glodenox @erwindouna
/tests/components/dsmr_reader/ @sorted-bits @glodenox @erwindouna
/homeassistant/components/duotecno/ @cereal2nd
@@ -431,6 +433,7 @@ build.json @home-assistant/supervisor
/homeassistant/components/evil_genius_labs/ @balloob
/tests/components/evil_genius_labs/ @balloob
/homeassistant/components/evohome/ @zxdavb
/tests/components/evohome/ @zxdavb
/homeassistant/components/ezviz/ @RenierM26 @baqs
/tests/components/ezviz/ @RenierM26 @baqs
/homeassistant/components/faa_delays/ @ntilley905
@@ -496,6 +499,8 @@ build.json @home-assistant/supervisor
/tests/components/frontend/ @home-assistant/frontend
/homeassistant/components/frontier_silicon/ @wlcrs
/tests/components/frontier_silicon/ @wlcrs
/homeassistant/components/fujitsu_fglair/ @crevetor
/tests/components/fujitsu_fglair/ @crevetor
/homeassistant/components/fully_kiosk/ @cgarwood
/tests/components/fully_kiosk/ @cgarwood
/homeassistant/components/fyta/ @dontinelli
@@ -823,8 +828,6 @@ build.json @home-assistant/supervisor
/tests/components/logbook/ @home-assistant/core
/homeassistant/components/logger/ @home-assistant/core
/tests/components/logger/ @home-assistant/core
/homeassistant/components/logi_circle/ @evanjd
/tests/components/logi_circle/ @evanjd
/homeassistant/components/london_underground/ @jpbede
/tests/components/london_underground/ @jpbede
/homeassistant/components/lookin/ @ANMalko @bdraco
@@ -967,6 +970,8 @@ build.json @home-assistant/supervisor
/tests/components/nfandroidtv/ @tkdrob
/homeassistant/components/nibe_heatpump/ @elupus
/tests/components/nibe_heatpump/ @elupus
/homeassistant/components/nice_go/ @IceBotYT
/tests/components/nice_go/ @IceBotYT
/homeassistant/components/nightscout/ @marciogranzotto
/tests/components/nightscout/ @marciogranzotto
/homeassistant/components/nilu/ @hfurubotten
@@ -1324,6 +1329,8 @@ build.json @home-assistant/supervisor
/homeassistant/components/smarty/ @z0mbieprocess
/homeassistant/components/smhi/ @gjohansson-ST
/tests/components/smhi/ @gjohansson-ST
/homeassistant/components/smlight/ @tl-sl
/tests/components/smlight/ @tl-sl
/homeassistant/components/sms/ @ocalvo
/tests/components/sms/ @ocalvo
/homeassistant/components/snapcast/ @luar123

View File

@@ -8,6 +8,8 @@ import glob
from http.client import HTTPConnection
import importlib
import os
from pathlib import Path
from ssl import SSLContext
import sys
import threading
import time
@@ -143,6 +145,78 @@ _BLOCKING_CALLS: tuple[BlockingCall, ...] = (
strict_core=False,
skip_for_tests=True,
),
BlockingCall(
original_func=SSLContext.load_default_certs,
object=SSLContext,
function="load_default_certs",
check_allowed=None,
strict=False,
strict_core=False,
skip_for_tests=True,
),
BlockingCall(
original_func=SSLContext.load_verify_locations,
object=SSLContext,
function="load_verify_locations",
check_allowed=None,
strict=False,
strict_core=False,
skip_for_tests=True,
),
BlockingCall(
original_func=SSLContext.load_cert_chain,
object=SSLContext,
function="load_cert_chain",
check_allowed=None,
strict=False,
strict_core=False,
skip_for_tests=True,
),
BlockingCall(
original_func=Path.open,
object=Path,
function="open",
check_allowed=_check_file_allowed,
strict=False,
strict_core=False,
skip_for_tests=True,
),
BlockingCall(
original_func=Path.read_text,
object=Path,
function="read_text",
check_allowed=_check_file_allowed,
strict=False,
strict_core=False,
skip_for_tests=True,
),
BlockingCall(
original_func=Path.read_bytes,
object=Path,
function="read_bytes",
check_allowed=_check_file_allowed,
strict=False,
strict_core=False,
skip_for_tests=True,
),
BlockingCall(
original_func=Path.write_text,
object=Path,
function="write_text",
check_allowed=_check_file_allowed,
strict=False,
strict_core=False,
skip_for_tests=True,
),
BlockingCall(
original_func=Path.write_bytes,
object=Path,
function="write_bytes",
check_allowed=_check_file_allowed,
strict=False,
strict_core=False,
skip_for_tests=True,
),
)

View File

@@ -586,10 +586,10 @@ async def async_enable_logging(
logging.getLogger("aiohttp.access").setLevel(logging.WARNING)
logging.getLogger("httpx").setLevel(logging.WARNING)
sys.excepthook = lambda *args: logging.getLogger(None).exception(
sys.excepthook = lambda *args: logging.getLogger().exception(
"Uncaught exception", exc_info=args
)
threading.excepthook = lambda args: logging.getLogger(None).exception(
threading.excepthook = lambda args: logging.getLogger().exception(
"Uncaught thread exception",
exc_info=( # type: ignore[arg-type]
args.exc_type,
@@ -616,10 +616,9 @@ async def async_enable_logging(
_create_log_file, err_log_path, log_rotate_days
)
err_handler.setLevel(logging.INFO if verbose else logging.WARNING)
err_handler.setFormatter(logging.Formatter(fmt, datefmt=FORMAT_DATETIME))
logger = logging.getLogger("")
logger = logging.getLogger()
logger.addHandler(err_handler)
logger.setLevel(logging.INFO if verbose else logging.WARNING)

View File

@@ -1,5 +0,0 @@
{
"domain": "asterisk",
"name": "Asterisk",
"integrations": ["asterisk_cdr", "asterisk_mbox"]
}

View File

@@ -0,0 +1,5 @@
{
"domain": "fujitsu",
"name": "Fujitsu",
"integrations": ["fujitsu_anywair", "fujitsu_fglair"]
}

View File

@@ -81,7 +81,7 @@ class AcerSwitch(SwitchEntity):
write_timeout: int,
) -> None:
"""Init of the Acer projector."""
self.ser = serial.Serial(
self.serial = serial.Serial(
port=serial_port, timeout=timeout, write_timeout=write_timeout
)
self._serial_port = serial_port
@@ -99,16 +99,16 @@ class AcerSwitch(SwitchEntity):
# was disconnected during runtime.
# This way the projector can be reconnected and will still work
try:
if not self.ser.is_open:
self.ser.open()
self.ser.write(msg.encode("utf-8"))
if not self.serial.is_open:
self.serial.open()
self.serial.write(msg.encode("utf-8"))
# Size is an experience value there is no real limit.
# AFAIK there is no limit and no end character so we will usually
# need to wait for timeout
ret = self.ser.read_until(size=20).decode("utf-8")
ret = self.serial.read_until(size=20).decode("utf-8")
except serial.SerialException:
_LOGGER.error("Problem communicating with %s", self._serial_port)
self.ser.close()
self.serial.close()
return ret
def _write_read_format(self, msg: str) -> str:

View File

@@ -136,7 +136,7 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool:
# Tuple to hold data needed for notification
NotificationItem = namedtuple(
NotificationItem = namedtuple( # noqa: PYI024
"NotificationItem", "hnotify huser name plc_datatype callback"
)

View File

@@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/aemet",
"iot_class": "cloud_polling",
"loggers": ["aemet_opendata"],
"requirements": ["AEMET-OpenData==0.5.3"]
"requirements": ["AEMET-OpenData==0.5.4"]
}

View File

@@ -59,7 +59,7 @@ async def async_setup_entry(
platform = async_get_current_platform()
for service, method in CAMERA_SERVICES.items():
platform.async_register_entity_service(service, {}, method)
platform.async_register_entity_service(service, None, method)
class AgentCamera(MjpegCamera):

View File

@@ -21,6 +21,7 @@ PLATFORMS: list[Platform] = [
Platform.SELECT,
Platform.SENSOR,
Platform.SWITCH,
Platform.UPDATE,
]

View File

@@ -6,6 +6,6 @@
"documentation": "https://www.home-assistant.io/integrations/airgradient",
"integration_type": "device",
"iot_class": "local_polling",
"requirements": ["airgradient==0.7.1"],
"requirements": ["airgradient==0.8.0"],
"zeroconf": ["_airgradient._tcp.local."]
}

View File

@@ -0,0 +1,55 @@
"""Airgradient Update platform."""
from datetime import timedelta
from functools import cached_property
from homeassistant.components.update import UpdateDeviceClass, UpdateEntity
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import AirGradientConfigEntry, AirGradientMeasurementCoordinator
from .entity import AirGradientEntity
SCAN_INTERVAL = timedelta(hours=1)
async def async_setup_entry(
hass: HomeAssistant,
config_entry: AirGradientConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up Airgradient update platform."""
data = config_entry.runtime_data
async_add_entities([AirGradientUpdate(data.measurement)], True)
class AirGradientUpdate(AirGradientEntity, UpdateEntity):
"""Representation of Airgradient Update."""
_attr_device_class = UpdateDeviceClass.FIRMWARE
coordinator: AirGradientMeasurementCoordinator
def __init__(self, coordinator: AirGradientMeasurementCoordinator) -> None:
"""Initialize the entity."""
super().__init__(coordinator)
self._attr_unique_id = f"{coordinator.serial_number}-update"
@cached_property
def should_poll(self) -> bool:
"""Return True because we need to poll the latest version."""
return True
@property
def installed_version(self) -> str:
"""Return the installed version of the entity."""
return self.coordinator.data.firmware_version
async def async_update(self) -> None:
"""Update the entity."""
self._attr_latest_version = (
await self.coordinator.client.get_latest_firmware_version(
self.coordinator.serial_number
)
)

View File

@@ -31,7 +31,6 @@ from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import ConfigEntryAuthFailed
from homeassistant.helpers import (
aiohttp_client,
config_validation as cv,
device_registry as dr,
entity_registry as er,
)
@@ -62,8 +61,6 @@ PLATFORMS = [Platform.SENSOR]
DEFAULT_ATTRIBUTION = "Data provided by AirVisual"
CONFIG_SCHEMA = cv.removed(DOMAIN, raise_if_present=False)
@callback
def async_get_cloud_api_update_interval(

View File

@@ -114,7 +114,7 @@ class AirZoneConfigFlow(ConfigFlow, domain=DOMAIN):
)
try:
await airzone.get_version()
except AirzoneError as err:
except (AirzoneError, TimeoutError) as err:
raise AbortFlow("cannot_connect") from err
return await self.async_step_discovered_connection()

View File

@@ -11,5 +11,5 @@
"documentation": "https://www.home-assistant.io/integrations/airzone",
"iot_class": "local_polling",
"loggers": ["aioairzone"],
"requirements": ["aioairzone==0.8.1"]
"requirements": ["aioairzone==0.8.2"]
}

View File

@@ -161,6 +161,11 @@ class AirzoneBinarySensor(AirzoneEntity, BinarySensorEntity):
entity_description: AirzoneBinarySensorEntityDescription
@property
def available(self) -> bool:
"""Return Airzone Cloud binary sensor availability."""
return super().available and self.is_on is not None
@callback
def _handle_coordinator_update(self) -> None:
"""Update attributes when the coordinator updates."""

View File

@@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/airzone_cloud",
"iot_class": "cloud_push",
"loggers": ["aioairzone_cloud"],
"requirements": ["aioairzone-cloud==0.6.1"]
"requirements": ["aioairzone-cloud==0.6.2"]
}

View File

@@ -189,6 +189,11 @@ async def async_setup_entry(
class AirzoneSensor(AirzoneEntity, SensorEntity):
"""Define an Airzone Cloud sensor."""
@property
def available(self) -> bool:
"""Return Airzone Cloud sensor availability."""
return super().available and self.native_value is not None
@callback
def _handle_coordinator_update(self) -> None:
"""Update attributes when the coordinator updates."""

View File

@@ -124,9 +124,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
if not entities:
return False
component.async_register_entity_service(SERVICE_TURN_OFF, {}, "async_turn_off")
component.async_register_entity_service(SERVICE_TURN_ON, {}, "async_turn_on")
component.async_register_entity_service(SERVICE_TOGGLE, {}, "async_toggle")
component.async_register_entity_service(SERVICE_TURN_OFF, None, "async_turn_off")
component.async_register_entity_service(SERVICE_TURN_ON, None, "async_turn_on")
component.async_register_entity_service(SERVICE_TOGGLE, None, "async_toggle")
await component.async_add_entities(entities)
@@ -162,16 +162,8 @@ class Alert(Entity):
self._data = data
self._message_template = message_template
if self._message_template is not None:
self._message_template.hass = hass
self._done_message_template = done_message_template
if self._done_message_template is not None:
self._done_message_template.hass = hass
self._title_template = title_template
if self._title_template is not None:
self._title_template.hass = hass
self._notifiers = notifiers
self._can_ack = can_ack

View File

@@ -52,7 +52,6 @@ class AlexaFlashBriefingView(http.HomeAssistantView):
"""Initialize Alexa view."""
super().__init__()
self.flash_briefings = flash_briefings
template.attach(hass, self.flash_briefings)
@callback
def get(

View File

@@ -1206,7 +1206,7 @@ async def async_api_set_mode(
raise AlexaInvalidValueError(msg)
# Remote Activity
if instance == f"{remote.DOMAIN}.{remote.ATTR_ACTIVITY}":
elif instance == f"{remote.DOMAIN}.{remote.ATTR_ACTIVITY}":
activity = mode.split(".")[1]
activities: list[str] | None = entity.attributes.get(remote.ATTR_ACTIVITY_LIST)
if activity != PRESET_MODE_NA and activities and activity in activities:

View File

@@ -194,7 +194,7 @@ async def async_handle_message(
try:
if not enabled:
raise AlexaBridgeUnreachableError(
raise AlexaBridgeUnreachableError( # noqa: TRY301
"Alexa API not enabled in Home Assistant configuration"
)

View File

@@ -17,7 +17,6 @@ from homeassistant.const import (
)
from homeassistant.core import Event, HomeAssistant, callback
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import config_validation as cv
import homeassistant.helpers.device_registry as dr
from homeassistant.helpers.dispatcher import async_dispatcher_send
import homeassistant.helpers.entity_registry as er
@@ -25,7 +24,6 @@ import homeassistant.helpers.entity_registry as er
from .const import (
ATTR_LAST_DATA,
CONF_APP_KEY,
DOMAIN,
LOGGER,
TYPE_SOLARRADIATION,
TYPE_SOLARRADIATION_LX,
@@ -37,7 +35,6 @@ DATA_CONFIG = "config"
DEFAULT_SOCKET_MIN_RETRY = 15
CONFIG_SCHEMA = cv.removed(DOMAIN, raise_if_present=False)
type AmbientStationConfigEntry = ConfigEntry[AmbientStation]

View File

@@ -499,7 +499,7 @@ class AmcrestCam(Camera):
await getattr(self, f"_async_set_{func}")(value)
new_value = await getattr(self, f"_async_get_{func}")()
if new_value != value:
raise AmcrestCommandFailed
raise AmcrestCommandFailed # noqa: TRY301
except (AmcrestError, AmcrestCommandFailed) as error:
if tries == 1:
log_update_error(_LOGGER, action, self.name, description, error)

View File

@@ -14,7 +14,6 @@ from homeassistant.const import (
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv
from .const import DOMAIN
from .coordinator import AndroidIPCamDataUpdateCoordinator
@@ -27,9 +26,6 @@ PLATFORMS: list[Platform] = [
]
CONFIG_SCHEMA = cv.removed(DOMAIN, raise_if_present=False)
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Android IP Webcam from a config entry."""
websession = async_get_clientsession(hass)

View File

@@ -87,7 +87,7 @@ async def async_setup_entry(
"adb_command",
)
platform.async_register_entity_service(
SERVICE_LEARN_SENDEVENT, {}, "learn_sendevent"
SERVICE_LEARN_SENDEVENT, None, "learn_sendevent"
)
platform.async_register_entity_service(
SERVICE_DOWNLOAD,

View File

@@ -0,0 +1,46 @@
"""The Anthropic integration."""
from __future__ import annotations
import anthropic
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_API_KEY, Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import config_validation as cv
from .const import DOMAIN, LOGGER
PLATFORMS = (Platform.CONVERSATION,)
CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
type AnthropicConfigEntry = ConfigEntry[anthropic.AsyncClient]
async def async_setup_entry(hass: HomeAssistant, entry: AnthropicConfigEntry) -> bool:
"""Set up Anthropic from a config entry."""
client = anthropic.AsyncAnthropic(api_key=entry.data[CONF_API_KEY])
try:
await client.messages.create(
model="claude-3-haiku-20240307",
max_tokens=1,
messages=[{"role": "user", "content": "Hi"}],
timeout=10.0,
)
except anthropic.AuthenticationError as err:
LOGGER.error("Invalid API key: %s", err)
return False
except anthropic.AnthropicError as err:
raise ConfigEntryNotReady(err) from err
entry.runtime_data = client
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload Anthropic."""
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)

View File

@@ -0,0 +1,210 @@
"""Config flow for Anthropic integration."""
from __future__ import annotations
import logging
from types import MappingProxyType
from typing import Any
import anthropic
import voluptuous as vol
from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
ConfigFlowResult,
OptionsFlow,
)
from homeassistant.const import CONF_API_KEY, CONF_LLM_HASS_API
from homeassistant.core import HomeAssistant
from homeassistant.helpers import llm
from homeassistant.helpers.selector import (
NumberSelector,
NumberSelectorConfig,
SelectOptionDict,
SelectSelector,
SelectSelectorConfig,
TemplateSelector,
)
from .const import (
CONF_CHAT_MODEL,
CONF_MAX_TOKENS,
CONF_PROMPT,
CONF_RECOMMENDED,
CONF_TEMPERATURE,
DOMAIN,
RECOMMENDED_CHAT_MODEL,
RECOMMENDED_MAX_TOKENS,
RECOMMENDED_TEMPERATURE,
)
_LOGGER = logging.getLogger(__name__)
STEP_USER_DATA_SCHEMA = vol.Schema(
{
vol.Required(CONF_API_KEY): str,
}
)
RECOMMENDED_OPTIONS = {
CONF_RECOMMENDED: True,
CONF_LLM_HASS_API: llm.LLM_API_ASSIST,
CONF_PROMPT: llm.DEFAULT_INSTRUCTIONS_PROMPT,
}
async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> None:
"""Validate the user input allows us to connect.
Data has the keys from STEP_USER_DATA_SCHEMA with values provided by the user.
"""
client = anthropic.AsyncAnthropic(api_key=data[CONF_API_KEY])
await client.messages.create(
model="claude-3-haiku-20240307",
max_tokens=1,
messages=[{"role": "user", "content": "Hi"}],
timeout=10.0,
)
class AnthropicConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for Anthropic."""
VERSION = 1
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
errors = {}
if user_input is not None:
try:
await validate_input(self.hass, user_input)
except anthropic.APITimeoutError:
errors["base"] = "timeout_connect"
except anthropic.APIConnectionError:
errors["base"] = "cannot_connect"
except anthropic.APIStatusError as e:
if isinstance(e.body, dict):
errors["base"] = e.body.get("error", {}).get("type", "unknown")
else:
errors["base"] = "unknown"
except Exception:
_LOGGER.exception("Unexpected exception")
errors["base"] = "unknown"
else:
return self.async_create_entry(
title="Claude",
data=user_input,
options=RECOMMENDED_OPTIONS,
)
return self.async_show_form(
step_id="user", data_schema=STEP_USER_DATA_SCHEMA, errors=errors or None
)
@staticmethod
def async_get_options_flow(
config_entry: ConfigEntry,
) -> OptionsFlow:
"""Create the options flow."""
return AnthropicOptionsFlow(config_entry)
class AnthropicOptionsFlow(OptionsFlow):
"""Anthropic config flow options handler."""
def __init__(self, config_entry: ConfigEntry) -> None:
"""Initialize options flow."""
self.config_entry = config_entry
self.last_rendered_recommended = config_entry.options.get(
CONF_RECOMMENDED, False
)
async def async_step_init(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Manage the options."""
options: dict[str, Any] | MappingProxyType[str, Any] = self.config_entry.options
if user_input is not None:
if user_input[CONF_RECOMMENDED] == self.last_rendered_recommended:
if user_input[CONF_LLM_HASS_API] == "none":
user_input.pop(CONF_LLM_HASS_API)
return self.async_create_entry(title="", data=user_input)
# Re-render the options again, now with the recommended options shown/hidden
self.last_rendered_recommended = user_input[CONF_RECOMMENDED]
options = {
CONF_RECOMMENDED: user_input[CONF_RECOMMENDED],
CONF_PROMPT: user_input[CONF_PROMPT],
CONF_LLM_HASS_API: user_input[CONF_LLM_HASS_API],
}
suggested_values = options.copy()
if not suggested_values.get(CONF_PROMPT):
suggested_values[CONF_PROMPT] = llm.DEFAULT_INSTRUCTIONS_PROMPT
schema = self.add_suggested_values_to_schema(
vol.Schema(anthropic_config_option_schema(self.hass, options)),
suggested_values,
)
return self.async_show_form(
step_id="init",
data_schema=schema,
)
def anthropic_config_option_schema(
hass: HomeAssistant,
options: dict[str, Any] | MappingProxyType[str, Any],
) -> dict:
"""Return a schema for Anthropic completion options."""
hass_apis: list[SelectOptionDict] = [
SelectOptionDict(
label="No control",
value="none",
)
]
hass_apis.extend(
SelectOptionDict(
label=api.name,
value=api.id,
)
for api in llm.async_get_apis(hass)
)
schema = {
vol.Optional(CONF_PROMPT): TemplateSelector(),
vol.Optional(CONF_LLM_HASS_API, default="none"): SelectSelector(
SelectSelectorConfig(options=hass_apis)
),
vol.Required(
CONF_RECOMMENDED, default=options.get(CONF_RECOMMENDED, False)
): bool,
}
if options.get(CONF_RECOMMENDED):
return schema
schema.update(
{
vol.Optional(
CONF_CHAT_MODEL,
default=RECOMMENDED_CHAT_MODEL,
): str,
vol.Optional(
CONF_MAX_TOKENS,
default=RECOMMENDED_MAX_TOKENS,
): int,
vol.Optional(
CONF_TEMPERATURE,
default=RECOMMENDED_TEMPERATURE,
): NumberSelector(NumberSelectorConfig(min=0, max=1, step=0.05)),
}
)
return schema

View File

@@ -0,0 +1,15 @@
"""Constants for the Anthropic integration."""
import logging
DOMAIN = "anthropic"
LOGGER = logging.getLogger(__package__)
CONF_RECOMMENDED = "recommended"
CONF_PROMPT = "prompt"
CONF_CHAT_MODEL = "chat_model"
RECOMMENDED_CHAT_MODEL = "claude-3-5-sonnet-20240620"
CONF_MAX_TOKENS = "max_tokens"
RECOMMENDED_MAX_TOKENS = 1024
CONF_TEMPERATURE = "temperature"
RECOMMENDED_TEMPERATURE = 1.0

View File

@@ -0,0 +1,316 @@
"""Conversation support for Anthropic."""
from collections.abc import Callable
import json
from typing import Any, Literal, cast
import anthropic
from anthropic._types import NOT_GIVEN
from anthropic.types import (
Message,
MessageParam,
TextBlock,
TextBlockParam,
ToolParam,
ToolResultBlockParam,
ToolUseBlock,
ToolUseBlockParam,
)
import voluptuous as vol
from voluptuous_openapi import convert
from homeassistant.components import conversation
from homeassistant.components.conversation import trace
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_LLM_HASS_API, MATCH_ALL
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError, TemplateError
from homeassistant.helpers import device_registry as dr, intent, llm, template
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.util import ulid
from . import AnthropicConfigEntry
from .const import (
CONF_CHAT_MODEL,
CONF_MAX_TOKENS,
CONF_PROMPT,
CONF_TEMPERATURE,
DOMAIN,
LOGGER,
RECOMMENDED_CHAT_MODEL,
RECOMMENDED_MAX_TOKENS,
RECOMMENDED_TEMPERATURE,
)
# Max number of back and forth with the LLM to generate a response
MAX_TOOL_ITERATIONS = 10
async def async_setup_entry(
hass: HomeAssistant,
config_entry: AnthropicConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up conversation entities."""
agent = AnthropicConversationEntity(config_entry)
async_add_entities([agent])
def _format_tool(
tool: llm.Tool, custom_serializer: Callable[[Any], Any] | None
) -> ToolParam:
"""Format tool specification."""
return ToolParam(
name=tool.name,
description=tool.description or "",
input_schema=convert(tool.parameters, custom_serializer=custom_serializer),
)
def _message_convert(
message: Message,
) -> MessageParam:
"""Convert from class to TypedDict."""
param_content: list[TextBlockParam | ToolUseBlockParam] = []
for message_content in message.content:
if isinstance(message_content, TextBlock):
param_content.append(TextBlockParam(type="text", text=message_content.text))
elif isinstance(message_content, ToolUseBlock):
param_content.append(
ToolUseBlockParam(
type="tool_use",
id=message_content.id,
name=message_content.name,
input=message_content.input,
)
)
return MessageParam(role=message.role, content=param_content)
class AnthropicConversationEntity(
conversation.ConversationEntity, conversation.AbstractConversationAgent
):
"""Anthropic conversation agent."""
_attr_has_entity_name = True
_attr_name = None
def __init__(self, entry: AnthropicConfigEntry) -> None:
"""Initialize the agent."""
self.entry = entry
self.history: dict[str, list[MessageParam]] = {}
self._attr_unique_id = entry.entry_id
self._attr_device_info = dr.DeviceInfo(
identifiers={(DOMAIN, entry.entry_id)},
manufacturer="Anthropic",
model="Claude",
entry_type=dr.DeviceEntryType.SERVICE,
)
if self.entry.options.get(CONF_LLM_HASS_API):
self._attr_supported_features = (
conversation.ConversationEntityFeature.CONTROL
)
@property
def supported_languages(self) -> list[str] | Literal["*"]:
"""Return a list of supported languages."""
return MATCH_ALL
async def async_added_to_hass(self) -> None:
"""When entity is added to Home Assistant."""
await super().async_added_to_hass()
self.entry.async_on_unload(
self.entry.add_update_listener(self._async_entry_update_listener)
)
async def async_process(
self, user_input: conversation.ConversationInput
) -> conversation.ConversationResult:
"""Process a sentence."""
options = self.entry.options
intent_response = intent.IntentResponse(language=user_input.language)
llm_api: llm.APIInstance | None = None
tools: list[ToolParam] | None = None
user_name: str | None = None
llm_context = llm.LLMContext(
platform=DOMAIN,
context=user_input.context,
user_prompt=user_input.text,
language=user_input.language,
assistant=conversation.DOMAIN,
device_id=user_input.device_id,
)
if options.get(CONF_LLM_HASS_API):
try:
llm_api = await llm.async_get_api(
self.hass,
options[CONF_LLM_HASS_API],
llm_context,
)
except HomeAssistantError as err:
LOGGER.error("Error getting LLM API: %s", err)
intent_response.async_set_error(
intent.IntentResponseErrorCode.UNKNOWN,
f"Error preparing LLM API: {err}",
)
return conversation.ConversationResult(
response=intent_response, conversation_id=user_input.conversation_id
)
tools = [
_format_tool(tool, llm_api.custom_serializer) for tool in llm_api.tools
]
if user_input.conversation_id is None:
conversation_id = ulid.ulid_now()
messages = []
elif user_input.conversation_id in self.history:
conversation_id = user_input.conversation_id
messages = self.history[conversation_id]
else:
# Conversation IDs are ULIDs. We generate a new one if not provided.
# If an old OLID is passed in, we will generate a new one to indicate
# a new conversation was started. If the user picks their own, they
# want to track a conversation and we respect it.
try:
ulid.ulid_to_bytes(user_input.conversation_id)
conversation_id = ulid.ulid_now()
except ValueError:
conversation_id = user_input.conversation_id
messages = []
if (
user_input.context
and user_input.context.user_id
and (
user := await self.hass.auth.async_get_user(user_input.context.user_id)
)
):
user_name = user.name
try:
prompt_parts = [
template.Template(
llm.BASE_PROMPT
+ options.get(CONF_PROMPT, llm.DEFAULT_INSTRUCTIONS_PROMPT),
self.hass,
).async_render(
{
"ha_name": self.hass.config.location_name,
"user_name": user_name,
"llm_context": llm_context,
},
parse_result=False,
)
]
except TemplateError as err:
LOGGER.error("Error rendering prompt: %s", err)
intent_response.async_set_error(
intent.IntentResponseErrorCode.UNKNOWN,
f"Sorry, I had a problem with my template: {err}",
)
return conversation.ConversationResult(
response=intent_response, conversation_id=conversation_id
)
if llm_api:
prompt_parts.append(llm_api.api_prompt)
prompt = "\n".join(prompt_parts)
# Create a copy of the variable because we attach it to the trace
messages = [*messages, MessageParam(role="user", content=user_input.text)]
LOGGER.debug("Prompt: %s", messages)
LOGGER.debug("Tools: %s", tools)
trace.async_conversation_trace_append(
trace.ConversationTraceEventType.AGENT_DETAIL,
{"system": prompt, "messages": messages},
)
client = self.entry.runtime_data
# To prevent infinite loops, we limit the number of iterations
for _iteration in range(MAX_TOOL_ITERATIONS):
try:
response = await client.messages.create(
model=options.get(CONF_CHAT_MODEL, RECOMMENDED_CHAT_MODEL),
messages=messages,
tools=tools or NOT_GIVEN,
max_tokens=options.get(CONF_MAX_TOKENS, RECOMMENDED_MAX_TOKENS),
system=prompt,
temperature=options.get(CONF_TEMPERATURE, RECOMMENDED_TEMPERATURE),
)
except anthropic.AnthropicError as err:
intent_response.async_set_error(
intent.IntentResponseErrorCode.UNKNOWN,
f"Sorry, I had a problem talking to Anthropic: {err}",
)
return conversation.ConversationResult(
response=intent_response, conversation_id=conversation_id
)
LOGGER.debug("Response %s", response)
messages.append(_message_convert(response))
if response.stop_reason != "tool_use" or not llm_api:
break
tool_results: list[ToolResultBlockParam] = []
for tool_call in response.content:
if isinstance(tool_call, TextBlock):
LOGGER.info(tool_call.text)
if not isinstance(tool_call, ToolUseBlock):
continue
tool_input = llm.ToolInput(
tool_name=tool_call.name,
tool_args=cast(dict[str, Any], tool_call.input),
)
LOGGER.debug(
"Tool call: %s(%s)", tool_input.tool_name, tool_input.tool_args
)
try:
tool_response = await llm_api.async_call_tool(tool_input)
except (HomeAssistantError, vol.Invalid) as e:
tool_response = {"error": type(e).__name__}
if str(e):
tool_response["error_text"] = str(e)
LOGGER.debug("Tool response: %s", tool_response)
tool_results.append(
ToolResultBlockParam(
type="tool_result",
tool_use_id=tool_call.id,
content=json.dumps(tool_response),
)
)
messages.append(MessageParam(role="user", content=tool_results))
self.history[conversation_id] = messages
for content in response.content:
if isinstance(content, TextBlock):
intent_response.async_set_speech(content.text)
break
return conversation.ConversationResult(
response=intent_response, conversation_id=conversation_id
)
async def _async_entry_update_listener(
self, hass: HomeAssistant, entry: ConfigEntry
) -> None:
"""Handle options update."""
# Reload as we update device info + entity name + supported features
await hass.config_entries.async_reload(entry.entry_id)

View File

@@ -0,0 +1,12 @@
{
"domain": "anthropic",
"name": "Anthropic Conversation",
"after_dependencies": ["assist_pipeline", "intent"],
"codeowners": ["@Shulyaka"],
"config_flow": true,
"dependencies": ["conversation"],
"documentation": "https://www.home-assistant.io/integrations/anthropic",
"integration_type": "service",
"iot_class": "cloud_polling",
"requirements": ["anthropic==0.31.2"]
}

View File

@@ -0,0 +1,34 @@
{
"config": {
"step": {
"user": {
"data": {
"api_key": "[%key:common::config_flow::data::api_key%]"
}
}
},
"error": {
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"timeout_connect": "[%key:common::config_flow::error::timeout_connect%]",
"authentication_error": "[%key:common::config_flow::error::invalid_auth%]",
"unknown": "[%key:common::config_flow::error::unknown%]"
}
},
"options": {
"step": {
"init": {
"data": {
"prompt": "Instructions",
"chat_model": "[%key:common::generic::model%]",
"max_tokens": "Maximum tokens to return in response",
"temperature": "Temperature",
"llm_hass_api": "[%key:common::config_flow::data::llm_hass_api%]",
"recommended": "Recommended model settings"
},
"data_description": {
"prompt": "Instruct how the LLM should respond. This can be a template."
}
}
}
}
}

View File

@@ -8,7 +8,6 @@ from typing import Final
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_PORT, Platform
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from .const import DOMAIN
from .coordinator import APCUPSdCoordinator
@@ -17,8 +16,6 @@ _LOGGER = logging.getLogger(__name__)
PLATFORMS: Final = (Platform.BINARY_SENSOR, Platform.SENSOR)
CONFIG_SCHEMA = cv.removed(DOMAIN, raise_if_present=False)
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
"""Use config values to set up a function enabling status retrieval."""

View File

@@ -7,7 +7,7 @@
"documentation": "https://www.home-assistant.io/integrations/apple_tv",
"iot_class": "local_push",
"loggers": ["pyatv", "srptools"],
"requirements": ["pyatv==0.14.3"],
"requirements": ["pyatv==0.15.0"],
"zeroconf": [
"_mediaremotetv._tcp.local.",
"_companion-link._tcp.local.",

View File

@@ -13,7 +13,12 @@ from homeassistant.core import HomeAssistant
from .const import DEFAULT_PORT
from .coordinator import ApSystemsDataCoordinator
PLATFORMS: list[Platform] = [Platform.NUMBER, Platform.SENSOR, Platform.SWITCH]
PLATFORMS: list[Platform] = [
Platform.BINARY_SENSOR,
Platform.NUMBER,
Platform.SENSOR,
Platform.SWITCH,
]
@dataclass

View File

@@ -0,0 +1,102 @@
"""The read-only binary sensors for APsystems local API integration."""
from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from APsystemsEZ1 import ReturnAlarmInfo
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
BinarySensorEntityDescription,
)
from homeassistant.const import EntityCategory
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from . import ApSystemsConfigEntry, ApSystemsData
from .coordinator import ApSystemsDataCoordinator
from .entity import ApSystemsEntity
@dataclass(frozen=True, kw_only=True)
class ApsystemsLocalApiBinarySensorDescription(BinarySensorEntityDescription):
"""Describes Apsystens Inverter binary sensor entity."""
is_on: Callable[[ReturnAlarmInfo], bool | None]
BINARY_SENSORS: tuple[ApsystemsLocalApiBinarySensorDescription, ...] = (
ApsystemsLocalApiBinarySensorDescription(
key="off_grid_status",
translation_key="off_grid_status",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
is_on=lambda c: c.offgrid,
),
ApsystemsLocalApiBinarySensorDescription(
key="dc_1_short_circuit_error_status",
translation_key="dc_1_short_circuit_error_status",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
is_on=lambda c: c.shortcircuit_1,
),
ApsystemsLocalApiBinarySensorDescription(
key="dc_2_short_circuit_error_status",
translation_key="dc_2_short_circuit_error_status",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
is_on=lambda c: c.shortcircuit_2,
),
ApsystemsLocalApiBinarySensorDescription(
key="output_fault_status",
translation_key="output_fault_status",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
is_on=lambda c: not c.operating,
),
)
async def async_setup_entry(
hass: HomeAssistant,
config_entry: ApSystemsConfigEntry,
add_entities: AddEntitiesCallback,
) -> None:
"""Set up the binary sensor platform."""
config = config_entry.runtime_data
add_entities(
ApSystemsBinarySensorWithDescription(
data=config,
entity_description=desc,
)
for desc in BINARY_SENSORS
)
class ApSystemsBinarySensorWithDescription(
CoordinatorEntity[ApSystemsDataCoordinator], ApSystemsEntity, BinarySensorEntity
):
"""Base binary sensor to be used with description."""
entity_description: ApsystemsLocalApiBinarySensorDescription
def __init__(
self,
data: ApSystemsData,
entity_description: ApsystemsLocalApiBinarySensorDescription,
) -> None:
"""Initialize the sensor."""
super().__init__(data.coordinator)
ApSystemsEntity.__init__(self, data)
self.entity_description = entity_description
self._attr_unique_id = f"{data.device_id}_{entity_description.key}"
@property
def is_on(self) -> bool | None:
"""Return value of sensor."""
return self.entity_description.is_on(self.coordinator.data.alarm_info)

View File

@@ -2,17 +2,26 @@
from __future__ import annotations
from dataclasses import dataclass
from datetime import timedelta
from APsystemsEZ1 import APsystemsEZ1M, ReturnOutputData
from APsystemsEZ1 import APsystemsEZ1M, ReturnAlarmInfo, ReturnOutputData
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from .const import LOGGER
class ApSystemsDataCoordinator(DataUpdateCoordinator[ReturnOutputData]):
@dataclass
class ApSystemsSensorData:
"""Representing different Apsystems sensor data."""
output_data: ReturnOutputData
alarm_info: ReturnAlarmInfo
class ApSystemsDataCoordinator(DataUpdateCoordinator[ApSystemsSensorData]):
"""Coordinator used for all sensors."""
def __init__(self, hass: HomeAssistant, api: APsystemsEZ1M) -> None:
@@ -25,5 +34,14 @@ class ApSystemsDataCoordinator(DataUpdateCoordinator[ReturnOutputData]):
)
self.api = api
async def _async_update_data(self) -> ReturnOutputData:
return await self.api.get_output_data()
async def _async_setup(self) -> None:
try:
max_power = (await self.api.get_device_info()).maxPower
except (ConnectionError, TimeoutError):
raise UpdateFailed from None
self.api.max_power = max_power
async def _async_update_data(self) -> ApSystemsSensorData:
output_data = await self.api.get_output_data()
alarm_info = await self.api.get_alarm_info()
return ApSystemsSensorData(output_data=output_data, alarm_info=alarm_info)

View File

@@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/apsystems",
"integration_type": "device",
"iot_class": "local_polling",
"requirements": ["apsystems-ez1==1.3.3"]
"requirements": ["apsystems-ez1==2.2.1"]
}

View File

@@ -26,7 +26,6 @@ async def async_setup_entry(
class ApSystemsMaxOutputNumber(ApSystemsEntity, NumberEntity):
"""Base sensor to be used with description."""
_attr_native_max_value = 800
_attr_native_min_value = 30
_attr_native_step = 1
_attr_device_class = NumberDeviceClass.POWER
@@ -42,6 +41,7 @@ class ApSystemsMaxOutputNumber(ApSystemsEntity, NumberEntity):
super().__init__(data)
self._api = data.coordinator.api
self._attr_unique_id = f"{data.device_id}_output_limit"
self._attr_native_max_value = data.coordinator.api.max_power
async def async_update(self) -> None:
"""Set the state with the value fetched from the inverter."""

View File

@@ -148,4 +148,4 @@ class ApSystemsSensorWithDescription(
@property
def native_value(self) -> StateType:
"""Return value of sensor."""
return self.entity_description.value_fn(self.coordinator.data)
return self.entity_description.value_fn(self.coordinator.data.output_data)

View File

@@ -19,6 +19,20 @@
}
},
"entity": {
"binary_sensor": {
"off_grid_status": {
"name": "Off grid status"
},
"dc_1_short_circuit_error_status": {
"name": "DC 1 short circuit error status"
},
"dc_2_short_circuit_error_status": {
"name": "DC 2 short circuit error status"
},
"output_fault_status": {
"name": "Output fault status"
}
},
"sensor": {
"total_power": {
"name": "Total power"

View File

@@ -5,7 +5,6 @@ from __future__ import annotations
from typing import Any
from aiohttp.client_exceptions import ClientConnectionError
from APsystemsEZ1 import Status
from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity
from homeassistant.core import HomeAssistant
@@ -45,12 +44,12 @@ class ApSystemsInverterSwitch(ApSystemsEntity, SwitchEntity):
self._attr_available = False
else:
self._attr_available = True
self._attr_is_on = status == Status.normal
self._attr_is_on = status
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn the switch on."""
await self._api.set_device_power_status(0)
await self._api.set_device_power_status(True)
async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn the switch off."""
await self._api.set_device_power_status(1)
await self._api.set_device_power_status(False)

View File

@@ -3,12 +3,14 @@
from __future__ import annotations
from aioaquacell import AquacellApi
from aioaquacell.const import Brand
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import CONF_BRAND
from .coordinator import AquacellCoordinator
PLATFORMS = [Platform.SENSOR]
@@ -20,7 +22,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: AquacellConfigEntry) ->
"""Set up Aquacell from a config entry."""
session = async_get_clientsession(hass)
aquacell_api = AquacellApi(session)
brand = entry.data.get(CONF_BRAND, Brand.AQUACELL)
aquacell_api = AquacellApi(session, brand)
coordinator = AquacellCoordinator(hass, aquacell_api)

View File

@@ -7,18 +7,27 @@ import logging
from typing import Any
from aioaquacell import ApiException, AquacellApi, AuthenticationFailed
from aioaquacell.const import SUPPORTED_BRANDS, Brand
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import CONF_REFRESH_TOKEN, CONF_REFRESH_TOKEN_CREATION_TIME, DOMAIN
from .const import (
CONF_BRAND,
CONF_REFRESH_TOKEN,
CONF_REFRESH_TOKEN_CREATION_TIME,
DOMAIN,
)
_LOGGER = logging.getLogger(__name__)
DATA_SCHEMA = vol.Schema(
{
vol.Required(CONF_BRAND, default=Brand.AQUACELL): vol.In(
{key: brand.name for key, brand in SUPPORTED_BRANDS.items()}
),
vol.Required(CONF_EMAIL): str,
vol.Required(CONF_PASSWORD): str,
}
@@ -33,7 +42,7 @@ class AquaCellConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the initial step."""
"""Handle the cloud logon step."""
errors: dict[str, str] = {}
if user_input is not None:
await self.async_set_unique_id(
@@ -42,7 +51,7 @@ class AquaCellConfigFlow(ConfigFlow, domain=DOMAIN):
self._abort_if_unique_id_configured()
session = async_get_clientsession(self.hass)
api = AquacellApi(session)
api = AquacellApi(session, user_input[CONF_BRAND])
try:
refresh_token = await api.authenticate(
user_input[CONF_EMAIL], user_input[CONF_PASSWORD]
@@ -59,6 +68,7 @@ class AquaCellConfigFlow(ConfigFlow, domain=DOMAIN):
title=user_input[CONF_EMAIL],
data={
**user_input,
CONF_BRAND: user_input[CONF_BRAND],
CONF_REFRESH_TOKEN: refresh_token,
CONF_REFRESH_TOKEN_CREATION_TIME: datetime.now().timestamp(),
},

View File

@@ -5,6 +5,7 @@ from datetime import timedelta
DOMAIN = "aquacell"
DATA_AQUACELL = "DATA_AQUACELL"
CONF_BRAND = "brand"
CONF_REFRESH_TOKEN = "refresh_token"
CONF_REFRESH_TOKEN_CREATION_TIME = "refresh_token_creation_time"

View File

@@ -1,6 +1,6 @@
{
"domain": "aquacell",
"name": "Aquacell",
"name": "AquaCell",
"codeowners": ["@Jordi1990"],
"config_flow": true,
"dependencies": ["http", "network"],

View File

@@ -2,8 +2,9 @@
"config": {
"step": {
"user": {
"description": "Fill in your Aquacell mobile app credentials",
"description": "Select the brand of the softener and fill in your softener mobile app credentials",
"data": {
"brand": "Brand",
"email": "[%key:common::config_flow::data::email%]",
"password": "[%key:common::config_flow::data::password%]"
}

View File

@@ -11,12 +11,10 @@ from arcam.fmj.client import Client
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_PORT, Platform
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.dispatcher import async_dispatcher_send
from .const import (
DEFAULT_SCAN_INTERVAL,
DOMAIN,
SIGNAL_CLIENT_DATA,
SIGNAL_CLIENT_STARTED,
SIGNAL_CLIENT_STOPPED,
@@ -26,7 +24,6 @@ type ArcamFmjConfigEntry = ConfigEntry[Client]
_LOGGER = logging.getLogger(__name__)
CONFIG_SCHEMA = cv.removed(DOMAIN, raise_if_present=False)
PLATFORMS = [Platform.MEDIA_PLAYER]

View File

@@ -87,8 +87,6 @@ def setup_platform(
if value_template is None:
return lambda value: value
value_template.hass = hass
def _render(value):
try:
return value_template.async_render({"value": value}, parse_result=False)

View File

@@ -0,0 +1 @@
"""Virtual integration: ArtSound."""

View File

@@ -0,0 +1,6 @@
{
"domain": "artsound",
"name": "ArtSound",
"integration_type": "virtual",
"supported_by": "linkplay"
}

View File

@@ -6,13 +6,11 @@ from collections.abc import Callable, Iterable
from dataclasses import dataclass
from enum import StrEnum
import logging
from typing import Final
from .const import SAMPLE_CHANNELS, SAMPLE_RATE, SAMPLE_WIDTH
_LOGGER = logging.getLogger(__name__)
_SAMPLE_RATE: Final = 16000 # Hz
_SAMPLE_WIDTH: Final = 2 # bytes
class VadSensitivity(StrEnum):
"""How quickly the end of a voice command is detected."""
@@ -26,12 +24,12 @@ class VadSensitivity(StrEnum):
"""Return seconds of silence for sensitivity level."""
sensitivity = VadSensitivity(sensitivity)
if sensitivity == VadSensitivity.RELAXED:
return 2.0
return 1.25
if sensitivity == VadSensitivity.AGGRESSIVE:
return 0.5
return 0.25
return 1.0
return 0.7
class AudioBuffer:
@@ -80,7 +78,7 @@ class VoiceCommandSegmenter:
speech_seconds: float = 0.3
"""Seconds of speech before voice command has started."""
silence_seconds: float = 1.0
silence_seconds: float = 0.7
"""Seconds of silence after voice command has ended."""
timeout_seconds: float = 15.0
@@ -92,6 +90,9 @@ class VoiceCommandSegmenter:
in_command: bool = False
"""True if inside voice command."""
timed_out: bool = False
"""True a timeout occurred during voice command."""
_speech_seconds_left: float = 0.0
"""Seconds left before considering voice command as started."""
@@ -121,6 +122,9 @@ class VoiceCommandSegmenter:
Returns False when command is done.
"""
if self.timed_out:
self.timed_out = False
self._timeout_seconds_left -= chunk_seconds
if self._timeout_seconds_left <= 0:
_LOGGER.warning(
@@ -128,6 +132,7 @@ class VoiceCommandSegmenter:
self.timeout_seconds,
)
self.reset()
self.timed_out = True
return False
if not self.in_command:
@@ -179,7 +184,9 @@ class VoiceCommandSegmenter:
"""
if vad_samples_per_chunk is None:
# No chunking
chunk_seconds = (len(chunk) // _SAMPLE_WIDTH) / _SAMPLE_RATE
chunk_seconds = (
len(chunk) // (SAMPLE_WIDTH * SAMPLE_CHANNELS)
) / SAMPLE_RATE
is_speech = vad_is_speech(chunk)
return self.process(chunk_seconds, is_speech)
@@ -187,8 +194,8 @@ class VoiceCommandSegmenter:
raise ValueError("leftover_chunk_buffer is required when vad uses chunking")
# With chunking
seconds_per_chunk = vad_samples_per_chunk / _SAMPLE_RATE
bytes_per_chunk = vad_samples_per_chunk * _SAMPLE_WIDTH
seconds_per_chunk = vad_samples_per_chunk / SAMPLE_RATE
bytes_per_chunk = vad_samples_per_chunk * (SAMPLE_WIDTH * SAMPLE_CHANNELS)
for vad_chunk in chunk_samples(chunk, bytes_per_chunk, leftover_chunk_buffer):
is_speech = vad_is_speech(vad_chunk)
if not self.process(seconds_per_chunk, is_speech):

View File

@@ -1 +0,0 @@
"""The asterisk_cdr component."""

View File

@@ -1,70 +0,0 @@
"""Support for the Asterisk CDR interface."""
from __future__ import annotations
import datetime
import hashlib
from typing import Any
from homeassistant.components.asterisk_mbox import (
DOMAIN as ASTERISK_DOMAIN,
SIGNAL_CDR_UPDATE,
)
from homeassistant.components.mailbox import Mailbox
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
MAILBOX_NAME = "asterisk_cdr"
async def async_get_handler(
hass: HomeAssistant,
config: ConfigType,
discovery_info: DiscoveryInfoType | None = None,
) -> Mailbox:
"""Set up the Asterix CDR platform."""
return AsteriskCDR(hass, MAILBOX_NAME)
class AsteriskCDR(Mailbox):
"""Asterisk VM Call Data Record mailbox."""
def __init__(self, hass: HomeAssistant, name: str) -> None:
"""Initialize Asterisk CDR."""
super().__init__(hass, name)
self.cdr: list[dict[str, Any]] = []
async_dispatcher_connect(self.hass, SIGNAL_CDR_UPDATE, self._update_callback)
@callback
def _update_callback(self, msg: list[dict[str, Any]]) -> Any:
"""Update the message count in HA, if needed."""
self._build_message()
self.async_update()
def _build_message(self) -> None:
"""Build message structure."""
cdr: list[dict[str, Any]] = []
for entry in self.hass.data[ASTERISK_DOMAIN].cdr:
timestamp = datetime.datetime.strptime(
entry["time"], "%Y-%m-%d %H:%M:%S"
).timestamp()
info = {
"origtime": timestamp,
"callerid": entry["callerid"],
"duration": entry["duration"],
}
sha = hashlib.sha256(str(entry).encode("utf-8")).hexdigest()
msg = (
f"Destination: {entry['dest']}\n"
f"Application: {entry['application']}\n "
f"Context: {entry['context']}"
)
cdr.append({"info": info, "sha": sha, "text": msg})
self.cdr = cdr
async def async_get_messages(self) -> list[dict[str, Any]]:
"""Return a list of the current messages."""
if not self.cdr:
self._build_message()
return self.cdr

View File

@@ -1,8 +0,0 @@
{
"domain": "asterisk_cdr",
"name": "Asterisk Call Detail Records",
"codeowners": [],
"dependencies": ["asterisk_mbox"],
"documentation": "https://www.home-assistant.io/integrations/asterisk_cdr",
"iot_class": "local_polling"
}

View File

@@ -1,153 +0,0 @@
"""Support for Asterisk Voicemail interface."""
import logging
from typing import Any, cast
from asterisk_mbox import Client as asteriskClient
from asterisk_mbox.commands import (
CMD_MESSAGE_CDR,
CMD_MESSAGE_CDR_AVAILABLE,
CMD_MESSAGE_LIST,
)
import voluptuous as vol
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.dispatcher import async_dispatcher_send, dispatcher_connect
from homeassistant.helpers.issue_registry import IssueSeverity, create_issue
from homeassistant.helpers.typing import ConfigType
_LOGGER = logging.getLogger(__name__)
DOMAIN = "asterisk_mbox"
SIGNAL_DISCOVER_PLATFORM = "asterisk_mbox.discover_platform"
SIGNAL_MESSAGE_REQUEST = "asterisk_mbox.message_request"
SIGNAL_MESSAGE_UPDATE = "asterisk_mbox.message_updated"
SIGNAL_CDR_UPDATE = "asterisk_mbox.message_updated"
SIGNAL_CDR_REQUEST = "asterisk_mbox.message_request"
CONFIG_SCHEMA = vol.Schema(
{
DOMAIN: vol.Schema(
{
vol.Required(CONF_HOST): cv.string,
vol.Required(CONF_PASSWORD): cv.string,
vol.Required(CONF_PORT): cv.port,
}
)
},
extra=vol.ALLOW_EXTRA,
)
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up for the Asterisk Voicemail box."""
conf: dict[str, Any] = config[DOMAIN]
host: str = conf[CONF_HOST]
port: int = conf[CONF_PORT]
password: str = conf[CONF_PASSWORD]
hass.data[DOMAIN] = AsteriskData(hass, host, port, password, config)
create_issue(
hass,
DOMAIN,
"deprecated_integration",
breaks_in_ha_version="2024.9.0",
is_fixable=False,
issue_domain=DOMAIN,
severity=IssueSeverity.WARNING,
translation_key="deprecated_integration",
translation_placeholders={
"domain": DOMAIN,
"integration_title": "Asterisk Voicemail",
"mailbox": "mailbox",
},
)
return True
class AsteriskData:
"""Store Asterisk mailbox data."""
def __init__(
self,
hass: HomeAssistant,
host: str,
port: int,
password: str,
config: dict[str, Any],
) -> None:
"""Init the Asterisk data object."""
self.hass = hass
self.config = config
self.messages: list[dict[str, Any]] | None = None
self.cdr: list[dict[str, Any]] | None = None
dispatcher_connect(self.hass, SIGNAL_MESSAGE_REQUEST, self._request_messages)
dispatcher_connect(self.hass, SIGNAL_CDR_REQUEST, self._request_cdr)
dispatcher_connect(self.hass, SIGNAL_DISCOVER_PLATFORM, self._discover_platform)
# Only connect after signal connection to ensure we don't miss any
self.client = asteriskClient(host, port, password, self.handle_data)
@callback
def _discover_platform(self, component: str) -> None:
_LOGGER.debug("Adding mailbox %s", component)
self.hass.async_create_task(
discovery.async_load_platform(
self.hass, "mailbox", component, {}, self.config
)
)
@callback
def handle_data(
self, command: int, msg: list[dict[str, Any]] | dict[str, Any]
) -> None:
"""Handle changes to the mailbox."""
if command == CMD_MESSAGE_LIST:
msg = cast(list[dict[str, Any]], msg)
_LOGGER.debug("AsteriskVM sent updated message list: Len %d", len(msg))
old_messages = self.messages
self.messages = sorted(
msg, key=lambda item: item["info"]["origtime"], reverse=True
)
if not isinstance(old_messages, list):
async_dispatcher_send(self.hass, SIGNAL_DISCOVER_PLATFORM, DOMAIN)
async_dispatcher_send(self.hass, SIGNAL_MESSAGE_UPDATE, self.messages)
elif command == CMD_MESSAGE_CDR:
msg = cast(dict[str, Any], msg)
_LOGGER.debug(
"AsteriskVM sent updated CDR list: Len %d", len(msg.get("entries", []))
)
self.cdr = msg["entries"]
async_dispatcher_send(self.hass, SIGNAL_CDR_UPDATE, self.cdr)
elif command == CMD_MESSAGE_CDR_AVAILABLE:
if not isinstance(self.cdr, list):
_LOGGER.debug("AsteriskVM adding CDR platform")
self.cdr = []
async_dispatcher_send(
self.hass, SIGNAL_DISCOVER_PLATFORM, "asterisk_cdr"
)
async_dispatcher_send(self.hass, SIGNAL_CDR_REQUEST)
else:
_LOGGER.debug(
"AsteriskVM sent unknown message '%d' len: %d", command, len(msg)
)
@callback
def _request_messages(self) -> None:
"""Handle changes to the mailbox."""
_LOGGER.debug("Requesting message list")
self.client.messages()
@callback
def _request_cdr(self) -> None:
"""Handle changes to the CDR."""
_LOGGER.debug("Requesting CDR list")
self.client.get_cdr()

View File

@@ -1,86 +0,0 @@
"""Support for the Asterisk Voicemail interface."""
from __future__ import annotations
from functools import partial
import logging
from typing import Any
from asterisk_mbox import ServerError
from homeassistant.components.mailbox import CONTENT_TYPE_MPEG, Mailbox, StreamError
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import DOMAIN as ASTERISK_DOMAIN, AsteriskData
_LOGGER = logging.getLogger(__name__)
SIGNAL_MESSAGE_REQUEST = "asterisk_mbox.message_request"
SIGNAL_MESSAGE_UPDATE = "asterisk_mbox.message_updated"
async def async_get_handler(
hass: HomeAssistant,
config: ConfigType,
discovery_info: DiscoveryInfoType | None = None,
) -> Mailbox:
"""Set up the Asterix VM platform."""
return AsteriskMailbox(hass, ASTERISK_DOMAIN)
class AsteriskMailbox(Mailbox):
"""Asterisk VM Sensor."""
def __init__(self, hass: HomeAssistant, name: str) -> None:
"""Initialize Asterisk mailbox."""
super().__init__(hass, name)
async_dispatcher_connect(
self.hass, SIGNAL_MESSAGE_UPDATE, self._update_callback
)
@callback
def _update_callback(self, msg: str) -> None:
"""Update the message count in HA, if needed."""
self.async_update()
@property
def media_type(self) -> str:
"""Return the supported media type."""
return CONTENT_TYPE_MPEG
@property
def can_delete(self) -> bool:
"""Return if messages can be deleted."""
return True
@property
def has_media(self) -> bool:
"""Return if messages have attached media files."""
return True
async def async_get_media(self, msgid: str) -> bytes:
"""Return the media blob for the msgid."""
data: AsteriskData = self.hass.data[ASTERISK_DOMAIN]
client = data.client
try:
return await self.hass.async_add_executor_job(
partial(client.mp3, msgid, sync=True)
)
except ServerError as err:
raise StreamError(err) from err
async def async_get_messages(self) -> list[dict[str, Any]]:
"""Return a list of the current messages."""
data: AsteriskData = self.hass.data[ASTERISK_DOMAIN]
return data.messages or []
async def async_delete(self, msgid: str) -> bool:
"""Delete the specified messages."""
data: AsteriskData = self.hass.data[ASTERISK_DOMAIN]
client = data.client
_LOGGER.info("Deleting: %s", msgid)
await self.hass.async_add_executor_job(client.delete, msgid)
return True

View File

@@ -1,9 +0,0 @@
{
"domain": "asterisk_mbox",
"name": "Asterisk Voicemail",
"codeowners": [],
"documentation": "https://www.home-assistant.io/integrations/asterisk_mbox",
"iot_class": "local_push",
"loggers": ["asterisk_mbox"],
"requirements": ["asterisk_mbox==0.5.0"]
}

View File

@@ -1,8 +0,0 @@
{
"issues": {
"deprecated_integration": {
"title": "The {integration_title} is being removed",
"description": "{integration_title} is being removed as the `{mailbox}` platform is being removed and {integration_title} supports no other platforms. Remove the `{domain}` configuration from your configuration.yaml file and restart Home Assistant to fix this issue."
}
}
}

View File

@@ -52,7 +52,7 @@ SENSORS_TYPE_LOAD_AVG = "sensors_load_avg"
SENSORS_TYPE_RATES = "sensors_rates"
SENSORS_TYPE_TEMPERATURES = "sensors_temperatures"
WrtDevice = namedtuple("WrtDevice", ["ip", "name", "connected_to"])
WrtDevice = namedtuple("WrtDevice", ["ip", "name", "connected_to"]) # noqa: PYI024
_LOGGER = logging.getLogger(__name__)

View File

@@ -8,7 +8,7 @@ from typing import Any
import aiohttp
import voluptuous as vol
from yalexs.authenticator import ValidationResult
from yalexs.authenticator_common import ValidationResult
from yalexs.const import BRANDS, DEFAULT_BRAND
from yalexs.manager.exceptions import CannotConnect, InvalidAuth, RequireValidation

View File

@@ -28,5 +28,5 @@
"documentation": "https://www.home-assistant.io/integrations/august",
"iot_class": "cloud_push",
"loggers": ["pubnub", "yalexs"],
"requirements": ["yalexs==6.4.3", "yalexs-ble==2.4.3"]
"requirements": ["yalexs==8.0.2", "yalexs-ble==2.4.3"]
}

View File

@@ -4,7 +4,6 @@ from __future__ import annotations
from datetime import datetime, timedelta
from functools import partial
import socket
import aiohttp
from yalexs.activity import ACTION_DOORBELL_CALL_MISSED, Activity, ActivityType
@@ -26,14 +25,7 @@ def async_create_august_clientsession(hass: HomeAssistant) -> aiohttp.ClientSess
# Create an aiohttp session instead of using the default one since the
# default one is likely to trigger august's WAF if another integration
# is also using Cloudflare
#
# The family is set to AF_INET because IPv6 keeps coming up as an issue
# see https://github.com/home-assistant/core/issues/97146
#
# When https://github.com/aio-libs/aiohttp/issues/4451 is implemented
# we can allow IPv6 again
#
return aiohttp_client.async_create_clientsession(hass, family=socket.AF_INET)
return aiohttp_client.async_create_clientsession(hass)
def retrieve_time_based_activity(

View File

@@ -322,8 +322,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
},
trigger_service_handler,
)
component.async_register_entity_service(SERVICE_TOGGLE, {}, "async_toggle")
component.async_register_entity_service(SERVICE_TURN_ON, {}, "async_turn_on")
component.async_register_entity_service(SERVICE_TOGGLE, None, "async_toggle")
component.async_register_entity_service(SERVICE_TURN_ON, None, "async_turn_on")
component.async_register_entity_service(
SERVICE_TURN_OFF,
{vol.Optional(CONF_STOP_ACTIONS, default=DEFAULT_STOP_ACTIONS): cv.boolean},

View File

@@ -68,20 +68,20 @@ class BangOlufsenModel(StrEnum):
class WebsocketNotification(StrEnum):
"""Enum for WebSocket notification types."""
PLAYBACK_ERROR: Final[str] = "playback_error"
PLAYBACK_METADATA: Final[str] = "playback_metadata"
PLAYBACK_PROGRESS: Final[str] = "playback_progress"
PLAYBACK_SOURCE: Final[str] = "playback_source"
PLAYBACK_STATE: Final[str] = "playback_state"
SOFTWARE_UPDATE_STATE: Final[str] = "software_update_state"
SOURCE_CHANGE: Final[str] = "source_change"
VOLUME: Final[str] = "volume"
PLAYBACK_ERROR = "playback_error"
PLAYBACK_METADATA = "playback_metadata"
PLAYBACK_PROGRESS = "playback_progress"
PLAYBACK_SOURCE = "playback_source"
PLAYBACK_STATE = "playback_state"
SOFTWARE_UPDATE_STATE = "software_update_state"
SOURCE_CHANGE = "source_change"
VOLUME = "volume"
# Sub-notifications
NOTIFICATION: Final[str] = "notification"
REMOTE_MENU_CHANGED: Final[str] = "remoteMenuChanged"
NOTIFICATION = "notification"
REMOTE_MENU_CHANGED = "remoteMenuChanged"
ALL: Final[str] = "all"
ALL = "all"
DOMAIN: Final[str] = "bang_olufsen"

View File

@@ -2,6 +2,7 @@
from __future__ import annotations
from collections.abc import Callable
import json
import logging
from typing import Any, cast
@@ -137,65 +138,25 @@ class BangOlufsenMediaPlayer(BangOlufsenEntity, MediaPlayerEntity):
"""Turn on the dispatchers."""
await self._initialize()
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{self._unique_id}_{CONNECTION_STATUS}",
self._async_update_connection_state,
)
)
signal_handlers: dict[str, Callable] = {
CONNECTION_STATUS: self._async_update_connection_state,
WebsocketNotification.PLAYBACK_ERROR: self._async_update_playback_error,
WebsocketNotification.PLAYBACK_METADATA: self._async_update_playback_metadata,
WebsocketNotification.PLAYBACK_PROGRESS: self._async_update_playback_progress,
WebsocketNotification.PLAYBACK_STATE: self._async_update_playback_state,
WebsocketNotification.REMOTE_MENU_CHANGED: self._async_update_sources,
WebsocketNotification.SOURCE_CHANGE: self._async_update_source_change,
WebsocketNotification.VOLUME: self._async_update_volume,
}
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{self._unique_id}_{WebsocketNotification.PLAYBACK_ERROR}",
self._async_update_playback_error,
for signal, signal_handler in signal_handlers.items():
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{self._unique_id}_{signal}",
signal_handler,
)
)
)
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{self._unique_id}_{WebsocketNotification.PLAYBACK_METADATA}",
self._async_update_playback_metadata,
)
)
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{self._unique_id}_{WebsocketNotification.PLAYBACK_PROGRESS}",
self._async_update_playback_progress,
)
)
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{self._unique_id}_{WebsocketNotification.PLAYBACK_STATE}",
self._async_update_playback_state,
)
)
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{self._unique_id}_{WebsocketNotification.REMOTE_MENU_CHANGED}",
self._async_update_sources,
)
)
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{self._unique_id}_{WebsocketNotification.SOURCE_CHANGE}",
self._async_update_source_change,
)
)
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{self._unique_id}_{WebsocketNotification.VOLUME}",
self._async_update_volume,
)
)
async def _initialize(self) -> None:
"""Initialize connection dependent variables."""

View File

@@ -39,7 +39,7 @@ def get_scanner(hass: HomeAssistant, config: ConfigType) -> BboxDeviceScanner |
return scanner if scanner.success_init else None
Device = namedtuple("Device", ["mac", "name", "ip", "last_update"])
Device = namedtuple("Device", ["mac", "name", "ip", "last_update"]) # noqa: PYI024
class BboxDeviceScanner(DeviceScanner):

View File

@@ -51,8 +51,8 @@ async def async_setup_entry(
async_add_entities(entities)
platform = entity_platform.async_get_current_platform()
platform.async_register_entity_service(SERVICE_RECORD, {}, "record")
platform.async_register_entity_service(SERVICE_TRIGGER, {}, "trigger_camera")
platform.async_register_entity_service(SERVICE_RECORD, None, "record")
platform.async_register_entity_service(SERVICE_TRIGGER, None, "trigger_camera")
platform.async_register_entity_service(
SERVICE_SAVE_RECENT_CLIPS,
{vol.Required(CONF_FILE_PATH): cv.string},

View File

@@ -244,7 +244,6 @@ class BluesoundPlayer(MediaPlayerEntity):
self._status: Status | None = None
self._inputs: list[Input] = []
self._presets: list[Preset] = []
self._is_online = False
self._muted = False
self._master: BluesoundPlayer | None = None
self._is_master = False
@@ -312,26 +311,33 @@ class BluesoundPlayer(MediaPlayerEntity):
async def _start_poll_command(self):
"""Loop which polls the status of the player."""
try:
while True:
while True:
try:
await self.async_update_status()
except (TimeoutError, ClientError):
_LOGGER.error("Node %s:%s is offline, retrying later", self.name, self.port)
await asyncio.sleep(NODE_OFFLINE_CHECK_TIMEOUT)
self.start_polling()
except CancelledError:
_LOGGER.debug("Stopping the polling of node %s:%s", self.name, self.port)
except Exception:
_LOGGER.exception("Unexpected error in %s:%s", self.name, self.port)
raise
except (TimeoutError, ClientError):
_LOGGER.error(
"Node %s:%s is offline, retrying later", self.host, self.port
)
await asyncio.sleep(NODE_OFFLINE_CHECK_TIMEOUT)
except CancelledError:
_LOGGER.debug(
"Stopping the polling of node %s:%s", self.host, self.port
)
return
except Exception:
_LOGGER.exception(
"Unexpected error in %s:%s, retrying later", self.host, self.port
)
await asyncio.sleep(NODE_OFFLINE_CHECK_TIMEOUT)
async def async_added_to_hass(self) -> None:
"""Start the polling task."""
await super().async_added_to_hass()
self._polling_task = self.hass.async_create_task(self._start_poll_command())
self._polling_task = self.hass.async_create_background_task(
self._start_poll_command(),
name=f"bluesound.polling_{self.host}:{self.port}",
)
async def async_will_remove_from_hass(self) -> None:
"""Stop the polling task."""
@@ -345,7 +351,7 @@ class BluesoundPlayer(MediaPlayerEntity):
async def async_update(self) -> None:
"""Update internal status of the entity."""
if not self._is_online:
if not self.available:
return
with suppress(TimeoutError):
@@ -362,7 +368,7 @@ class BluesoundPlayer(MediaPlayerEntity):
try:
status = await self._player.status(etag=etag, poll_timeout=120, timeout=125)
self._is_online = True
self._attr_available = True
self._last_status_update = dt_util.utcnow()
self._status = status
@@ -391,7 +397,7 @@ class BluesoundPlayer(MediaPlayerEntity):
self.async_write_ha_state()
except (TimeoutError, ClientError):
self._is_online = False
self._attr_available = False
self._last_status_update = None
self._status = None
self.async_write_ha_state()

View File

@@ -16,7 +16,7 @@
"requirements": [
"bleak==0.22.2",
"bleak-retry-connector==3.5.0",
"bluetooth-adapters==0.19.3",
"bluetooth-adapters==0.19.4",
"bluetooth-auto-recovery==1.4.2",
"bluetooth-data-tools==1.19.4",
"dbus-fast==2.22.1",

View File

@@ -23,8 +23,6 @@ from .coordinator import BMWDataUpdateCoordinator
_LOGGER = logging.getLogger(__name__)
CONFIG_SCHEMA = cv.removed(DOMAIN, raise_if_present=False)
SERVICE_SCHEMA = vol.Schema(
vol.Any(
{vol.Required(ATTR_VIN): cv.string},

View File

@@ -52,7 +52,7 @@ async def async_setup_entry(
for service in ENTITY_SERVICES:
platform.async_register_entity_service(
service,
{},
None,
f"async_{service}",
)

View File

@@ -7,7 +7,7 @@
"integration_type": "device",
"iot_class": "local_polling",
"loggers": ["pybravia"],
"requirements": ["pybravia==0.3.3"],
"requirements": ["pybravia==0.3.4"],
"ssdp": [
{
"st": "urn:schemas-sony-com:service:ScalarWebAPI:1",

View File

@@ -22,7 +22,6 @@ from homeassistant.components.todo import (
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
from homeassistant.helpers import config_validation as cv, entity_platform
from homeassistant.helpers.config_validation import make_entity_service_schema
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity
@@ -62,14 +61,12 @@ async def async_setup_entry(
platform.async_register_entity_service(
SERVICE_PUSH_NOTIFICATION,
make_entity_service_schema(
{
vol.Required(ATTR_NOTIFICATION_TYPE): vol.All(
vol.Upper, cv.enum(BringNotificationType)
),
vol.Optional(ATTR_ITEM_NAME): cv.string,
}
),
{
vol.Required(ATTR_NOTIFICATION_TYPE): vol.All(
vol.Upper, cv.enum(BringNotificationType)
),
vol.Optional(ATTR_ITEM_NAME): cv.string,
},
"async_send_message",
)

View File

@@ -9,7 +9,7 @@
"iot_class": "local_polling",
"loggers": ["brother", "pyasn1", "pysmi", "pysnmp"],
"quality_scale": "platinum",
"requirements": ["brother==4.2.0"],
"requirements": ["brother==4.3.0"],
"zeroconf": [
{
"type": "_printer._tcp.local.",

View File

@@ -2,7 +2,7 @@
import dataclasses
from bsblan import BSBLAN, Device, Info, StaticState
from bsblan import BSBLAN, BSBLANConfig, Device, Info, StaticState
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
@@ -35,22 +35,28 @@ class HomeAssistantBSBLANData:
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up BSB-Lan from a config entry."""
session = async_get_clientsession(hass)
bsblan = BSBLAN(
entry.data[CONF_HOST],
# create config using BSBLANConfig
config = BSBLANConfig(
host=entry.data[CONF_HOST],
passkey=entry.data[CONF_PASSKEY],
port=entry.data[CONF_PORT],
username=entry.data.get(CONF_USERNAME),
password=entry.data.get(CONF_PASSWORD),
session=session,
)
# create BSBLAN client
session = async_get_clientsession(hass)
bsblan = BSBLAN(config, session)
# Create and perform first refresh of the coordinator
coordinator = BSBLanUpdateCoordinator(hass, entry, bsblan)
await coordinator.async_config_entry_first_refresh()
# Fetch all required data concurrently
device = await bsblan.device()
info = await bsblan.info()
static = await bsblan.static_values()
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = HomeAssistantBSBLANData(
client=bsblan,
coordinator=coordinator,

View File

@@ -103,7 +103,7 @@ class BSBLANClimate(
self._attr_min_temp = float(static.min_temp.value)
self._attr_max_temp = float(static.max_temp.value)
# check if self.coordinator.data.current_temperature.unit is "&deg;C" or "°C"
if self.coordinator.data.current_temperature.unit in ("&deg;C", "°C"):
if static.min_temp.unit in ("&deg;C", "°C"):
self._attr_temperature_unit = UnitOfTemperature.CELSIUS
else:
self._attr_temperature_unit = UnitOfTemperature.FAHRENHEIT

View File

@@ -4,7 +4,7 @@ from __future__ import annotations
from typing import Any
from bsblan import BSBLAN, BSBLANError
from bsblan import BSBLAN, BSBLANConfig, BSBLANError
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
@@ -80,15 +80,15 @@ class BSBLANFlowHandler(ConfigFlow, domain=DOMAIN):
async def _get_bsblan_info(self, raise_on_progress: bool = True) -> None:
"""Get device information from an BSBLAN device."""
session = async_get_clientsession(self.hass)
bsblan = BSBLAN(
config = BSBLANConfig(
host=self.host,
username=self.username,
password=self.password,
passkey=self.passkey,
port=self.port,
session=session,
username=self.username,
password=self.password,
)
session = async_get_clientsession(self.hass)
bsblan = BSBLAN(config, session)
device = await bsblan.device()
self.mac = device.MAC

View File

@@ -21,6 +21,4 @@ ATTR_OUTSIDE_TEMPERATURE: Final = "outside_temperature"
CONF_PASSKEY: Final = "passkey"
CONF_DEVICE_IDENT: Final = "RVS21.831F/127"
DEFAULT_PORT: Final = 80

View File

@@ -17,7 +17,7 @@ async def async_get_config_entry_diagnostics(
"""Return diagnostics for a config entry."""
data: HomeAssistantBSBLANData = hass.data[DOMAIN][entry.entry_id]
return {
"info": data.info.dict(),
"device": data.device.dict(),
"state": data.coordinator.data.dict(),
"info": data.info.to_dict(),
"device": data.device.to_dict(),
"state": data.coordinator.data.to_dict(),
}

View File

@@ -7,5 +7,5 @@
"integration_type": "device",
"iot_class": "local_polling",
"loggers": ["bsblan"],
"requirements": ["python-bsblan==0.5.18"]
"requirements": ["python-bsblan==0.6.2"]
}

View File

@@ -51,7 +51,7 @@ def _create_device(data):
return _Device(ip_address, mac, host, status, name)
_Device = namedtuple("_Device", ["ip_address", "mac", "host", "status", "name"])
_Device = namedtuple("_Device", ["ip_address", "mac", "host", "status", "name"]) # noqa: PYI024
class BTSmartHubScanner(DeviceScanner):

View File

@@ -54,7 +54,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
component.async_register_entity_service(
SERVICE_PRESS,
{},
None,
"_async_press_action",
)

View File

@@ -431,13 +431,13 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, unsub_track_time_interval)
component.async_register_entity_service(
SERVICE_ENABLE_MOTION, {}, "async_enable_motion_detection"
SERVICE_ENABLE_MOTION, None, "async_enable_motion_detection"
)
component.async_register_entity_service(
SERVICE_DISABLE_MOTION, {}, "async_disable_motion_detection"
SERVICE_DISABLE_MOTION, None, "async_disable_motion_detection"
)
component.async_register_entity_service(SERVICE_TURN_OFF, {}, "async_turn_off")
component.async_register_entity_service(SERVICE_TURN_ON, {}, "async_turn_on")
component.async_register_entity_service(SERVICE_TURN_OFF, None, "async_turn_off")
component.async_register_entity_service(SERVICE_TURN_ON, None, "async_turn_on")
component.async_register_entity_service(
SERVICE_SNAPSHOT, CAMERA_SERVICE_SNAPSHOT, async_handle_snapshot_service
)
@@ -862,7 +862,7 @@ class CameraMjpegStream(CameraView):
# Compose camera stream from stills
interval = float(interval_str)
if interval < MIN_STREAM_INTERVAL:
raise ValueError(f"Stream interval must be > {MIN_STREAM_INTERVAL}")
raise ValueError(f"Stream interval must be > {MIN_STREAM_INTERVAL}") # noqa: TRY301
return await camera.handle_async_still_stream(request, interval)
except ValueError as err:
raise web.HTTPBadRequest from err
@@ -992,7 +992,6 @@ async def async_handle_snapshot_service(
"""Handle snapshot services calls."""
hass = camera.hass
filename: Template = service_call.data[ATTR_FILENAME]
filename.hass = hass
snapshot_file = filename.async_render(variables={ATTR_ENTITY_ID: camera})
@@ -1069,9 +1068,7 @@ async def async_handle_record_service(
if not stream:
raise HomeAssistantError(f"{camera.entity_id} does not support record service")
hass = camera.hass
filename = service_call.data[CONF_FILENAME]
filename.hass = hass
video_path = filename.async_render(variables={ATTR_ENTITY_ID: camera})
await stream.async_record(

View File

@@ -11,7 +11,7 @@ from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import config_validation as cv, device_registry as dr
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.integration_platform import (
async_process_integration_platforms,
)
@@ -19,7 +19,6 @@ from homeassistant.helpers.integration_platform import (
from . import home_assistant_cast
from .const import DOMAIN
CONFIG_SCHEMA = cv.removed(DOMAIN, raise_if_present=False)
PLATFORMS = [Platform.MEDIA_PLAYER]

View File

@@ -17,7 +17,7 @@ from homeassistant.core import Event, HomeAssistant
_LOGGER = logging.getLogger(__name__)
PLATFORMS: list[Platform] = [Platform.COVER]
PLATFORMS: list[Platform] = [Platform.COVER, Platform.SWITCH]
@dataclass

View File

@@ -51,3 +51,11 @@ class ChaconDioEntity(Entity):
_LOGGER.debug("Data received from server %s", data)
self._update_attr(data)
self.async_write_ha_state()
async def async_update(self) -> None:
"""Update the state when the entity is requested to."""
_LOGGER.debug("Update called for %s, %s", self, self.target_id)
data = await self.client.get_status_details([self.target_id])
_LOGGER.debug("Received data from server %s", data)
self._update_attr(data[self.target_id])

View File

@@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/chacon_dio",
"iot_class": "cloud_push",
"loggers": ["dio_chacon_api"],
"requirements": ["dio-chacon-wifi-api==1.1.0"]
"requirements": ["dio-chacon-wifi-api==1.2.1"]
}

View File

@@ -0,0 +1,74 @@
"""Switch Platform for Chacon Dio REV-LIGHT and switch plug devices."""
import logging
from typing import Any
from dio_chacon_wifi_api.const import DeviceTypeEnum
from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import ChaconDioConfigEntry
from .entity import ChaconDioEntity
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(
hass: HomeAssistant,
config_entry: ChaconDioConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up Chacon Dio switch devices."""
data = config_entry.runtime_data
client = data.client
async_add_entities(
ChaconDioSwitch(client, device)
for device in data.list_devices
if device["type"]
in (DeviceTypeEnum.SWITCH_LIGHT.value, DeviceTypeEnum.SWITCH_PLUG.value)
)
class ChaconDioSwitch(ChaconDioEntity, SwitchEntity):
"""Object for controlling a Chacon Dio switch."""
_attr_device_class = SwitchDeviceClass.SWITCH
_attr_name = None
def _update_attr(self, data: dict[str, Any]) -> None:
"""Recomputes the attributes values either at init or when the device state changes."""
self._attr_available = data["connected"]
self._attr_is_on = data["is_on"]
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on the switch.
Turned on status is effective after the server callback that triggers callback_device_state.
"""
_LOGGER.debug(
"Turn on the switch %s , %s, %s",
self.target_id,
self.entity_id,
self._attr_is_on,
)
await self.client.switch_switch(self.target_id, True)
async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn off the switch.
Turned on status is effective after the server callback that triggers callback_device_state.
"""
_LOGGER.debug(
"Turn off the switch %s , %s, %s",
self.target_id,
self.entity_id,
self._attr_is_on,
)
await self.client.switch_switch(self.target_id, False)

View File

@@ -49,12 +49,12 @@ async def async_setup_platform(
platform.async_register_entity_service(
SERVICE_SEEK_FORWARD,
{},
None,
"seek_forward",
)
platform.async_register_entity_service(
SERVICE_SEEK_BACKWARD,
{},
None,
"seek_backward",
)
platform.async_register_entity_service(

View File

@@ -156,19 +156,19 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
component.async_register_entity_service(
SERVICE_TURN_ON,
{},
None,
"async_turn_on",
[ClimateEntityFeature.TURN_ON],
)
component.async_register_entity_service(
SERVICE_TURN_OFF,
{},
None,
"async_turn_off",
[ClimateEntityFeature.TURN_OFF],
)
component.async_register_entity_service(
SERVICE_TOGGLE,
{},
None,
"async_toggle",
[ClimateEntityFeature.TURN_OFF, ClimateEntityFeature.TURN_ON],
)

View File

@@ -18,7 +18,6 @@ from homeassistant.exceptions import (
HomeAssistantError,
)
from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.event import async_track_time_interval
from homeassistant.util.location import async_detect_location_info
from homeassistant.util.network import is_ipv4_address
@@ -27,8 +26,6 @@ from .const import CONF_RECORDS, DEFAULT_UPDATE_INTERVAL, DOMAIN, SERVICE_UPDATE
_LOGGER = logging.getLogger(__name__)
CONFIG_SCHEMA = cv.removed(DOMAIN, raise_if_present=False)
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Cloudflare from a config entry."""

View File

@@ -5,18 +5,35 @@ from __future__ import annotations
from datetime import timedelta
import logging
from coinbase.wallet.client import Client
from coinbase.rest import RESTClient
from coinbase.rest.rest_base import HTTPError
from coinbase.wallet.client import Client as LegacyClient
from coinbase.wallet.error import AuthenticationError
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_API_KEY, CONF_API_TOKEN, Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv, entity_registry as er
from homeassistant.helpers import entity_registry as er
from homeassistant.util import Throttle
from .const import (
ACCOUNT_IS_VAULT,
API_ACCOUNT_AMOUNT,
API_ACCOUNT_AVALIABLE,
API_ACCOUNT_BALANCE,
API_ACCOUNT_CURRENCY,
API_ACCOUNT_CURRENCY_CODE,
API_ACCOUNT_HOLD,
API_ACCOUNT_ID,
API_ACCOUNTS_DATA,
API_ACCOUNT_NAME,
API_ACCOUNT_VALUE,
API_ACCOUNTS,
API_DATA,
API_RATES_CURRENCY,
API_RESOURCE_TYPE,
API_TYPE_VAULT,
API_V3_ACCOUNT_ID,
API_V3_TYPE_VAULT,
CONF_CURRENCIES,
CONF_EXCHANGE_BASE,
CONF_EXCHANGE_RATES,
@@ -29,9 +46,6 @@ PLATFORMS = [Platform.SENSOR]
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=1)
CONFIG_SCHEMA = cv.removed(DOMAIN, raise_if_present=False)
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Coinbase from a config entry."""
@@ -59,9 +73,16 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
def create_and_update_instance(entry: ConfigEntry) -> CoinbaseData:
"""Create and update a Coinbase Data instance."""
client = Client(entry.data[CONF_API_KEY], entry.data[CONF_API_TOKEN])
if "organizations" not in entry.data[CONF_API_KEY]:
client = LegacyClient(entry.data[CONF_API_KEY], entry.data[CONF_API_TOKEN])
version = "v2"
else:
client = RESTClient(
api_key=entry.data[CONF_API_KEY], api_secret=entry.data[CONF_API_TOKEN]
)
version = "v3"
base_rate = entry.options.get(CONF_EXCHANGE_BASE, "USD")
instance = CoinbaseData(client, base_rate)
instance = CoinbaseData(client, base_rate, version)
instance.update()
return instance
@@ -86,42 +107,83 @@ async def update_listener(hass: HomeAssistant, config_entry: ConfigEntry) -> Non
registry.async_remove(entity.entity_id)
def get_accounts(client):
def get_accounts(client, version):
"""Handle paginated accounts."""
response = client.get_accounts()
accounts = response[API_ACCOUNTS_DATA]
next_starting_after = response.pagination.next_starting_after
while next_starting_after:
response = client.get_accounts(starting_after=next_starting_after)
accounts += response[API_ACCOUNTS_DATA]
if version == "v2":
accounts = response[API_DATA]
next_starting_after = response.pagination.next_starting_after
return accounts
while next_starting_after:
response = client.get_accounts(starting_after=next_starting_after)
accounts += response[API_DATA]
next_starting_after = response.pagination.next_starting_after
return [
{
API_ACCOUNT_ID: account[API_ACCOUNT_ID],
API_ACCOUNT_NAME: account[API_ACCOUNT_NAME],
API_ACCOUNT_CURRENCY: account[API_ACCOUNT_CURRENCY][
API_ACCOUNT_CURRENCY_CODE
],
API_ACCOUNT_AMOUNT: account[API_ACCOUNT_BALANCE][API_ACCOUNT_AMOUNT],
ACCOUNT_IS_VAULT: account[API_RESOURCE_TYPE] == API_TYPE_VAULT,
}
for account in accounts
]
accounts = response[API_ACCOUNTS]
while response["has_next"]:
response = client.get_accounts(cursor=response["cursor"])
accounts += response["accounts"]
return [
{
API_ACCOUNT_ID: account[API_V3_ACCOUNT_ID],
API_ACCOUNT_NAME: account[API_ACCOUNT_NAME],
API_ACCOUNT_CURRENCY: account[API_ACCOUNT_CURRENCY],
API_ACCOUNT_AMOUNT: account[API_ACCOUNT_AVALIABLE][API_ACCOUNT_VALUE]
+ account[API_ACCOUNT_HOLD][API_ACCOUNT_VALUE],
ACCOUNT_IS_VAULT: account[API_RESOURCE_TYPE] == API_V3_TYPE_VAULT,
}
for account in accounts
]
class CoinbaseData:
"""Get the latest data and update the states."""
def __init__(self, client, exchange_base):
def __init__(self, client, exchange_base, version):
"""Init the coinbase data object."""
self.client = client
self.accounts = None
self.exchange_base = exchange_base
self.exchange_rates = None
self.user_id = self.client.get_current_user()[API_ACCOUNT_ID]
if version == "v2":
self.user_id = self.client.get_current_user()[API_ACCOUNT_ID]
else:
self.user_id = (
"v3_" + client.get_portfolios()["portfolios"][0][API_V3_ACCOUNT_ID]
)
self.api_version = version
@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
"""Get the latest data from coinbase."""
try:
self.accounts = get_accounts(self.client)
self.exchange_rates = self.client.get_exchange_rates(
currency=self.exchange_base
)
except AuthenticationError as coinbase_error:
self.accounts = get_accounts(self.client, self.api_version)
if self.api_version == "v2":
self.exchange_rates = self.client.get_exchange_rates(
currency=self.exchange_base
)
else:
self.exchange_rates = self.client.get(
"/v2/exchange-rates",
params={API_RATES_CURRENCY: self.exchange_base},
)[API_DATA]
except (AuthenticationError, HTTPError) as coinbase_error:
_LOGGER.error(
"Authentication error connecting to coinbase: %s", coinbase_error
)

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