Commit Graph

254 Commits (40a47c72f432d6bd74b30d1883feed16d1cdc9f0)

Author SHA1 Message Date
Erik Montnemery 67c1051305
Allow setting an entity's name by its device class (#90767)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-05-09 18:55:55 +02:00
J. Nick Koston 4c3e98b77c
Fix parallel_updates being acquired too late for entity executor jobs (#92681)
* 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 (#91387) 2023-04-13 22:39:03 +02:00
Franck Nijhof 22a1a6846d
Warn for unneeded use of async_update_ha_state (#91372) 2023-04-13 13:49:56 -04:00
Franck Nijhof 445b823232
Avoid task creation when calling schedule_update_ha_state without force update (#91352) 2023-04-13 18:39:03 +02:00
rlippmann 3a72054f93
Make dataclasses in HA core slotted (#91208) 2023-04-11 07:58:28 -10:00
J. Nick Koston 3d1556a4a2
Switch back to using call_later for the slow entity update warning (#91067)
* Switch back to using call_later for the slow entity update warning

I had originally changed this to create a task and wait
in #41184 but that does not make sense anymore with newer
cpython as the profile now shows the original method is cheaper
(or I did it wrong the first time)

* fix missing block till done since there is no longer a task being created which would run the event loop once
2023-04-08 22:22:56 -04:00
J. Nick Koston 5eb0c35a97
Add names to common helper tasks (#90803) 2023-04-05 08:41:15 +02:00
Erik Montnemery 149e610bca
Drop __eq__ dunder method from Entity (#90585) 2023-03-31 17:03:02 +02:00
J. Nick Koston 30e7ab247d
Small cleanups to writing entity state (#89890)
* Small cleanups to writing entity state

* reduce one prop access

* small cleanups

* small cleanups

* name conflict
2023-03-17 20:32:24 -04:00
Erik Montnemery cf7e500a8e
Support translating entity names (#88242) 2023-03-12 15:55:04 +01:00
J. Nick Koston 11681f3f31
Pass a helpful name when creating common asyncio tasks in core (#89171) 2023-03-05 12:46:02 +01:00
Erik Montnemery 83e5bf7ae8
Use entity_sources to determine integration in recorder platforms (#88382) 2023-02-18 07:21:41 -06:00
Erik Montnemery cc564026fa
Move EntityCategory to homeassistant.const (#87792)
* Move EntityCategory to homeassistant.const

* Fix more imports
2023-02-09 20:15:37 +01:00
Erik Montnemery 8ccb3b7151
Fix circular import loop in homeassistant/helpers/entity.py (#87780)
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-02-09 19:15:53 +01:00
Paulus Schoutsen a090652560
Use correct state in Entity repr and output similar value to State class (#87519)
* Use correct state in Entity repr

* Test Entity.__repr__

* Align with State class
2023-02-06 13:35:36 -05:00
Franck Nijhof 06a35fb7db
Code styling tweaks to core helpers (#85441) 2023-01-08 13:44:09 -10:00
Franck Nijhof d4f69a3652
String formatting and max line length - Part 7 (#84532)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-12-27 11:18:56 +01:00
Erik Montnemery 8e617bbc1d
Add `translation_key` property to entites (#82701)
* 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
Erik Montnemery 35dbc3151a
Fix docstring for entity helper (#82704)
Fix some language in entity.py
2022-11-25 18:20:33 +01:00
Marc Mueller 0c8eeaa643
Update mypy to 0.990 (#81783)
* Update mypy to 0.990

* Remove type ignore - overriding attr with property (13475)

* Remove type ignores - hasattr (13544)

* Adjust type ignore - assignment (13549)

* New error code - type-abstract (13785)

* Disable annotation-unchecked (13851)
2022-11-08 14:41:39 +01:00
Erik Montnemery 6979cd95b0
Add suggested_unit_of_measurement attribute to sensors (#80638)
* Add suggested_unit_of_measurement attribute to sensors

* Lazy calculation of initial entity options

* Add type alias for entity options

* Small tweak

* Add tests

* Store suggested_unit_of_measurement in its own option key

* Adapt to renaming of IMPERIAL_SYSTEM

* Fix rebase mistakes

* Apply suggestions from code review

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2022-10-24 16:08:02 +02:00
Franck Nijhof a30dfd9f3e
Add class attribute for capability attributes in entity base class (#76599) 2022-08-11 10:34:58 +02:00
Franck Nijhof 7adb0f0ef5
Custom component -> Custom integration (#75404) 2022-07-18 22:10:22 +02:00
Erik Montnemery 26a85c6644
Add Entity.has_entity_name attribute (#73217) 2022-06-28 09:38:05 -07:00
Erik Montnemery 921245a490
Remove deprecated temperature conversion of non sensors (#73222) 2022-06-08 20:47:47 +02:00
Erik Montnemery deedbca46c
Mark unused sync toggle method from ToggleEntity as final (#72370) 2022-05-23 17:52:21 +02:00
Erik Montnemery 1aaf78ef99
Remove entity category system in favor of hidden_by (#68550) 2022-05-02 09:33:16 -07:00
Marc Mueller 283c04e424
Improve typing [helpers.entity] (#70890) 2022-04-28 10:52:42 +02:00
Erik Montnemery c5d69ab1b2
Handle removed entites in collection.sync_entity_lifecycle (#70759)
* Handle removed entites in collection.sync_entity_lifecycle

* Add comment
2022-04-27 08:05:00 -07:00
Paulus Schoutsen 5317bf02e6
Fix hidden default (#70699) 2022-04-25 10:10:42 -07:00
Franck Nijhof 7b75a16745
Add visible by default property to base Entity (#70370) 2022-04-21 22:06:34 -07:00
epenet 4c7e1fe060
Cleanup ENTITY_CATEGORIES_SCHEMA (#66549)
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
Paulus Schoutsen 130ca2213f
Enforce EntityCategory enum (#69015)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-03-31 15:04:33 -07:00
Erik Montnemery 69ee4cd978
Deprecate temperature conversion in base entity class (#68978)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-03-31 14:29:44 -07:00
Erik Montnemery 9471e4d77c
Don't override temperature unit for sensors (#68910) 2022-03-30 10:15:00 -07:00
Erik Montnemery 91f6e58e9a
Allow customizing unit for temperature and pressure sensors (#64366)
* Allow customizing unit for temperature and pressure sensors

* pylint

* Adjust google_wifi tests

* Address review comments and add tests

* Improve rounding when scaling

* Tweak rounding

* Further tweak rounding

* Allow setting entity options with config/entity_registry/update

* Address review comments

* Tweak tests

* Load custom unit when sensor is added

* Override async_internal_added_to_hass

* Adjust tests after rebase

* Apply suggestions from code review

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* Address review comments

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-03-30 15:43:04 +02:00
J. Nick Koston aaeaed4117
Compatibility for "device_state_attributes" which was deprecated in 2021.4 has been removed (#67837)
* Small performance tweaks to _async_write_ha_state

- Only call self.available once per cycle

- Only call self.device_state_attributes once per update cycle

- Do not check for device_state_attributes if extra_state_attributes is not None

* drop backcompat

* remove prop
2022-03-09 21:39:43 +01:00
J. Nick Koston a75bbc79a2
Prevent polling from recreating an entity after removal (#67750) 2022-03-07 20:42:16 -08:00
Marc Mueller 30e2411761
Add type ignore error codes [last ones] (#66816) 2022-02-18 18:15:57 +01:00
Marc Mueller bfb1abd3a2
Add type ignore error codes [helpers] (#66776) 2022-02-18 11:31:37 +01:00
epenet 0a7b1dec7d
Adjust type hint in core add_job (#66503)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-02-14 11:13:10 +01:00
Joakim Sørensen 7a40ae13a4
Add guard for invalid EntityCategory value (#66316) 2022-02-11 14:57:45 +01:00
Erik Montnemery 911e488d48
Fix ENTITY_CATEGORIES_SCHEMA (#66108)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-02-08 14:00:53 -08:00
epenet f662e8669e
Address late review in entity registry (#64851)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-24 22:42:38 +01:00
epenet 32d5c8e8ac
Add type hint to RegistryEntry.entity_category (#64618)
Co-authored-by: Dave T <17680170+davet2001@users.noreply.github.com>
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-24 12:51:11 +01:00
Franck Nijhof 176f03d4ac
Allow toggles (switches) state to be None (#64621) 2022-01-23 11:31:01 +01:00
Marc Mueller b0f72f59da
Use imports from `core` (#63458) 2022-01-05 14:55:38 +01:00
Ruslan Sayfutdinov 55f4962c06
Fix pylint plugin which checks relative imports (#62693) 2021-12-23 11:14:47 -08:00
J. Nick Koston 04153c0075
Add hardware version to the device registry (#61650) 2021-12-16 05:16:19 -06:00