Deprecate is_metric property of unit system (#80313)

This commit is contained in:
epenet
2022-10-14 13:44:18 +02:00
committed by GitHub
parent a63c9e8fb9
commit 6a757662e4
2 changed files with 22 additions and 4 deletions

View File

@@ -131,7 +131,13 @@ class UnitSystem:
@property
def is_metric(self) -> bool:
"""Determine if this is the metric unit system."""
return self._name == CONF_UNIT_SYSTEM_METRIC
report(
"accesses the `is_metric` property of the unit system. "
"This is deprecated and will stop working in Home Assistant 2023.1. "
"Please adjust to use instance check instead.",
error_if_core=False,
)
return self is METRIC_SYSTEM
def temperature(self, temperature: float, from_unit: str) -> float:
"""Convert the given temperature to this unit system."""