Add type hints to alarm control panel method examples (#2591)

This commit is contained in:
Markus Adrario 2025-03-06 15:13:34 +01:00 committed by GitHub
parent bd8f380557
commit 74bd140fa3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -69,10 +69,10 @@ Send disarm command.
class MyAlarm(AlarmControlPanelEntity):
# Implement one of these methods.
def alarm_disarm(self, code=None) -> None:
def alarm_disarm(self, code: str | None = None) -> None:
"""Send disarm command."""
async def async_alarm_disarm(self, code=None) -> None:
async def async_alarm_disarm(self, code: str | None = None) -> None:
"""Send disarm command."""
```
@ -84,10 +84,10 @@ Send arm home command.
class MyAlarm(AlarmControlPanelEntity):
# Implement one of these methods.
def alarm_arm_home(self, code=None) -> None:
def alarm_arm_home(self, code: str | None = None) -> None:
"""Send arm home command."""
async def async_alarm_arm_home(self, code=None) -> None:
async def async_alarm_arm_home(self, code: str | None = None) -> None:
"""Send arm home command."""
```
@ -99,10 +99,10 @@ Send arm away command.
class MyAlarm(AlarmControlPanelEntity):
# Implement one of these methods.
def alarm_arm_away(self, code=None) -> None:
def alarm_arm_away(self, code: str | None = None) -> None:
"""Send arm away command."""
async def async_alarm_arm_away(self, code=None) -> None:
async def async_alarm_arm_away(self, code: str | None = None) -> None:
"""Send arm away command."""
```
@ -114,10 +114,10 @@ Send arm night command.
class MyAlarm(AlarmControlPanelEntity):
# Implement one of these methods.
def alarm_arm_night(self, code=None) -> None:
def alarm_arm_night(self, code: str | None = None) -> None:
"""Send arm night command."""
async def async_alarm_arm_night(self, code=None) -> None:
async def async_alarm_arm_night(self, code: str | None = None) -> None:
"""Send arm night command."""
```
@ -129,10 +129,10 @@ Send arm vacation command.
class MyAlarm(AlarmControlPanelEntity):
# Implement one of these methods.
def alarm_arm_vacation(self, code=None) -> None:
def alarm_arm_vacation(self, code: str | None = None) -> None:
"""Send arm vacation command."""
async def async_alarm_arm_vacation(self, code=None) -> None:
async def async_alarm_arm_vacation(self, code: str | None = None) -> None:
"""Send arm vacation command."""
```
@ -144,10 +144,10 @@ Send alarm trigger command.
class MyAlarm(AlarmControlPanelEntity):
# Implement one of these methods.
def alarm_trigger(self, code=None) -> None:
def alarm_trigger(self, code: str | None = None) -> None:
"""Send alarm trigger command."""
async def async_alarm_trigger(self, code=None) -> None:
async def async_alarm_trigger(self, code: str | None = None) -> None:
"""Send alarm trigger command."""
```
@ -159,9 +159,9 @@ Send arm custom bypass command.
class MyAlarm(AlarmControlPanelEntity):
# Implement one of these methods.
def alarm_arm_custom_bypass(self, code=None) -> None:
def alarm_arm_custom_bypass(self, code: str | None = None) -> None:
"""Send arm custom bypass command."""
async def async_alarm_arm_custom_bypass(self, code=None) -> None:
async def async_alarm_arm_custom_bypass(self, code: str | None = None) -> None:
"""Send arm custom bypass command."""
```