From c2da217df301b5f01e0581333b8210c96de3afa8 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Fri, 14 Oct 2022 14:14:50 +0200 Subject: [PATCH 1/3] Blog post for deprecated unit system features --- blog/2022-10-14-deprecate-unit-system.md | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 blog/2022-10-14-deprecate-unit-system.md diff --git a/blog/2022-10-14-deprecate-unit-system.md b/blog/2022-10-14-deprecate-unit-system.md new file mode 100644 index 00000000..cd356f0e --- /dev/null +++ b/blog/2022-10-14-deprecate-unit-system.md @@ -0,0 +1,25 @@ +--- +author: epenet +authorURL: https://github.com/epenet +title: "Deprecate Unit System constants and properties" +--- + +As of Home Assistant Core 2022.11, the `is_metric` and `name` properties of a unit system are deprecated +and should not be used. + +Custom components referencing these properties will need to be adjusted to use instance checks instead. + +Correct: +```python +if hass.config.units is IMPERIAL_SYSTEM: + pass + +if hass.config.units is METRIC_SYSTEM: + pass +``` + +To avoid confusion with future unit systems, the constants `CONF_UNIT_SYSTEM_IMPERIAL` +and `CONF_UNIT_SYSTEM_METRIC` are also deprecated and should not longer be referenced: + - if they were used to compare against the `name` of a unit system, + then this is no longer needed. + - if they were used for another reason, then local constants should be created instead. From 5bd3e55ceef23f1fb01cc64c9e0c3a0450597d0b Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 17 Oct 2022 11:36:28 +0200 Subject: [PATCH 2/3] Apply suggestion Co-authored-by: Martin Hjelmare --- blog/2022-10-14-deprecate-unit-system.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blog/2022-10-14-deprecate-unit-system.md b/blog/2022-10-14-deprecate-unit-system.md index cd356f0e..095f1a8a 100644 --- a/blog/2022-10-14-deprecate-unit-system.md +++ b/blog/2022-10-14-deprecate-unit-system.md @@ -19,7 +19,7 @@ if hass.config.units is METRIC_SYSTEM: ``` To avoid confusion with future unit systems, the constants `CONF_UNIT_SYSTEM_IMPERIAL` -and `CONF_UNIT_SYSTEM_METRIC` are also deprecated and should not longer be referenced: +and `CONF_UNIT_SYSTEM_METRIC` are also deprecated and should no longer be referenced: - if they were used to compare against the `name` of a unit system, then this is no longer needed. - if they were used for another reason, then local constants should be created instead. From 8b090805370c761afd947440374518fc2d70601c Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 17 Oct 2022 11:36:37 +0200 Subject: [PATCH 3/3] Apply suggestion Co-authored-by: Martin Hjelmare --- blog/2022-10-14-deprecate-unit-system.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blog/2022-10-14-deprecate-unit-system.md b/blog/2022-10-14-deprecate-unit-system.md index 095f1a8a..43352819 100644 --- a/blog/2022-10-14-deprecate-unit-system.md +++ b/blog/2022-10-14-deprecate-unit-system.md @@ -7,7 +7,7 @@ title: "Deprecate Unit System constants and properties" As of Home Assistant Core 2022.11, the `is_metric` and `name` properties of a unit system are deprecated and should not be used. -Custom components referencing these properties will need to be adjusted to use instance checks instead. +Custom integrations referencing these properties will need to be adjusted to use instance checks instead. Correct: ```python