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>
This commit is contained in:
parent
5b1e319947
commit
91f6e58e9a
8 changed files with 306 additions and 25 deletions
|
@ -7,6 +7,12 @@ from homeassistant.const import (
|
|||
UNIT_NOT_RECOGNIZED_TEMPLATE,
|
||||
)
|
||||
|
||||
VALID_UNITS: tuple[str, ...] = (
|
||||
TEMP_CELSIUS,
|
||||
TEMP_FAHRENHEIT,
|
||||
TEMP_KELVIN,
|
||||
)
|
||||
|
||||
|
||||
def fahrenheit_to_celsius(fahrenheit: float, interval: bool = False) -> float:
|
||||
"""Convert a temperature in Fahrenheit to Celsius."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue