1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-21 19:39:06 +00:00
Commit Graph

1993 Commits

Author SHA1 Message Date
Marc Mueller
8324fd5d1d Deprecated old backports and typing aliases (#114883) 2024-04-06 13:15:30 -10:00
Sid
0d66d298ec Enable Ruff RET504 (#114528)
* Enable Ruff RET504

* fix test

* Use noqa instead of cast

* fix sonos RET504

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-04-06 11:07:37 +02:00
J. Nick Koston
bfe944f666 Handle ambiguous script actions by using action map order (#114825) 2024-04-05 08:42:57 +02:00
Marc Mueller
0f03079065 Update import for EventStateChangedData [i-z] (#114900) 2024-04-04 11:48:29 -10:00
Erik Montnemery
7c95ecff20 Validate unique_id in entity registry (#114648)
Co-authored-by: Shay Levy <levyshay1@gmail.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-04-04 09:51:44 -10:00
J. Nick Koston
342e47dcc8 Ensure async_test_home_assistant is passed a str in storage tests (#114813) 2024-04-04 12:05:16 +02:00
Marc Mueller
816ce116bf Remove unnecessary functools.cached_property backport (#114239) 2024-04-04 11:24:26 +02:00
Robert Resch
7adced6876 Allow passing area/device/entity IDs to floor_id and floor_name (#114748) 2024-04-03 16:33:58 +02:00
Franck Nijhof
4a93b4a4b4 Add floor selector (#114614) 2024-04-02 10:43:14 +02:00
J. Nick Koston
5856bbc07b Add missing platforms_exist guard to check_config (#114600)
* Add missing platforms_exist guard to check_config

related issue #112811

When the exception hits, the config will end up being saved in the traceback
so the memory is never released.

This matches the check_config code to homeassistant.config to avoid having
the exception thrown.

* patch

* merge branch
2024-04-01 21:37:30 -04:00
Sid
d5f883fbf0 Unignore Ruff PLR in tests (#114470)
* Unignore Ruff PLR in tests

* Address review comments

* review comments

* fix import

* Update test_api.py

* Update test_api.py

* Update test_api.py
2024-04-01 11:11:59 +02:00
Michael Hansen
d23b22b566 Add initial support for floors to intents (#114456)
* Add initial support for floors to intents

* Fix climate intent

* More tests

* No return value

* Add requested changes

* Reuse event handler
2024-03-30 16:59:20 -04:00
J. Nick Koston
f4922edb4b Fix empty delays in script helper (#114346)
fixes
```
Logger: homeassistant.components.automation.kamermaster_knop_4_acties_licht
Bron: components/automation/__init__.py:726
integratie: Automatisering (documentatie, problemen)
Eerst voorgekomen: 22:17:29 (5 gebeurtenissen)
Laatst gelogd: 22:59:24

While executing automation automation.kamermaster_knop_4_acties_licht
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 726, in async_trigger
    return await self.action_script.async_run(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1645, in async_run
    return await asyncio.shield(create_eager_task(run.async_run()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 454, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 506, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 536, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 504, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 626, in _async_delay_step
    if timeout_future.done():
       ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'done'
```
2024-03-28 00:29:43 -04:00
Jan-Philipp Benecke
5c97049f2e Do not override state property in MockEntity (#114231)
Do not override state in `MockEntity`
2024-03-27 11:36:00 +01:00
Marc Mueller
1d2c2d2055 Move SignalTypes to util (#114236) 2024-03-27 08:41:44 +01:00
Franck Nijhof
9a32d1bbd5 Add label selector (#111029)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2024-03-26 20:31:06 +01:00
Franck Nijhof
c247534731 Default floor level to None (and allow unsetting it) (#114249) 2024-03-26 18:58:25 +01:00
Marc Mueller
eb81a4204e Allow string formatting for dispatcher SignalType (#114174) 2024-03-26 10:38:29 +01:00
Franck Nijhof
5c69e0d2c6 Add label template functions (#111024) 2024-03-26 10:32:29 +01:00
J. Nick Koston
54a69a2687 Remove async_get_device_class_lookup from entity_registry (#114212)
This function was only ever used in homekit, and since there is
now an index of devices in the entity registry, homekit no longer
uses it.

I searched github code for all references to async_get_device_class_lookup
and the only think I could find using it were forks of core. It seems
unlikely that any custom components are affected by removing this
function
2024-03-26 09:22:53 +01:00
J. Nick Koston
cabc4f797a Preload storage for integrations we know we are going to setup (#114192) 2024-03-25 15:49:54 -10:00
Joost Lekkerkerker
6bb4e7d62c Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
Marc Mueller
81c34ac952 Fix spelling [docstrings + comments] (#114168) 2024-03-25 11:33:00 +01:00
Jan Bouwhuis
67ab49b825 Fetch ServiceNotFound message from translation cache and fix super (#114084)
* Fetch ServiceNotFound message from translation cache and fix super

* Fix tests trace component

* Fix script errors
2024-03-24 07:41:13 -10:00
Marc Mueller
efc54971d3 Update empty line formatting after module docstring (#114040) 2024-03-23 00:27:57 +01:00
J. Nick Koston
b574220247 Refactor rate limit helper to track time in seconds (#113898)
* Refactor rate limit helper to track time in seconds

Currently we created datetime and timedelta objects to enforce the
rate limit. When the rate limit was being hit hard, this got expensive.

We now use floats everywhere instead as they are much cheaper which
is important when we are running up against a rate limit, which is
by definition a hot path

The rate limit helper is currently only used for templates and
we do not have any code in the code base that directly passes
in a rate limit so the impact to custom components is expected
to be negligible if any

* misesd two
2024-03-20 19:49:37 -04:00
J. Nick Koston
267fe3dc34 Fix system_info importing hassio in the event loop (#113903) 2024-03-20 12:06:40 -10:00
Franck Nijhof
fc6a83559f Add floor template functions (#110847) 2024-03-20 11:58:04 +01:00
Franck Nijhof
670bd97777 Find referenced labels in automations & scripts (#113812) 2024-03-19 16:28:37 +01:00
Franck Nijhof
38d0854b70 Find referenced floors in automations & scripts (#113802) 2024-03-19 14:18:53 +01:00
Sid
00ec7f11f0 Enable Ruff rule PT007 (#113764)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2024-03-19 09:01:07 +01:00
Franck Nijhof
167e66d45c Add labels to service target (#113753) 2024-03-18 22:32:23 +01:00
Sid
727581eea3 Add first batch of Ruff PT rules (#113665)
* Add first batch of Ruff PT rules

* fix weather test

* Fix pilight test

* Update test_intent.py

* Update pilight test_init.py

* Update test_init.py
2024-03-18 13:26:14 +01:00
Sid
82a60fe8ad Enable Ruff RSE (#113695) 2024-03-18 00:40:38 +01:00
Jan-Philipp Benecke
681705394d Remove deprecated hass.components from network helper function (#113615)
* Remove deprecated `hass.components` from network helper function

* Remove deprecated use of `hass.components` in alexa camera tests
2024-03-17 17:42:48 +01:00
Sid
27e844e3bf Add ruff B005, B015, B032 and fix occurrences (#113543)
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-15 17:48:37 -10:00
soonsouth
cfc2f17f35 Remove repetitive words in comments and docstrings (#113529)
chore: remove repetitive words

Signed-off-by: soonsouth <cuibuwei@163.com>
2024-03-15 18:11:12 +01:00
Franck Nijhof
0e2775667d Add category registry (#110897)
* Add category registry

* Add entity registry support

* Update homeassistant/components/config/entity_registry.py

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

* Use ulid instead

* Add tests for adding same name in different scopes

* Handle keyerror on update

* Lookup tweak

* Omit categories from entity registry snapshots

* Use base registry

* Update snapshots

* Update snapshots

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-03-15 13:25:16 +01:00
J. Nick Koston
bdede0e0da Start script runs eagerly (#113190) 2024-03-14 16:53:26 -10:00
J. Nick Koston
3528cc86d7 Fix delayed registry check to only using the short delay at running (#113471) 2024-03-14 15:11:09 -10:00
Franck Nijhof
2aadd643ed Add floors to service target (#110850) 2024-03-14 19:02:23 +01:00
Joost Lekkerkerker
05172d8e4d Improve loops and lists (#113269)
* Enable PERF

* Enable PERF rule

* Enable PERF rule

* Don't enable flag yet
2024-03-14 10:22:20 +01:00
J. Nick Koston
cfe14bca8f Add a helper to import modules from the event loop (#113169)
* Add a helper to import modules in the event loop

Replaces the one used for triggers with a more generic helper
that can be reused and uses a future to avoid importing concurrently

* Add a helper to import modules in the event loop

Replaces the one used for triggers with a more generic helper
that can be reused and uses a future to avoid importing concurrently

* coverage

* make sure we do not retry

* coverage
2024-03-14 00:26:33 -04:00
Jan-Philipp Benecke
3b1ab6436d Remove deprecated hass.components usage in service tests (#111883) 2024-03-12 17:27:44 +01:00
J. Nick Koston
120525e94f Add the ability to create Debouncer tasks as background tasks (#113128)
* Add the ability to Debouncer tasks in the background

This is a more general solution as a followup to
https://github.com/home-assistant/core/pull/112652#discussion_r1517159607

* Add the ability to Debouncer tasks in the background

This is a more general solution as a followup to
https://github.com/home-assistant/core/pull/112652#discussion_r1517159607

* fix
2024-03-12 08:41:12 -04:00
J. Nick Koston
3f72fae60b Migrate remaining call in check_config helper to use async_get_component (#113123) 2024-03-11 15:56:24 -10:00
J. Nick Koston
17b202d8cf Await discovery_function in the DiscoveryFlowHandler instead of wrapping it in a task (#113115)
Await discovery_function in the DiscoveryFlowHandler instead of wrapping

This function was always a coro so it can be awaited
directly instead of wrapping it in add_job
2024-03-11 21:37:03 -04:00
J. Nick Koston
324266a4e6 Fix race in script stop that could cause async_stop to hang forever (#113089) 2024-03-11 10:48:11 -10:00
Paulus Schoutsen
145657dc21 Only load services.yaml for integrations that have it (#112732)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-11 19:05:32 +01:00
Joost Lekkerkerker
cddce0ce0d Enable more SIM ruff rules (#113015)
* SIM101 SIM103

* SIM107 SIM109

* SIM110

* SIM112 SIM113

* SIM115

* SIM116

* Fix

* Fix

* Fix
2024-03-10 23:20:37 -04:00