mrk-its / homeassistant-blitzortung

Custom Component for fetching lightning data from blitzortung.org
MIT License
186 stars 38 forks source link

The name property of the Unit System is deprecated #66

Closed epenet closed 1 year ago

epenet commented 1 year ago

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 commented 1 year ago

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

ocean75 commented 1 year ago

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:

codyc1515 commented 1 year ago

Seeing the same.

kryptonitecb3 commented 1 year ago

+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:
jbonzey commented 1 year ago

I am also seeing the same

codyc1515 commented 1 year ago

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