mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Mark turn_on/turn_off/toggle as mandatory in pylint plugin (#145249)
* Mark turn_on/turn_off/toggle as mandatory in pylint plugin * Fixes
This commit is contained in:
parent
d15a1a6711
commit
f3f5fca0b9
@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from pyrainbird.exceptions import RainbirdApiException, RainbirdDeviceBusyException
|
||||
import voluptuous as vol
|
||||
@ -91,7 +92,7 @@ class RainBirdSwitch(CoordinatorEntity[RainbirdUpdateCoordinator], SwitchEntity)
|
||||
"""Return state attributes."""
|
||||
return {"zone": self._zone}
|
||||
|
||||
async def async_turn_on(self, **kwargs):
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the switch on."""
|
||||
try:
|
||||
await self.coordinator.controller.irrigate_zone(
|
||||
@ -111,7 +112,7 @@ class RainBirdSwitch(CoordinatorEntity[RainbirdUpdateCoordinator], SwitchEntity)
|
||||
self.async_write_ha_state()
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
async def async_turn_off(self, **kwargs):
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the switch off."""
|
||||
try:
|
||||
await self.coordinator.controller.stop_irrigation()
|
||||
|
@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from triggercmd import client, ha
|
||||
|
||||
@ -59,13 +60,13 @@ class TRIGGERcmdSwitch(SwitchEntity):
|
||||
"""Return True if hub is available."""
|
||||
return self._switch.hub.online
|
||||
|
||||
async def async_turn_on(self, **kwargs):
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the switch on."""
|
||||
await self.trigger("on")
|
||||
self._attr_is_on = True
|
||||
self.async_write_ha_state()
|
||||
|
||||
async def async_turn_off(self, **kwargs):
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the switch off."""
|
||||
await self.trigger("off")
|
||||
self._attr_is_on = False
|
||||
|
@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Any
|
||||
|
||||
from tuya_sharing import CustomerDevice, Manager
|
||||
|
||||
@ -165,11 +166,11 @@ class TuyaHumidifierEntity(TuyaEntity, HumidifierEntity):
|
||||
|
||||
return round(self._current_humidity.scale_value(current_humidity))
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
def turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the device on."""
|
||||
self._send_command([{"code": self._switch_dpcode, "value": True}])
|
||||
|
||||
def turn_off(self, **kwargs):
|
||||
def turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the device off."""
|
||||
self._send_command([{"code": self._switch_dpcode, "value": False}])
|
||||
|
||||
|
@ -801,18 +801,21 @@ _TOGGLE_ENTITY_MATCH: list[TypeHintMatch] = [
|
||||
kwargs_type="Any",
|
||||
return_type=None,
|
||||
has_async_counterpart=True,
|
||||
mandatory=True,
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="turn_off",
|
||||
kwargs_type="Any",
|
||||
return_type=None,
|
||||
has_async_counterpart=True,
|
||||
mandatory=True,
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="toggle",
|
||||
kwargs_type="Any",
|
||||
return_type=None,
|
||||
has_async_counterpart=True,
|
||||
mandatory=True,
|
||||
),
|
||||
]
|
||||
_INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user