Skip to content

Commit

Permalink
Fan Entity Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
c503ghosh committed Oct 15, 2024
1 parent 1f6cc71 commit 993fddf
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions custom_components/dirigera_platform/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,16 @@ def preset_modes(self) -> list[str]:

@property
def preset_mode(self) -> str:
return self.fan_mode
if self.fan_mode == FanModeEnum.OFF:
return "off"
if self.fan_mode == FanModeEnum.LOW:
return "low"
if self.fan_mode == FanModeEnum.MEDIUM:
return "medium"
if self.fan_mode == FanModeEnum.HIGH:
return "high"
return "auto"
#return self.fan_mode

async def async_update(self):
if (
Expand Down Expand Up @@ -226,14 +235,13 @@ async def async_turn_on(self, percentage=None, preset_mode=None) -> None:
percentage, preset_mode
)
)

if preset_mode is not None:
await self.async_set_preset_mode(preset_mode)
elif percentage is not None:
await self.async_set_percentage(percentage)
else:
logger.debug(
"We were asked to be turned on but percentage and preset were not set, using last known"
)
logger.debug("We were asked to be turned on but percentage and preset were not set, using last known")
if self.preset_mode is not None:
await self.async_set_preset_mode(self.preset_mode)
elif self.percentage is not None:
Expand Down

0 comments on commit 993fddf

Please sign in to comment.