Add missing type hints in fans (#73835)

This commit is contained in:
epenet 2022-06-22 18:43:41 +02:00 committed by GitHub
parent 532e25d087
commit 6b6e5fad3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 106 additions and 75 deletions

View file

@ -215,35 +215,35 @@ class TemplateFan(TemplateEntity, FanEntity):
return self._preset_modes
@property
def is_on(self):
def is_on(self) -> bool:
"""Return true if device is on."""
return self._state == STATE_ON
@property
def preset_mode(self):
def preset_mode(self) -> str | None:
"""Return the current preset mode."""
return self._preset_mode
@property
def percentage(self):
def percentage(self) -> int | None:
"""Return the current speed percentage."""
return self._percentage
@property
def oscillating(self):
def oscillating(self) -> bool | None:
"""Return the oscillation state."""
return self._oscillating
@property
def current_direction(self):
def current_direction(self) -> str | None:
"""Return the oscillation state."""
return self._direction
async def async_turn_on(
self,
percentage: int = None,
preset_mode: str = None,
**kwargs,
percentage: int | None = None,
preset_mode: str | None = None,
**kwargs: Any,
) -> None:
"""Turn on the fan."""
await self.async_run_script(