Commit Graph

143 Commits (7cd4f787678b76bd0bc6c360321ed45a655dd2b5)

Author SHA1 Message Date
Joost Lekkerkerker c1781cd793
Only raise missing integration issue for config entry integrations (#126654) 2024-09-24 18:26:01 +02:00
epenet 6d212ea24e
Add helper functions for repair tests (#125886)
* Expose repairs constants and function for other components

* Reorder

* Use helper methods

* Adjust core_files

* Improve

* Update test_migrate.py
2024-09-14 03:31:44 +02:00
Tsvi Mostovicz f52f60307b
Implement time triggers with offset for timestamp sensors (#120858)
* Implement time triggers with offset for timestamp sensors

* Fix bad change

* Add testcase for multiple conf_at with offsets

* Fix fixture rename

* Fix testcase - if no offset provided, it should be just the string of the entity id

* Get test to pass

* Simplify code

* Update the messaging and make the offset optional allowing specifying only the entity_id

* Move state tracking one level up

* Implement requesteed changes
2024-09-11 19:33:00 +02:00
Jan Bouwhuis 0c18b2e7ff
Remove `is_on` function from `homeassistant.components` (#125104)
* Remove `is_on` method from `homeassistant.components`

* Cleanup test
2024-09-03 06:57:25 +02:00
Erik Montnemery 63d1cc10e2
Update homeassistant integration tests to async (#124117) 2024-08-17 12:11:32 -07:00
Joost Lekkerkerker e8d7eb05ae
Delete unused snapshots (#123656)
* Delete unused snapshots

* Delete unused snapshots
2024-08-12 13:28:09 +02:00
epenet 075550b7ba
Use HOMEASSISTANT_DOMAIN alias for core DOMAIN in tests (#122762) 2024-07-29 12:51:12 +02:00
Joost Lekkerkerker 3c14aa12ab
Add repair issue when trying to set up unknown integration (#121089)
* Add repair issue when trying to set up unknown integration

* Add repair issue when trying to set up unknown integration

* Add repair issue when trying to set up unknown integration

* Fix

* Update homeassistant/components/homeassistant/strings.json

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

* Update homeassistant/components/homeassistant/strings.json

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

* Update homeassistant/setup.py

* Fix

---------

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2024-07-06 15:02:58 +02:00
epenet c8bb64882e
Use service_calls fixture in homeassistant tests (#120922) 2024-07-01 17:26:41 +02:00
epenet 015bc0e172
Use HassKey in homeassistant integration (#120332) 2024-06-24 16:37:07 +02:00
Sid 721b2c2ca8
Enable Ruff PT012 (#113957) 2024-06-08 17:59:08 +02:00
epenet 089874f818
Move mock_hass_config fixture to decorator (#118807) 2024-06-04 16:05:56 +02:00
Michael Hansen 0257aa4839
Clean up exposed domains (#118753)
* Remove lock and script

* Add media player

* Fix tests
2024-06-03 21:26:40 -05:00
epenet 7e62061b9a
Improve typing for `calls` fixture in tests (a-l) (#118349)
* Improve typing for `calls` fixture in tests (a-l)

* More

* More
2024-05-29 09:06:48 +02:00
Sid 9bf87329da
Enable Ruff FLY002 rule (#115112)
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2024-04-12 09:04:16 +02: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
Sid d846676e84
Enable first batch of Ruff RET rules (#114480)
* Enable first batch of Ruff RET rules

* disable pylint rules
2024-03-31 11:30:59 +02:00
Erik Montnemery bac527f289
Don't allow listening to state_reported in event triggers (#114191)
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
2024-03-26 10:35:47 +01: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
J. Nick Koston bdede0e0da
Start script runs eagerly (#113190) 2024-03-14 16:53:26 -10:00
Jan-Philipp Benecke d4ae4a9cd0
Deprecate `homeassistant.components.is_on` function (#111891) 2024-03-13 17:21:00 +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 c88b337600
Add empty line after module docstring [tests f-k] (#112709) 2024-03-08 14:50:04 +01:00
J. Nick Koston 3fbeb7e400
Fix time trigger tests with leap year (#111785) 2024-02-28 14:51:27 -10:00
Marc Mueller 2ef2172b01
Convert test helpers to get hass instance to contextmanagers (#109990)
* Convert get_test_home_assistant helper to contextmanager

* Convert async_test_home_assistant helper to contextmanager

* Move timezone reset to async_test_home_assistant helper
2024-02-11 21:23:51 +01:00
J. Nick Koston 7c86ab14c3
Refactor service enumeration methods to better match existing use cases (#108671) 2024-01-22 14:21:17 -10:00
J. Nick Koston c399cab427
Small speed up to checking core state (#107845) 2024-01-18 08:41:32 -10:00
Jan-Philipp Benecke a7845406a5
Migrate homeassistant component tests to use freezegun (#105333) 2023-12-08 21:18:09 +01:00
Tudor Sandu 837f34c40c
Add scene.delete service for dynamically created scenes (with scene.create) (#89090)
* Added scene.delete service

Only for scenes created with scene.create

* Refactor after #95984 #96390

* Split scene validation in 2

First, check if entity_id is a scene
Second, check if it's a scene created with `scene.create`

* Address feedback

- Move service to `homeassistant` domain
- Register with `platform.async_register_entity_service`
- Raise validation errors instead of just logging messages

* Revert moving the service to the `homeassistant` domain

* Remove unneeded validation

* Use helpers and fix tests

* Apply suggestions from code review

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

* Fix linting

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-11-25 20:14:48 +01:00
Jan-Philipp Benecke eda475fe25
Update h* tests to use entity & device registry fixtures (#103866)
* Update h* tests to use entity & device registry fixtures

* Add missed lines
2023-11-12 13:52:32 -05:00
Erik Montnemery 97cc05d0b4
Make it possible to restart core in safe mode (#102606) 2023-10-24 14:47:58 +02:00
Erik Montnemery 7a009ed6cd
Don't duplicate core services in hassio (#102593) 2023-10-23 20:26:56 +02:00
Jan Rieger ee65aa91e8
Allow setting the elevation in `set_location` (#99978)
Co-authored-by: G Johansson <goran.johansson@shiftit.se>
2023-09-13 18:09:12 +02:00
J. Nick Koston 0da94c20b0
Significantly reduce overhead to filter event triggers (#99376)
* fast

* cleanups

* cleanups

* cleanups

* comment

* comment

* add more cover

* comment

* pull more examples from forums to validate cover
2023-08-31 13:47:01 -04:00
J. Nick Koston 0e6b3d6583
Switch async_track_same_state to use async_call_later (#99219)
* Switch async_track_same_state to use async_call_later

There was no need to use async_track_point_in_utc_time here since
we only need a delay

* update trigger tests

* remove some more utcnow patching

* remove some more utcnow patching

* remove some more utcnow patching
2023-08-28 22:30:20 +02:00
J. Nick Koston 3a06659120
Speed up single entity/response service calls (#96729)
* Significantly speed up single entity/response service calls

Since the majority of service calls are single entity, we can
avoid creating tasks in this case. Since the multi-entity
service calls always check the result and raise, we can switch
the asyncio.wait to asyncio.gather

* Significantly speed up single entity/response service calls

Since the majority of service calls are single entity, we can
avoid creating tasks in this case. Since the multi-entity
service calls always check the result and raise, we can switch
the asyncio.wait to asyncio.gather

* revert

* cannot be inside pytest.raises

* one more

* Update homeassistant/helpers/service.py
2023-07-17 09:33:13 +02:00
Erik Montnemery 17ac1a6d32
Set automations which fail validation unavailable (#94856) 2023-06-27 18:23:33 +02:00
Allen Porter 12129e9d21
Update service call return values and error handling (#94657)
* Update return signature of service calls

* Add timeout error handling in websocket api for service calls

* Update recorder tests to remove assertion on service call

* Remove timeout behavior and update callers that depend on it today

* Fix tests

* Add missing else

* await coro directly

* Fix more tests

* Update the intent task to use wait instead of timeout

* Remove script service call limits and limit constants

* Update tests that depend on service call limits

* Use wait instead of wait_for and add test

* Update homeassistant/helpers/intent.py

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

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-06-16 07:01:40 -07:00
J. Nick Koston 9f0d3bfce8
Use ReadOnlyDict for entity registry options (#93824)
* Use ReadOnlyDict for entity registry options

While reviewing #93601 it was noticed this was slow at startup
https://github.com/home-assistant/core/pull/93601#issuecomment-1568958280

This is a first pass attempt to improve the performance

* fix tests
2023-05-30 20:11:39 -04:00
Jan Bouwhuis ec98e22330
Add type hints for stub_blueprint_populate fixture (#93568)
Add typehints for stub_blueprint_populate fixture
2023-05-26 08:13:13 +02:00
Erik Montnemery 3cca338c6e
Improve blueprint test fixtures (#93519) 2023-05-25 13:45:19 +02:00
Erik Montnemery 31de1b17e8
Allow setting google disable 2fa flag on any entity (#92403)
* Allow setting google disable 2fa flag on any entity

* Fix test

* Include disable_2fa flag in cloud/google_assistant/entities/get
2023-05-03 09:55:38 -04:00
Erik Montnemery 4860a8d1e8
Don't use storage collection helper in ExposedEntities (#92396)
* Don't use storage collection helper in ExposedEntities

* Fix tests
2023-05-03 12:39:22 +02:00
Erik Montnemery 7aa94f97c0
Improve exposed entities tests (#92389) 2023-05-03 10:49:01 +02:00
Paulus Schoutsen 1baa4d5109
Fix deserialize bug + add test coverage (#92382) 2023-05-02 22:38:54 -04:00
Erik Montnemery e3c16e634b
Allow exposing entities not in the entity registry to assistants (#92363) 2023-05-02 22:08:09 +02:00
Erik Montnemery 44c89a6b6c
Refactor handling of exposed entities for cloud Alexa and Google (#89877)
* Refactor handling of exposed entities for cloud Alexa

* Tweak WS API

* Validate assistant parameter

* Address some review comments

* Refactor handling of exposed entities for cloud Google

* Raise when attempting to expose an unknown entity

* Add tests

* Adjust cloud tests

* Allow getting expose new entities flag

* Test Alexa migration

* Test Google migration

* Add WS command cloud/google_assistant/entities/get

* Fix return value

* Update typing

* Address review comments

* Rename async_get_exposed_entities to async_get_assistant_settings
2023-04-06 13:09:45 -04:00
Erik Montnemery 5bc9545b81
Rename custom_jinja to custom_templates (#90473)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-03-29 21:58:25 +02:00