Skip to content

Commit

Permalink
Merge pull request #1290 from custom-components/units
Browse files Browse the repository at this point in the history
Fix depreciated unit of measurements
  • Loading branch information
Ernst79 authored Jan 7, 2024
2 parents e3a8bc1 + 7211c3f commit d177f46
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions custom_components/ble_monitor/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit d177f46

Please sign in to comment.