mirror of
https://github.com/home-assistant/core.git
synced 2025-12-26 14:08:21 +00:00
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:
@@ -112,6 +112,11 @@ class MockSensor(MockEntity, SensorEntity):
|
||||
"""Return the state class of this sensor."""
|
||||
return self._handle("state_class")
|
||||
|
||||
@property
|
||||
def suggested_unit_of_measurement(self):
|
||||
"""Return the state class of this sensor."""
|
||||
return self._handle("suggested_unit_of_measurement")
|
||||
|
||||
|
||||
class MockRestoreSensor(MockSensor, RestoreSensor):
|
||||
"""Mock RestoreSensor class."""
|
||||
|
||||
Reference in New Issue
Block a user