Skip to content

Commit

Permalink
More updates
Browse files Browse the repository at this point in the history
Signed-off-by: Siddhu <[email protected]>
  • Loading branch information
arevindh committed Feb 22, 2023
1 parent cf133b7 commit eed6cc8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions custom_components/tinxy/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ def name(self) -> str:
@property
def is_on(self) -> bool:
"""If the switch is currently on or off."""
# self.read_status()
return self.coordinator.data[self.idx]["state"]
# return False

@property
def available(self) -> bool:
Expand Down Expand Up @@ -122,7 +120,7 @@ async def async_turn_on(self, **kwargs: Any) -> None:
self.coordinator.data[self.idx]["device_id"],
str(self.coordinator.data[self.idx]["relay_no"]),
1,
self.calculate_percent(self.preset_mode)
self.calculate_percent(self.preset_mode),
)
await self.coordinator.async_request_refresh()

Expand All @@ -145,12 +143,12 @@ async def async_set_preset_mode(self, preset_mode: str) -> None:
1,
self.calculate_percent(preset_mode),
)
await self.coordinator.async_refresh()
await self.coordinator.async_request_refresh()

def calculate_percent(self, preset_mode: str) -> int:
"""Calculate percent"""
if preset_mode == "High":
return 100
elif preset_mode == "Medium":
return 66
return 33
return 33

0 comments on commit eed6cc8

Please sign in to comment.