Fix incompatible signature overwrite async_turn_on + off (#122208)

This commit is contained in:
Marc Mueller 2024-07-20 11:12:41 +02:00 committed by GitHub
parent 24b12bc509
commit e9f5c4188e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -4,6 +4,7 @@ from __future__ import annotations
from collections.abc import Awaitable, Callable from collections.abc import Awaitable, Callable
from dataclasses import dataclass from dataclasses import dataclass
from typing import Any
from pyecoforest.api import EcoforestApi from pyecoforest.api import EcoforestApi
from pyecoforest.models.device import Device from pyecoforest.models.device import Device
@ -61,12 +62,12 @@ class EcoforestSwitchEntity(EcoforestEntity, SwitchEntity):
"""Return the state of the ecoforest device.""" """Return the state of the ecoforest device."""
return self.entity_description.value_fn(self.data) return self.entity_description.value_fn(self.data)
async def async_turn_on(self): async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on the ecoforest device.""" """Turn on the ecoforest device."""
await self.entity_description.switch_fn(self.coordinator.api, True) await self.entity_description.switch_fn(self.coordinator.api, True)
await self.coordinator.async_request_refresh() await self.coordinator.async_request_refresh()
async def async_turn_off(self): async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn off the ecoforest device.""" """Turn off the ecoforest device."""
await self.entity_description.switch_fn(self.coordinator.api, False) await self.entity_description.switch_fn(self.coordinator.api, False)
await self.coordinator.async_request_refresh() await self.coordinator.async_request_refresh()

View File

@ -111,12 +111,12 @@ class V2CSwitchEntity(V2CBaseEntity, SwitchEntity):
"""Return the state of the EVSE switch.""" """Return the state of the EVSE switch."""
return self.entity_description.value_fn(self.data) return self.entity_description.value_fn(self.data)
async def async_turn_on(self): async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on the EVSE switch.""" """Turn on the EVSE switch."""
await self.entity_description.turn_on_fn(self.coordinator.evse) await self.entity_description.turn_on_fn(self.coordinator.evse)
await self.coordinator.async_request_refresh() await self.coordinator.async_request_refresh()
async def async_turn_off(self): async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn off the EVSE switch.""" """Turn off the EVSE switch."""
await self.entity_description.turn_off_fn(self.coordinator.evse) await self.entity_description.turn_off_fn(self.coordinator.evse)
await self.coordinator.async_request_refresh() await self.coordinator.async_request_refresh()