8000 Add missing type hints to alarm module (#1111) · msz-coder/python-kasa@2a89e58 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2a89e58

Browse files
authored
Add missing type hints to alarm module (python-kasa#1111)
1 parent a967d5c commit 2a89e58

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

kasa/smart/modules/alarm.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from __future__ import annotations
44

5+
from typing import Literal
6+
57
from ...feature import Feature
68
from ..smartmodule import SmartModule
79

@@ -94,7 +96,7 @@ def _initialize_features(self):
9496
)
9597

9698
@property
97-
def alarm_sound(self):
99+
def alarm_sound(self) -> str:
98100
"""Return current alarm sound."""
99101
return self.data["get_alarm_configure"]["type"]
100102

@@ -113,11 +115,11 @@ def alarm_sounds(self) -> list[str]:
113115
return self.data["get_support_alarm_type_list"]["alarm_type_list"]
114116

115117
@property
116-
def alarm_volume(self):
118+
def alarm_volume(self) -> Literal["low", "normal", "high"]:
117119
"""Return alarm volume."""
118120
return self.data["get_alarm_configure"]["volume"]
119121

120-
async def set_alarm_volume(self, volume: str):
122+
async def set_alarm_volume(self, volume: Literal["low", "normal", "high"]):
121123
"""Set alarm volume."""
122124
payload = self.data["get_alarm_configure"].copy()
123125
payload["volume"] = volume
@@ -134,10 +136,10 @@ def source(self) -> str | None:
134136
src = self._device.sys_info["in_alarm_source"]
135137
return src if src else None
136138

137-
async def play(self):
139+
async def play(self) -> dict:
138140
"""Play alarm."""
139141
return await self.call("play_alarm")
140142

141-
async def stop(self):
143+
async def stop(self) -> dict:
142144
"""Stop alarm."""
143145
return await self.call("stop_alarm")

0 commit comments

Comments
 (0)
0