- fixed convertable drawer issue (resolves #243)

This commit is contained in:
Jack Simbach 2024-05-07 22:49:45 -04:00 committed by simbaja
parent 8761ac32c8
commit 48ea3b3acf
1 changed files with 3 additions and 3 deletions

View File

@ -3,7 +3,7 @@ from typing import List, Any, Optional
from gehomesdk import ErdConvertableDrawerMode from gehomesdk import ErdConvertableDrawerMode
from homeassistant.const import UnitOfTemperature from homeassistant.const import UnitOfTemperature
from homeassistant.util.unit_system import UnitSystem from homeassistant.util.unit_system import UnitSystem, UnitOfTemperature
from ..common import OptionsConverter from ..common import OptionsConverter
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -34,7 +34,7 @@ class ConvertableDrawerModeOptionsConverter(OptionsConverter):
v = value.split(" ")[0] v = value.split(" ")[0]
return ErdConvertableDrawerMode[v.upper()] return ErdConvertableDrawerMode[v.upper()]
except: except:
_LOGGER.warn(f"Could not set hood light level to {value.upper()}") _LOGGER.warn(f"Could not set drawer mode to {value.upper()}")
return ErdConvertableDrawerMode.NA return ErdConvertableDrawerMode.NA
def to_option_string(self, value: ErdConvertableDrawerMode) -> Optional[str]: def to_option_string(self, value: ErdConvertableDrawerMode) -> Optional[str]:
try: try:
@ -42,7 +42,7 @@ class ConvertableDrawerModeOptionsConverter(OptionsConverter):
v = value.stringify() v = value.stringify()
t = _TEMP_MAP.get(value, None) t = _TEMP_MAP.get(value, None)
if t and self._units.is_metric: if t and self._units.temperature_unit == UnitOfTemperature.CELSIUS:
t = self._units.temperature(float(t), UnitOfTemperature.FAHRENHEIT) t = self._units.temperature(float(t), UnitOfTemperature.FAHRENHEIT)
t = round(t,1) t = round(t,1)