homeassistant-blitzortung icon indicating copy to clipboard operation
homeassistant-blitzortung copied to clipboard

The name property of the Unit System is deprecated

Open epenet opened this issue 2 years ago • 1 comments

As per https://github.com/home-assistant/core/pull/80257

The name of a unit system should never be used for checking its type. Instance checks should be used instead:

Correct:

if hass.config.units is IMPERIAL_SYSTEM:
    pass

if hass.config.units is METRIC_SYSTEM:
    pass

Incorrect:

if hass.config.units.name == CONF_UNIT_SYSTEM_IMPERIAL:
    pass

if hass.config.units.name == CONF_UNIT_SYSTEM_METRIC:
    pass

epenet avatar Oct 14 '22 05:10 epenet

Note: the name property of the IMPERIAL_SYSTEM is likely to get adjusted as soon as 2022.11 so this is an advance warning

epenet avatar Oct 14 '22 05:10 epenet

Note: Detected integration that accesses the `name` property of the unit system. This is deprecated and will stop working in Home Assistant 2023.1. Please adjust to use instance check instead.. Please report issue to the custom integration author for blitzortung using this method at custom_components/blitzortung/geo_location.py, line 100: if hass.config.units.name == CONF_UNIT_SYSTEM_IMPERIAL:

ocean75 avatar Nov 03 '22 19:11 ocean75

Seeing the same.

codyc1515 avatar Nov 08 '22 19:11 codyc1515

+1

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:77
First occurred: 10:06:59 AM (1 occurrences)
Last logged: 10:06:59 AM

Detected integration that accesses the `name` property of the unit system. This is deprecated and will stop working in Home Assistant 2023.1. Please adjust to use instance check instead.. Please report issue to the custom integration author for blitzortung using this method at custom_components/blitzortung/geo_location.py, line 100: if hass.config.units.name == CONF_UNIT_SYSTEM_IMPERIAL:

kryptonitecb3 avatar Nov 09 '22 16:11 kryptonitecb3

I am also seeing the same

jbonzey avatar Nov 10 '22 22:11 jbonzey

This was fixed in https://github.com/mrk-its/homeassistant-blitzortung/pull/67 and can be closed now.

codyc1515 avatar Dec 04 '22 22:12 codyc1515