mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-19 15:26:29 +00:00
Rename IMPERIAL_SYSTEM to US_CUSTOMARY_SYSTEM (#1500)
* Rename IMPERIAL_SYSTEM to US_CUSTOMARY_SYSTEM * Update 2022-10-14-deprecate-unit-system.md * Delete 2022-10-18-rename-imperial-unit-system.md * Update 2022-10-14-deprecate-unit-system.md * Update 2022-10-14-deprecate-unit-system.md
This commit is contained in:
parent
3dba19e66a
commit
6e4f29ba19
@ -1,20 +1,20 @@
|
|||||||
---
|
---
|
||||||
author: epenet
|
author: epenet
|
||||||
authorURL: https://github.com/epenet
|
authorURL: https://github.com/epenet
|
||||||
title: "Deprecate Unit System constants and properties"
|
title: "Deprecate IMPERIAL_SYSTEM unit system and linked constants and properties"
|
||||||
---
|
---
|
||||||
|
|
||||||
As of Home Assistant Core 2022.11, the `is_metric` and `name` properties of a unit system are deprecated
|
As of Home Assistant Core 2022.11, the `IMPERIAL_SYSTEM` is deprecated, replaced by `US_CUSTOMARY_SYSTEM`.
|
||||||
and should not be used.
|
The `is_metric` and `name` properties of a unit system are likewise deprecated and should not be used.
|
||||||
|
|
||||||
Custom integrations referencing these properties will need to be adjusted to use instance checks instead.
|
Custom integrations referencing this unit system or these properties will need to be adjusted to use instance checks instead.
|
||||||
|
|
||||||
Correct:
|
Correct:
|
||||||
```python
|
```python
|
||||||
if hass.config.units is IMPERIAL_SYSTEM:
|
if hass.config.units is METRIC_SYSTEM:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if hass.config.units is METRIC_SYSTEM:
|
if hass.config.units is US_CUSTOMARY_SYSTEM:
|
||||||
pass
|
pass
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user