Skip to content

Commit

Permalink
fix: Remove ensure_celsius and let Home Assistant to the work
Browse files Browse the repository at this point in the history
  • Loading branch information
sopelj committed Feb 4, 2023
1 parent 0648140 commit a5b060e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
10 changes: 1 addition & 9 deletions custom_components/ember_mug/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from .const import DOMAIN
from .coordinator import MugDataUpdateCoordinator
from .entity import BaseMugValueEntity, ensure_celsius
from .entity import BaseMugValueEntity

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -55,14 +55,6 @@ def __init__(
class MugTargetTempNumberEntity(MugNumberEntity):
"""Configurable NumerEntity for the Mug's target temp."""

@property
def native_value(self) -> float | None:
"""Return mug attribute as temp."""
return ensure_celsius(
super().native_value,
self.coordinator.data.temperature_unit,
)

async def async_set_native_value(self, value: float) -> None:
"""Set the mug target temp."""
await self.coordinator.connection.set_target_temp(value)
Expand Down
10 changes: 1 addition & 9 deletions custom_components/ember_mug/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
LIQUID_STATE_TEMP_ICONS,
LiquidStateValue,
)
from .entity import BaseMugValueEntity, ensure_celsius
from .entity import BaseMugValueEntity

SENSOR_TYPES = {
"liquid_state": SensorEntityDescription(
Expand Down Expand Up @@ -154,14 +154,6 @@ def icon(self) -> str | None:
)
return f"mdi:{icon}"

@property
def native_value(self) -> float | None:
"""Return sensor state."""
return ensure_celsius(
super().native_value,
self.coordinator.data.temperature_unit,
)

@property
def extra_state_attributes(self) -> dict[str, Any]:
"""Return device specific state attributes."""
Expand Down

0 comments on commit a5b060e

Please sign in to comment.