1
mirror of https://github.com/home-assistant/core synced 2024-08-06 09:34:49 +02:00

Adjust freedompro type hints (#73839)

This commit is contained in:
epenet 2022-06-22 22:17:50 +02:00 committed by GitHub
parent 8b067e83f7
commit 75cfe845e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
from __future__ import annotations
import json
from typing import Any
from pyfreedompro import put_state
@ -87,27 +88,30 @@ class FreedomproFan(CoordinatorEntity, FanEntity):
await super().async_added_to_hass()
self._handle_coordinator_update()
async def async_turn_on(self, percentage=None, preset_mode=None, **kwargs):
async def async_turn_on(
self,
percentage: int | None = None,
preset_mode: str | None = None,
**kwargs: Any,
) -> None:
"""Async function to turn on the fan."""
payload = {"on": True}
payload = json.dumps(payload)
await put_state(
self._session,
self._api_key,
self.unique_id,
payload,
json.dumps(payload),
)
await self.coordinator.async_request_refresh()
async def async_turn_off(self, **kwargs):
async def async_turn_off(self, **kwargs: Any) -> None:
"""Async function to turn off the fan."""
payload = {"on": False}
payload = json.dumps(payload)
await put_state(
self._session,
self._api_key,
self.unique_id,
payload,
json.dumps(payload),
)
await self.coordinator.async_request_refresh()