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