Adjust distance unit check in geonetnz_volcano (#80244)

* Adjust distance unit check in geonetnz_volcano

* Use system compare

* Use is not ==
This commit is contained in:
epenet 2022-10-14 12:14:12 +02:00 committed by GitHub
parent 0b7c84edbd
commit 3e0e845217
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,6 +13,7 @@ from homeassistant.const import (
)
from homeassistant.core import callback
from homeassistant.helpers import config_validation as cv
from homeassistant.util.unit_system import IMPERIAL_SYSTEM
from .const import DEFAULT_RADIUS, DEFAULT_SCAN_INTERVAL, DOMAIN
@ -57,7 +58,7 @@ class GeonetnzVolcanoFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
if identifier in configured_instances(self.hass):
return await self._show_form({"base": "already_configured"})
if self.hass.config.units.name == CONF_UNIT_SYSTEM_IMPERIAL:
if self.hass.config.units is IMPERIAL_SYSTEM:
user_input[CONF_UNIT_SYSTEM] = CONF_UNIT_SYSTEM_IMPERIAL
else:
user_input[CONF_UNIT_SYSTEM] = CONF_UNIT_SYSTEM_METRIC