Commit graph

919 commits

Author SHA1 Message Date
Marc Mueller
dd22ee3dac
Improve annotation styling (#118032) 2024-05-24 15:05:53 +02:00
Sid
c2b3bf3fb9
Enable Ruff RET502 (#115139) 2024-05-21 22:19:33 +02:00
Marc Mueller
bc2ee96cae
Remove quotes surrounding annotations (#117817) 2024-05-20 22:06:58 +02:00
J. Nick Koston
5a609c34bb
Fix blocking I/O in the event loop when loading timezones (#117721) 2024-05-20 11:06:03 +02:00
Marc Mueller
eedce95bc9
Use PEP 695 for class annotations (2) (#117776) 2024-05-20 10:43:59 +02:00
Marc Mueller
26a599ad11
Use PEP 695 for function annotations (1) (#117658) 2024-05-18 11:45:54 +02:00
Marc Mueller
907b9c42e5
Use PEP 695 for decorator typing with type aliases (2) (#117663) 2024-05-18 11:41:46 +02:00
dfaour
6f5e820090
Improve recorder statistics error messages (#113498)
* Update statistics.py

Added more detail error descriptions to make debugging easier

* Update statistics.py

formatting corrected
2024-05-16 13:44:03 +02:00
J. Nick Koston
3f053eddbd
Add websocket API to get list of recorded entities (#92640)
* Add API to get list of recorded entities

* update for latest codebase

* ruff

* Update homeassistant/components/recorder/websocket_api.py

* Update homeassistant/components/recorder/websocket_api.py

* Update homeassistant/components/recorder/websocket_api.py

* add suggested test
2024-05-15 08:41:56 +02:00
J. Nick Koston
d06932bbc2
Refactor asyncio loop protection to improve performance (#117295) 2024-05-13 07:01:55 +09:00
Sid
2cc916db6d
Replace pylint broad-except with Ruff BLE001 (#116250) 2024-05-07 14:00:27 +02:00
J. Nick Koston
fd52588565
Bump SQLAlchemy to 2.0.30 (#116964) 2024-05-07 10:42:13 +02:00
Sid
b456d97e65
Replace pylint protected-access with Ruff SLF001 (#115735) 2024-05-06 20:33:26 +02:00
J. Nick Koston
6339c63176
Improve recorder and worker thread matching in RecorderPool (#116886)
* Improve recorder and worker thread matching in RecorderPool

Previously we would look at the name of the threads. This
was a brittle if because other integrations may name their
thread Recorder or DbWorker. Instead we now use explict thread
ids which ensures there will never be a conflict

* fix

* fixes

* fixes
2024-05-05 16:25:10 -04:00
Patrick Decat
ac12d2a463
fix UnboundLocalError on modified_statistic_ids in compile_statistics (#116795)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-05-04 13:16:58 -05:00
karwosts
2ac44f6083
Make recorder.purge_entities require at least one entity filter value (#110066)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-04-22 20:10:18 +02:00
Sid
3799d20d43
Enable Ruff B905 (#114197) 2024-04-14 00:14:26 -05:00
Marc Mueller
2decf6c023
Use dict instead of MutableMapping [recorder] (#115318) 2024-04-09 15:08:31 -10:00
Marc Mueller
d4500cf945
Improve recorder event typing (#115253) 2024-04-08 14:56:18 -10:00
J. Nick Koston
ca5ed274cb
Deprecate calling async_listen and async_listen_once with run_immediately (#115169) 2024-04-08 10:07:54 -10:00
Sid
376aafc83e
Enable Ruff INP001 (#115082) 2024-04-08 15:43:58 +02:00
Marc Mueller
a0e6fd6ec5
Add improved typing for event fire and listen methods (#114906)
* Add EventType implementation

* Update integrations for EventType

* Change state_changed to EventType

* Fix tests

* Remove runtime impact

* Add tests

* Move to stub file

* Apply pre-commit to stub files

* Fix ruff PYI checks

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-04-07 13:28:24 -10:00
Sid
8e98ba7312
Add first batch of Ruff PYI rules (#115100)
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2024-04-07 11:30:50 -10:00
Marc Mueller
8f425b9ea7
Improve generic event typing [recorder] (#114736) 2024-04-06 21:35:42 +02: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
5447a1a015
Ensure all tables have the default table args in the db_schema (#114895) 2024-04-05 08:22:00 +02:00
Marc Mueller
816ce116bf
Remove unnecessary functools.cached_property backport (#114239) 2024-04-04 11:24:26 +02:00
J. Nick Koston
5038a035bd
Detect blocking module imports in the event loop (#114488) 2024-03-30 19:51:31 -10:00
Sid
6587ee20db
Enable Ruff TRY300 (#114437)
* Enable Ruff TRY300

* Update validation.py

* Address review comments
2024-03-30 10:37:59 +01:00
Sid
a5b609f081
Enable ruff TRY401 (#114395)
* Enable ruff TRY401

* fix tests
2024-03-29 07:20:36 +01:00
Erik Montnemery
4d7a434254
Don't access States.last_reported_ts before it's added (#114333) 2024-03-28 00:44:01 +01:00
Erik Montnemery
a3059fe504
Record state.last_reported (#114201)
* Record state.last_reported

* Include last_reported in parts of the history API

* Use a bulk update

* fix refactoring error

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-27 12:48:06 +01:00
J. Nick Koston
d8acd90370
Run recorder shutdown tasks eagerly (#113018) 2024-03-26 22:25:45 -10:00
J. Nick Koston
345fa75562
Bump SQLAlchemy to 2.0.29 (#114208) 2024-03-25 14:39:16 -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
J. Nick Koston
de62b7774f
Reduce sqlalchemy reflection overhead at recorder setup time (#113989) 2024-03-23 11:25:05 +01:00
J. Nick Koston
952f47ab18
Combine recorder and frontend bootstrap step (#113985) 2024-03-22 13:50:39 -10:00
J. Nick Koston
68e170284f
Speed up recorder startup by making schema query read only (#113987) 2024-03-22 18:29:46 +01:00
Erik Montnemery
426f73b1f4
Add State.last_reported (#113511)
* Add State.last_reported

* Update tests

* Update test snapshots

* Call state_reported listeners when firing state_changed event

* Add tests
2024-03-20 21:05:07 +01:00
Erik Montnemery
d31124d5d4
Avoid creating unneeded Context and Event objects when firing events (#113798)
* Avoid creating unneeded Context and Event objects when firing events

* Add test

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-20 09:40:06 +01:00
J. Nick Koston
06f356a038
Avoid expensive db queries at startup to check if data is migrated (#113773) 2024-03-19 15:27:40 -10: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
d5fd005db8
Add ruff rule PIE808 (#113621) 2024-03-17 09:56:26 +01:00
Sid
6ee273a548
Clean up unneeded ruff noqa directives (#113616) 2024-03-16 09:48:37 -10:00
Erik Montnemery
397bde4652
Add missing continue in legacy recorder history function (#113535)
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2024-03-15 21:20:39 +01:00
Joost Lekkerkerker
374695bfa6
Add service icons to Recorder (#113344) 2024-03-14 11:41:43 +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
Joost Lekkerkerker
77917506bb
Improve lists in integrations [R-S] (#113233)
* Improve lists in integrations [R-S]

* Fix

* Fix
2024-03-13 21:55:00 +01:00
J. Nick Koston
af6f2a516e
Guard against db corruption when renaming entities (#112718) 2024-03-08 11:34:07 -10:00
Marc Mueller
aa16a9d707
Add empty line after module docstring (3) (#112750) 2024-03-08 20:38:34 +01:00