diff --git a/custom_components/ble_monitor/config_flow.py b/custom_components/ble_monitor/config_flow.py index 60d482914..526f6e427 100644 --- a/custom_components/ble_monitor/config_flow.py +++ b/custom_components/ble_monitor/config_flow.py @@ -6,7 +6,7 @@ from homeassistant import config_entries, data_entry_flow from homeassistant.const import (CONF_DEVICES, CONF_DISCOVERY, CONF_MAC, CONF_NAME, CONF_TEMPERATURE_UNIT, - TEMP_CELSIUS, TEMP_FAHRENHEIT) + UnitOfTemperature) from homeassistant.core import callback from homeassistant.helpers import config_validation as cv from homeassistant.helpers import device_registry @@ -46,8 +46,8 @@ vol.Optional(CONF_MAC, default=DEFAULT_DEVICE_MAC): cv.string, vol.Optional(CONF_UUID, default=DEFAULT_DEVICE_UUID): cv.string, vol.Optional(CONF_DEVICE_ENCRYPTION_KEY, default=DEFAULT_DEVICE_ENCRYPTION_KEY): cv.string, - vol.Optional(CONF_TEMPERATURE_UNIT, default=TEMP_CELSIUS): vol.In( - [TEMP_CELSIUS, TEMP_FAHRENHEIT] + vol.Optional(CONF_TEMPERATURE_UNIT, default=UnitOfTemperature.TEMP_CELSIUS): vol.In( + [UnitOfTemperature.TEMP_CELSIUS, UnitOfTemperature.TEMP_FAHRENHEIT] ), vol.Optional(CONF_DEVICE_USE_MEDIAN, default=DEFAULT_DEVICE_USE_MEDIAN): vol.In( [DEFAULT_DEVICE_USE_MEDIAN, True, False] @@ -196,7 +196,7 @@ async def async_step_add_remove_device(self, user_input=None): vol.Optional( CONF_TEMPERATURE_UNIT, default=user_input[CONF_TEMPERATURE_UNIT], - ): vol.In([TEMP_CELSIUS, TEMP_FAHRENHEIT]), + ): vol.In([UnitOfTemperature.TEMP_CELSIUS, UnitOfTemperature.TEMP_FAHRENHEIT]), vol.Optional( CONF_DEVICE_USE_MEDIAN, default=user_input[CONF_DEVICE_USE_MEDIAN], @@ -274,9 +274,9 @@ async def async_step_add_remove_device(self, user_input=None): vol.Optional( CONF_TEMPERATURE_UNIT, default=self._sel_device.get( - CONF_TEMPERATURE_UNIT, TEMP_CELSIUS + CONF_TEMPERATURE_UNIT, UnitOfTemperature.TEMP_CELSIUS ), - ): vol.In([TEMP_CELSIUS, TEMP_FAHRENHEIT]), + ): vol.In([UnitOfTemperature.TEMP_CELSIUS, UnitOfTemperature.TEMP_FAHRENHEIT]), vol.Optional( CONF_DEVICE_USE_MEDIAN, default=self._sel_device.get(