Commit Graph

183 Commits

Author SHA1 Message Date
Erik Montnemery
48091e5995 Improve test of WS command get_services (#150901)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-19 17:47:12 +02:00
Artur Pragacz
06130219b4 Use relative condition keys (#150021) 2025-08-06 17:20:30 +01:00
Artur Pragacz
53c9c42148 Use relative trigger keys (#149846) 2025-08-04 23:01:40 +01:00
Erik Montnemery
510fd09163 Allow core integrations to describe their conditions (#147529)
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
2025-07-04 16:03:42 +02:00
Erik Montnemery
1fb587bf03 Allow core integrations to describe their triggers (#147075)
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
2025-06-25 17:35:15 +01:00
Erik Montnemery
2bfb09cb11 Improve test of WS command get_services cache handling (#147134) 2025-06-23 13:29:29 +02:00
Martin Hjelmare
f295d72cd9 Fix error stack trace for HomeAssistantError in websocket service call (#145699)
* Add test

* Fix error stack trace for HomeAssistantError in websocket service call
2025-05-27 12:54:57 +02:00
Erik Montnemery
0128d85999 Move sun conditions to the sun integration (#144742) 2025-05-12 23:03:37 +01:00
Marc Mueller
5843e63878 Add contextmanager to reset logger after set_level call in tests (#143295) 2025-04-20 02:13:01 +02:00
Erik Montnemery
0105332476 Add WS command integration/wait (#142040)
* Add WS command integration/wait

* Add test

* Update homeassistant/components/websocket_api/commands.py

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

* Use helper setup.async_wait_component

* Add onboarding view

* Revert "Add onboarding view"

This reverts commit df3a1a0580.

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2025-04-11 16:09:15 +02:00
J. Nick Koston
0abe57edaa Avoid checking if debug logging is enabled on every WebSocket message (#142258)
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2025-04-04 22:28:55 +02:00
Erik Montnemery
2427b77363 Use send_json_auto_id in websocket_api tests (#141994) 2025-04-01 14:31:49 +02:00
J. Nick Koston
fd9f002e9f Increase websocket_api allowed peak time to 10s (#141680)
* Increase websocket_api allowed peak time to 10s

fixes #141624

During integration reload or startup, we can end up sending a message for
each entity being created for integrations that create them from an external
source (ie MQTT) because the messages come in one at a time. This can overload
the loop and/or client for more than 5s. While we have done significant work
to optimize for this path, we are at the limit at what we can expect clients
to be able to process in the time window, so increase the time window.

* adjust test
2025-03-28 20:32:00 +01:00
Erik Montnemery
51c09c2aa4 Add test fixture ignore_translations_for_mock_domains (#139235)
* Add test fixture ignore_translations_for_mock_domains

* Fix fixture

* Avoid unnecessary attempt to get integration

* Really fix fixture

* Add forgotten parameter

* Address review comment
2025-02-25 20:10:29 +01:00
Erik Montnemery
b662d32e44 Fix bug in check_translations fixture (#139206)
* Fix bug in check_translations fixture

* Fix check for ignored translation errors

* Fix websocket_api test
2025-02-24 22:19:18 +01:00
Abílio Costa
3fb70316da Fix error messaging for cascading service calls (#136966) 2025-01-31 11:10:57 +01:00
J. Nick Koston
7cf20c95c2 Log the error when the WebSocket receives a error message (#136492)
* Log the error when the WebSocket receives a non-text message

related issue #126754

Right now we only log that it was a non-Text message
and silently swallow the exception

* coverage
2025-01-27 15:38:18 -05:00
epenet
2b939ce6ec Add translation checks for service exceptions (#131266)
* Add translation checks for service exceptions

* Adjust

* Remove invalid comment
2024-11-27 08:46:45 +01:00
J. Nick Koston
53c486ccd1 Bump aiohttp to 3.11.0b3 (#129363) 2024-11-06 15:59:31 -06:00
Joost Lekkerkerker
33d83e43de Update trigger validation message (#126749) 2024-09-25 15:33:03 +02:00
Franck Nijhof
9dfabc3fb7 Adjust automation to plural triggers/conditions/actions keys (#123823)
* Adjust automation to plural triggers/conditions/actions keys

* Fix some tests

* Adjust websocket tests

* Fix search tests

* Convert blueprint and blueprint inputs to modern schema

* Pass schema when creating Blueprint object

* Update tests

* Adjust websocket api

---------

Co-authored-by: Joostlek <joostlek@outlook.com>
Co-authored-by: Erik <erik@montnemery.com>
2024-09-24 20:03:23 +02:00
J. Nick Koston
d8161c431f Add support for using an entityfilter to subscribe_entities (#124641)
* Add support for using an entityfilter to subscribe_entities

* filter init

* fix

* coverage
2024-08-27 11:17:05 +02:00
epenet
c2dc4ef215 Add missing hass type hint in component tests (w) (#124284) 2024-08-20 12:54:42 +02:00
J. Nick Koston
108a54a4a8 Handle WebSocket client disconnect during prepare (#124173) 2024-08-19 15:28:05 -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
epenet
e33a7ecefa Improve type hints in websocket_api tests (#123922) 2024-08-14 15:54:00 +02:00
epenet
7b08e625b4 Fix implicit-return in websocket_api tests (#122779) 2024-07-29 22:14:41 +02:00
J. Nick Koston
1879db9f8f Revert to using call_soon for event triggers and state changed event trackers (#122735) 2024-07-29 11:45:39 +02:00
J. Nick Koston
6bdc5be433 Bump aiohttp to 3.10.0b1 (#122409) 2024-07-23 12:10:22 -05:00
Marc Mueller
a6068dcdf2 Update import locations in tests (#122216) 2024-07-20 11:16:04 +02:00
Joost Lekkerkerker
b56c4a757c Bump ruff to 0.5.0 (#120749) 2024-06-28 15:23:21 +02:00
G Johansson
9c5879656c Remove legacy list event calendar service (#118663) 2024-06-21 11:18:51 +02:00
Robert Resch
bae008b0e2 Remove legacy_api_password auth provider (#119976) 2024-06-19 22:46:30 +02:00
J. Nick Koston
f9205cd88d Avoid additional timestamp conversion to set state (#118885)
Avoid addtional timestamp conversion to set state

Since we already have the timestamp, we can pass it on to the State
object and avoid the additional timestamp conversion which can be as
much as 30% of the state write runtime.

Since datetime objects are limited to microsecond precision, we need
to adjust some tests to account for the additional precision that we
will now be able to get in the database
2024-06-05 23:43:34 -04:00
Erik Montnemery
8099ea8817 Improve WS command validate_config (#118864)
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
Co-authored-by: Robert Resch <robert@resch.dev>
2024-06-05 18:53:44 +02:00
epenet
461ac1e0bc Add ClientSessionGenerator type hints in tests (#118377) 2024-05-29 14:49:14 +02:00
J. Nick Koston
79bc179ce8 Improve websocket message coalescing to handle thundering herds better (#118268)
* Increase websocket peak messages to match max expected entities

During startup the websocket would frequently disconnect if more than
4096 entities were added back to back. Some MQTT setups will have more
than 10000 entities. Match the websocket peak value to the max expected
entities

* coalesce more

* delay more if the backlog gets large

* wait to send if the queue is building rapidly

* tweak

* tweak for chrome since it works great in firefox but chrome cannot handle it

* Revert "tweak for chrome since it works great in firefox but chrome cannot handle it"

This reverts commit 439e2d76b1.

* adjust for chrome

* lower number

* remove code

* fixes

* fast path for bytes

* compact

* adjust test since we see the close right away now on overload

* simplify check

* reduce loop

* tweak

* handle ready right away
2024-05-28 23:14:06 -04:00
J. Nick Koston
9995207817 Avoid re-encoding the message id as bytes for every event/state change (#116460) 2024-04-30 12:02:28 -05:00
J. Nick Koston
588c260dc5 Skip processing websocket_api schema if it has no arguments (#115618)
* Skip processing websocket_api schema if has no arguments

About 40% of the websocket commands on first connection have
no arguments. We can skip processing the schema for these cases

* cover

* fixes

* allow extra

* Revert "allow extra"

This reverts commit 85d9ec36b3.

* match behavior
2024-04-18 10:41:08 -04:00
Jan Bouwhuis
3299bc5ddc Translate service validation errors (#115024)
* Move service validation error message to translation cache

* Fix test

* Revert unrelated change

* Address review comments

* Improve error message

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-04-18 14:36:03 +02:00
Robert Resch
348e1df949 Add strict connection (#112387)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-04-12 14:47:46 +02:00
J. Nick Koston
137514edb7 Bump aiohttp to 3.9.4 (#110730)
* Bump aiohttp to 3.9.4

This is rc0 for now but will be updated when the full release it out

* cleanup cruft

* regen

* fix tests (these changes are fine)

* chunk size is too small to read since boundry is now enforced

* chunk size is too small to read since boundry is now enforced
2024-04-11 11:58:56 -10:00
epenet
9204ccfa17 Use is in ConfigEntryState enum comparison in tests (N-Z) (#114926) 2024-04-05 17:37:00 +02: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
Sid
00ec7f11f0 Enable Ruff rule PT007 (#113764)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2024-03-19 09:01:07 +01:00
J. Nick Koston
c615b52840 Refactor integration startup time to show wall clock time (#113707)
* Refactor setup time tracking to exclude time waiting on other operations

We now exclude the import time and th time waiting on
base platforms to setup from the setup times

* tweak

* tweak

* tweak

* tweak

* adjust

* fixes

* fixes

* preen

* preen

* tweak

* tweak

* adjust

* tweak

* reduce

* do not count integrtion platforms against their parent integration

* handle legacy tts platforms

* stt as well

* one more wait

* use the same pattern in all the legacy

* fix tts and stt legacy

* fix

* fix

* reduce

* preen

* entity comp does not wait for platforms

* scene blocks as well

* fix test

* test fixes

* coverage

* coverage

* coverage

* fix test

* Update tests/test_setup.py

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

* Update tests/test_setup.py

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

* Update homeassistant/setup.py

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

* strip

* strip WAIT_PLATFORM_INTEGRATION

* strip WAIT_PLATFORM_INTEGRATION

* strip WAIT_PLATFORM_INTEGRATION

* strip WAIT_PLATFORM_INTEGRATION

* remove complexity

* Apply suggestions from code review

* no longer works that way

* fixes

* fixes

* fixes

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-03-18 21:45:34 -04:00
Sid
82a60fe8ad Enable Ruff RSE (#113695) 2024-03-18 00:40:38 +01:00
Joost Lekkerkerker
49fc59548a Improve lists in integrations [V-W] (#113252) 2024-03-13 19:38:04 +01:00
Marc Mueller
32f3f46542 Add empty line after module docstring (2) [tests.components] (#112737) 2024-03-08 19:16:21 +01:00
Marc Mueller
87165c0d6e Add empty line after module docstring [tests t-z] (#112712) 2024-03-08 14:44:56 +01:00