Add missing type hints to alarm module (#1111)

This commit is contained in:
Teemu R. 2024-09-10 18:20:00 +02:00 committed by GitHub
parent a967d5cd3a
commit 2a89e58ae0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,6 +2,8 @@
from __future__ import annotations
from typing import Literal
from ...feature import Feature
from ..smartmodule import SmartModule
@ -94,7 +96,7 @@ class Alarm(SmartModule):
)
@property
def alarm_sound(self):
def alarm_sound(self) -> str:
"""Return current alarm sound."""
return self.data["get_alarm_configure"]["type"]
@ -113,11 +115,11 @@ class Alarm(SmartModule):
return self.data["get_support_alarm_type_list"]["alarm_type_list"]
@property
def alarm_volume(self):
def alarm_volume(self) -> Literal["low", "normal", "high"]:
"""Return alarm volume."""
return self.data["get_alarm_configure"]["volume"]
async def set_alarm_volume(self, volume: str):
async def set_alarm_volume(self, volume: Literal["low", "normal", "high"]):
"""Set alarm volume."""
payload = self.data["get_alarm_configure"].copy()
payload["volume"] = volume
@ -134,10 +136,10 @@ class Alarm(SmartModule):
src = self._device.sys_info["in_alarm_source"]
return src if src else None
async def play(self):
async def play(self) -> dict:
"""Play alarm."""
return await self.call("play_alarm")
async def stop(self):
async def stop(self) -> dict:
"""Stop alarm."""
return await self.call("stop_alarm")