Skip to content

Commit

Permalink
Revert min of 15 for Tumbler as it was a mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
sopelj committed Jan 15, 2024
1 parent 735f4d9 commit d641276
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions custom_components/ember_mug/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,15 @@ def max_level(self) -> int:
return 100
return 30

@property
def min_level(self) -> int:
"""Min level seems to be 15 on Tumbler..."""
if self.coordinator.mug.data.model_info.device_type == DeviceType.TUMBLER:
return 15
return 0

@property
def native_value(self) -> float | int:
"""Return information about the liquid level."""
liquid_level: float | None = super().native_value
if liquid_level:
# 30 -> Full
# 30 -> Full (100 for Travel Mug)
# 5, 6 -> Low
# 0 -> Empty
return (liquid_level - self.min_level) / self.max_level * 100
return liquid_level / self.max_level * 100
return 0

@property
Expand Down

0 comments on commit d641276

Please sign in to comment.