Jan Bouwhuis
3aae9b629f
Add exception translation for entity action not supported ( #131956 )
2024-12-01 16:53:06 +01:00
Marc Mueller
ca55986057
Import Generator from collections.abc (1) ( #120914 )
2024-07-01 11:51:51 +02:00
Marc Mueller
fe21e2b8ba
Import Generator from typing_extensions (1) ( #118986 )
2024-06-06 17:02:13 +02: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
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
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
Jan Bouwhuis
19fa39d556
Generate ConfigValidationError message from English translations ( #113844 )
...
* Fetch ConfigValidationError message from translation cache
* Sync error logmessages with translation cache
* More sync
* Cleanup
* Remove unrelated change
* Follow up comments
* Rebase and improve contructor
* Improve name
* Rename to MULTIPLE_INTEGRATION_CONFIG_ERRORS
2024-03-25 10:39:30 +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
Jan Bouwhuis
9ca253213c
Correct HomeAssistantError __str__ implementation and test ( #113991 )
...
Correct HomeAssistant sub class implementation and test
2024-03-22 13:39:36 +01:00
Jan Bouwhuis
4da701a8e9
Add guard to HomeAssistantError `__str__` method to prevent a recursive loop ( #113913 )
...
* Add guard to HomeAssistantError `__str__` method to prevent a recursive loop
* Use repr of class instance instead
* Apply suggestion to explain __str__ method is missing
---------
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-21 23:12:25 +01:00
Jan Bouwhuis
dc38d152df
Fetch ServiceNotFound message from translation cache ( #113893 )
2024-03-21 06:54:29 +01:00
Jan Bouwhuis
8edbf88da1
Fetch MaxLengthExceeded exception mesage from the translation cache ( #113904 )
...
* Fetch MaxLengthExceeded exception mesage from the translation cache
* Update homeassistant/components/homeassistant/strings.json
Co-authored-by: J. Nick Koston <nick@koston.org>
* Add case without homeassistant integration
* Fix test
---------
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-21 06:53:26 +01:00
Sid
82a60fe8ad
Enable Ruff RSE ( #113695 )
2024-03-18 00:40:38 +01:00
Jan Bouwhuis
685553d17d
Cache late imported async_get_exception_message for HomeAssistantError ( #113683 )
...
* Cache late imported async_get_exception_message for HomeAssistantError
* Use a dict to store the function cache
* Update homeassistant/exceptions.py
Co-authored-by: J. Nick Koston <nick@koston.org>
---------
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-17 21:23:46 +01:00
Jan Bouwhuis
554aefed42
Generate HomeAssistantError message from English translations ( #113305 )
...
* Fetch exception message from translation cache
* Improve tests
* Return translation key without path, cleanup
* Fetch translations when string variant is requested
* Move import
* revert changes ConfigValidationError
* mypy
* Remove _str__ method instead
* Type _message for mqtt template exception classes
* Revert changes made to test_config.py
* Undo changes TemplateError
* Follow up comments and test coverage
2024-03-16 22:56:48 +01:00
Marc Mueller
19ab3d6daf
Add empty line after module docstring [helpers + other] ( #112707 )
2024-03-08 10:36:11 -05:00
Jan Bouwhuis
af71c2bb45
Raise and suppress stack trace when reloading yaml fails ( #102410 )
...
* Allow async_integration_yaml_config to raise
* Docstr - split check
* Implement as wrapper, return dataclass
* Fix setup error handling
* Fix reload test mock
* Move log_messages to error handler
* Remove unreachable code
* Remove config test helper
* Refactor and ensure notifications during setup
* Remove redundat error, adjust tests notifications
* Fix patch
* Apply suggestions from code review
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Follow up comments
* Add call_back decorator
* Split long lines
* Update exception abbreviations
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-11-24 17:34:45 +01:00
Jan Bouwhuis
54cf7010cd
Add ServiceValidationError and translation support ( #102592 )
...
* Add ServiceValidationError
* Add translation support
* Extend translation support to HomeAssistantError
* Add translation support for ServiceNotFound exc
* Frontend translation & translation_key from caller
* Improve fallback message
* Set websocket_api as default translation_domain
* Add MQTT ServiceValidationError exception
* Follow up comments
* Revert removing gueard on translation_key
* Revert test changes to fix CI test
* Follow up comments
* Fix CI test
* Follow up
* Improve language
* Follow up comment
2023-11-06 15:45:04 +01:00
Erik Montnemery
614f3c6a15
Move device info validation to device registry ( #96465 )
...
* Move device info validation to device registry
* Don't move DeviceInfo
* Fix type annotation
* Don't block adding device for unknown config entry
* Fix test
* Remove use of locals()
* Improve error message
2023-07-14 08:55:17 -04:00
rlippmann
3a72054f93
Make dataclasses in HA core slotted ( #91208 )
2023-04-11 07:58:28 -10:00
epenet
810367b757
Fix `can not` typo ( #87254 )
2023-02-03 11:37:16 +01:00
Franck Nijhof
9830cbfd5d
Replace attrs with dataclasses in Core exceptions ( #84473 )
2022-12-22 23:28:48 -05:00
Franck Nijhof
c715035016
Add support for raising ConfigEntryError ( #82689 )
2022-11-25 11:33:03 +01:00
epenet
f91e250e90
Fix TemplateError definition ( #82570 )
2022-11-23 20:30:32 +01:00
Erik Montnemery
0eb2caabcf
Report unmet dependencies for failing config flows ( #65061 )
...
* Report unmet dependencies for failing config flows
* Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/setup.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Modify error message
* Add test
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-02-02 15:06:27 +01:00
Marc Mueller
240c9979c7
Move `disallow-any-generics` to mypy.ini ( #63917 )
2022-01-11 13:33:25 -08:00
Ville Skyttä
848c0be58a
Avoid some implicit generic Anys ( #54577 )
2021-08-16 23:12:06 +02:00
Marc Mueller
c07646db5d
Update typing syntax ( #49480 )
...
* Update typing syntax
* Replace typing imports with ones from collections where possible
* Changes after review
2021-04-20 17:40:41 +02:00
Raman Gupta
769923e8dd
Raise exception for invalid call to DeviceRegistry.async_get_or_create ( #49038 )
...
* Raise exception instead of returning None for DeviceRegistry.async_get_or_create
* fix entity_platform logic
2021-04-13 14:18:51 +02:00
J. Nick Koston
4cd7f9bd8b
Raise ConfigEntryAuthFailed during setup or coordinator update to start reauth ( #48962 )
2021-04-09 19:41:29 -10:00
Raman Gupta
3ca69f5568
Raise an exception when event_type exceeds the max length ( #48115 )
...
* raise an exception when event_type exceeds the max length that the recorder supports
* add test
* use max length constant in recorder
* update config entry reloaded service name
* remove exception string function because it's not needed
* increase limit to 64 and revert event name change
* fix test
* assert exception args
* fix test
* add comment about migration
2021-04-08 20:46:28 +02:00
Franck Nijhof
dc15f243e6
Upgrade pyupgrade to v2.11.0 ( #48220 )
2021-03-22 13:29:39 +01:00
Marc Mueller
e55702d635
Update typing 01 ( #48013 )
2021-03-17 17:34:55 +01:00
Ville Skyttä
dc880118a4
Lint suppression cleanups ( #47248 )
...
* Unused pylint suppression cleanups
* Remove outdated pylint bug references
* Add flake8-noqa config and note to run it every now and then
* Add codes to noqa's
* Unused noqa cleanups
2021-03-02 09:02:04 +01:00
Anders Melchiorsen
d61d39de08
Handle ConditionError with multiple entity_id for state/numeric_state ( #46855 )
2021-02-22 08:11:59 +01:00
Anders Melchiorsen
d33a1a5ff8
Refine printing of ConditionError ( #46838 )
...
* Refine printing of ConditionError
* Improve coverage
* name -> type
2021-02-21 14:54:36 +01:00
Anders Melchiorsen
b9b1caf4d7
Raise ConditionError for numeric_state errors ( #45923 )
2021-02-08 10:47:57 +01:00
Franck Nijhof
834f3603bc
Correct service not found exception message ( #43846 )
2020-12-02 10:32:25 +01:00
J. Nick Koston
b897ca7260
Ensure all template errors are caught and the websocket api reports them ( #41719 )
2020-10-12 16:38:24 +02:00
Paulus Schoutsen
3dc79aa60a
Track entity sources ( #37258 )
...
Co-authored-by: David Mulcahey <david.mulcahey@me.com>
2020-08-19 14:57:38 +02:00
Ville Skyttä
0c5ca3084e
Add and fix type hints ( #36501 )
...
* Fix exceptions.Unauthorized.permission type
* Use auth.permission consts more
* Auth typing improvements
* Helpers typing improvements
* Calculate self.state only once
2020-06-06 20:34:56 +02:00
Bas Nijholt
67c56c860d
Sort imports according to PEP8 for 'homeassistant' folder ( #29789 )
...
Components are already done
2019-12-09 16:42:10 +01:00
Ville Skyttä
99c7608fb4
Lint config cleanups ( #28864 )
...
* Remove bunch of unneeded lint exclusions
* Use symbolic names instead of identifiers in pylint disables
* Tighten scope of some pylint disables
2019-11-25 22:40:08 -08:00
Ville Skyttä
d88ca0f5cb
Lint exclusions ( #28655 )
...
* Remove malformed pylint disable markers
* Remove some unused imports
* Remove some unneeded lint exclusions
* Remove more unneeded lint exclusions
* Add specific codes to all noqa's
2019-11-16 10:22:07 +01:00
Franck Nijhof
decf13b948
Use literal string interpolation in core (f-strings) ( #26166 )
2019-08-23 09:53:33 -07:00
Paulus Schoutsen
4de97abc3a
Black
2019-07-31 12:25:30 -07:00
Paulus Schoutsen
de1fd5a7fa
WS: Improve service calling errors ( #23840 )
...
* WS: Improve service calling errors
* Docstyle
* Types
* Update text
2019-05-14 07:09:11 +02:00
Paulus Schoutsen
90df932fe1
Check admin permission before able to manage config entries
2018-12-13 16:13:43 +01:00
Paulus Schoutsen
df21dd21f2
RFC: Call services directly ( #18720 )
...
* Call services directly
* Simplify
* Type
* Lint
* Update name
* Fix tests
* Catch exceptions in HTTP view
* Lint
* Handle ServiceNotFound in API endpoints that call services
* Type
* Don't crash recorder on non-JSON serializable objects
2018-11-30 21:28:35 +01:00
Paulus Schoutsen
36c31a6293
Add permissions check in service helper ( #18596 )
...
* Add permissions check in service helper
* Lint
* Fix tests
* Lint
* Typing
* Fix unused impoert
2018-11-21 12:26:08 +01:00