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>
This commit is contained in:
Erik Montnemery 2022-10-24 16:08:02 +02:00 committed by GitHub
parent 0c79a9a33d
commit 6979cd95b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 380 additions and 48 deletions

View file

@ -607,9 +607,10 @@ class EntityPlatform:
device_id=device_id,
disabled_by=disabled_by,
entity_category=entity.entity_category,
get_initial_options=entity.get_initial_entity_options,
has_entity_name=entity.has_entity_name,
hidden_by=hidden_by,
known_object_ids=self.entities.keys(),
has_entity_name=entity.has_entity_name,
original_device_class=entity.device_class,
original_icon=entity.icon,
original_name=entity.name,