Commit graph

103 commits

Author SHA1 Message Date
Jan-Philipp Benecke
ae1117bc74
Fix failing entity reuse test ()
* Fix failing entity reuse test

* One more test
2023-11-03 23:19:37 +01:00
Erik Montnemery
0ea0a1ed06
Prevent accidentally reusing an entity object ()
* Prevent accidentally reusing an entity object

* Fix group reload service

* Revert "Fix group reload service"

* Improve test

* Add tests aserting entity can't be reused
2023-11-03 21:01:38 +01:00
J. Nick Koston
e5ebdf7ad4
Remove implict name check from Entity base class () 2023-10-15 23:40:43 +02:00
Nicolas van de Walle
1b11062b27
Improved debugging for "Failed to set state" () 2023-10-08 19:40:42 +02:00
Erik Montnemery
20188181f7
Fix spelling in sensor test () 2023-10-06 11:51:08 +02:00
Erik Montnemery
17779c5f0c
Add loader.async_suggest_report_issue and loader.async_get_issue_tracker ()
* Add loader.async_suggest_report_issue and loader.async_get_issue_tracker

* Update tests

* Add tests

* Address review comments

* Address review comments
2023-10-04 13:40:33 +02:00
Erik Montnemery
d1afcd773f
Revert "Cache entity properties that are never expected to change in the base class" ()
Revert "Cache entity properties that are never expected to change in the base class ()"

This reverts commit 042776ebb8.
2023-09-15 11:25:24 +02:00
J. Nick Koston
042776ebb8
Cache entity properties that are never expected to change in the base class () 2023-09-14 17:48:48 -05:00
Erik Montnemery
bbcbb2e322
Improve Entity._suggest_report_issue () 2023-09-12 21:07:32 +02:00
Erik Montnemery
51576b7214
Improve typing of entity.entity_sources ()
* Improve typing of entity.entity_sources

* Calculate entity info source when generating WS response

* Adjust typing

* Update tests
2023-09-12 20:41:26 +02:00
Erik Montnemery
709ce7e0af
Set state of entity with invalid state to unknown ()
* Set state of entity with invalid state to unknown

* Add test

* Apply suggestions from code review

Co-authored-by: Robert Resch <robert@resch.dev>

* Update test_entity.py

---------

Co-authored-by: Robert Resch <robert@resch.dev>
2023-09-04 14:09:51 +02:00
Erik Montnemery
c7b4d4f361
Adjust helpers tests which create devices () 2023-08-10 19:28:16 +02:00
Erik Montnemery
614f3c6a15
Move device info validation to device registry ()
* 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
Jan Bouwhuis
b9c7e7c15e
Fix not including device_name in friendly name if it is None ()
* Omit device_name in friendly name if it is None

* Fix test
2023-07-06 11:14:09 -04:00
J. Nick Koston
9051750add
Cache entity translation lookups and keys () 2023-06-25 08:50:48 -05:00
Franck Nijhof
e2f5a707ce
Fix use_device_name in case device device class translations are used ()
Co-authored-by: Erik <erik@montnemery.com>
2023-06-22 11:30:19 +02:00
Erik Montnemery
334dacc322
Change Entity.name default to UNDEFINED ()
* Change Entity.name default to UNDEFINED

* Update typing

* Update Pylint plugin

* Update TTS test
2023-06-15 11:09:53 +02:00
Erik Montnemery
d51982f12f
Add missing assert to test_async_remove_ignores_in_flight_polling () 2023-06-12 21:48:12 +02:00
Erik Montnemery
59f5b8f2d6
Remove unneeded checks for Entity.platform ()
* Remove unneeded checks for Entity.platform

* Update tests

* Prevent breaking integrations without an EntityComponent

* Warn when entity has no platform
2023-06-09 15:17:41 +02:00
Erik Montnemery
59c6220b7c
Subscribe to device registry changes from entities ()
* Subscribe to device registry changes from entities

* Use async_track_device_registry_updated_event

* Fix unsubscribe

* Fix logic, add tests
2023-05-31 11:01:55 +02:00
J. Nick Koston
4c3e98b77c
Fix parallel_updates being acquired too late for entity executor jobs ()
* Fix parallel_updates being acquired too late for entity executor jobs

* tweak
2023-05-06 16:46:00 +02:00
Franck Nijhof
32344a8488
Fix incorrect warn of async_update_ha_state use () 2023-04-13 22:39:03 +02:00
Franck Nijhof
22a1a6846d
Warn for unneeded use of async_update_ha_state () 2023-04-13 13:49:56 -04:00
Franck Nijhof
d320c73fb7
Use async_write_ha_state in tests () 2023-04-13 12:36:36 +02:00
epenet
46a5aa71ec
Add type hints to helper tests () 2023-03-16 11:10:56 +01:00
epenet
5f25b71df7
Add type hints to core tests () 2023-02-20 11:42:56 +01:00
Franck Nijhof
ed79265843
Enable Ruff PT006 ()
* Enable Ruff PT006

* Adjust existing cases

* Fix tests

* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
Franck Nijhof
80bf632e2d
Clean up unnecessary registry mocks from helpers () 2023-02-08 20:15:29 -05:00
epenet
c98b4e3204
Add typing to tests with single hass argument (2) ()
* Add typing to tests with single hass argument (2)

* a few more
2023-02-08 08:51:43 +01:00
epenet
4142f0d15d
Add return type to tests without arguments ()
* Add return type to tests without arguments

* Black

* Cancel fixture amends
2023-02-07 14:20:06 +01:00
epenet
aa00114c2f
Add return type to async tests without arguments () 2023-02-07 10:26:56 +01:00
Paulus Schoutsen
a090652560
Use correct state in Entity repr and output similar value to State class ()
* Use correct state in Entity repr

* Test Entity.__repr__

* Align with State class
2023-02-06 13:35:36 -05:00
Franck Nijhof
5e81d28116
Update black to 23.1.0 () 2023-02-02 18:35:24 +01:00
epenet
30bf0634fe
Add per-file-ignore to pylint () 2023-01-22 17:26:24 +01:00
Paulus Schoutsen
9ed629d838
Fix some pytest warning for helpers () 2023-01-06 09:21:46 +01:00
Erik Montnemery
8e617bbc1d
Add translation_key property to entites ()
* Add translation_key attribute to entity state

* Update accuweather test

* Index entity translation keys by platform

* Store translation key in entity registry
2022-12-01 09:34:09 +01:00
Franck Nijhof
7adb0f0ef5
Custom component -> Custom integration () 2022-07-18 22:10:22 +02:00
Erik Montnemery
26a85c6644
Add Entity.has_entity_name attribute () 2022-06-28 09:38:05 -07:00
Erik Montnemery
921245a490
Remove deprecated temperature conversion of non sensors () 2022-06-08 20:47:47 +02:00
Erik Montnemery
1aaf78ef99
Remove entity category system in favor of hidden_by () 2022-05-02 09:33:16 -07:00
Paulus Schoutsen
5317bf02e6
Fix hidden default () 2022-04-25 10:10:42 -07:00
epenet
4c7e1fe060
Cleanup ENTITY_CATEGORIES_SCHEMA ()
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-04-01 09:40:43 -07:00
Erik Montnemery
69ee4cd978
Deprecate temperature conversion in base entity class ()
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-03-31 14:29:44 -07:00
J. Nick Koston
a75bbc79a2
Prevent polling from recreating an entity after removal () 2022-03-07 20:42:16 -08:00
Erik Montnemery
911e488d48
Fix ENTITY_CATEGORIES_SCHEMA ()
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-02-08 14:00:53 -08:00
Ville Skyttä
5bf67cac66
Use RegistryEntryDisabler () 2021-12-15 23:25:40 +02:00
Franck Nijhof
c28b45cd83
Migrate entity categories to StrEnum () 2021-12-01 13:54:36 +01:00
Erik Montnemery
4b3d423767
Add config and diagnostic entities ()
* Add config entity concept

* Rename is_config_entity to entity_category

* Add test

* Add 'diagnostic' entity category
2021-10-14 10:04:26 +02:00
Franck Nijhof
13db867c1d
Move attribution attribute to Entity base class () 2021-10-11 23:15:32 +02:00
Erik Montnemery
6954614e62
Warn if total_increasing sensor has negative states () 2021-09-30 07:49:16 -07:00