Remove redundant turn_on/turn_off methods in samsungtv (#143939)

This commit is contained in:
epenet 2025-04-30 11:47:39 +02:00 committed by GitHub
parent ef023f084b
commit 4ac29c6aef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 18 deletions

View File

@ -2,6 +2,8 @@
from __future__ import annotations
from typing import Any
from wakeonlan import send_magic_packet
from homeassistant.const import (
@ -82,12 +84,12 @@ class SamsungTVEntity(CoordinatorEntity[SamsungTVDataUpdateCoordinator], Entity)
# broadcast a packet as well
send_magic_packet(self._mac)
async def _async_turn_off(self) -> None:
async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn the device off."""
await self._bridge.async_power_off()
await self.coordinator.async_refresh()
async def _async_turn_on(self) -> None:
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn the remote on."""
if self._turn_on_action:
LOGGER.debug("Attempting to turn on %s via automation", self.entity_id)

View File

@ -299,10 +299,6 @@ class SamsungTVDevice(SamsungTVEntity, MediaPlayerEntity):
return
await self._bridge.async_send_keys(keys)
async def async_turn_off(self) -> None:
"""Turn off media player."""
await super()._async_turn_off()
async def async_set_volume_level(self, volume: float) -> None:
"""Set volume level on the media player."""
if (dmr_device := self._dmr_device) is None:
@ -373,10 +369,6 @@ class SamsungTVDevice(SamsungTVEntity, MediaPlayerEntity):
keys=[f"KEY_{digit}" for digit in media_id] + ["KEY_ENTER"]
)
async def async_turn_on(self) -> None:
"""Turn the media player on."""
await super()._async_turn_on()
async def async_select_source(self, source: str) -> None:
"""Select input source."""
if self._app_list and source in self._app_list:

View File

@ -38,10 +38,6 @@ class SamsungTVRemote(SamsungTVEntity, RemoteEntity):
self._attr_is_on = self.coordinator.is_on
self.async_write_ha_state()
async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn the device off."""
await super()._async_turn_off()
async def async_send_command(self, command: Iterable[str], **kwargs: Any) -> None:
"""Send a command to a device.
@ -57,7 +53,3 @@ class SamsungTVRemote(SamsungTVEntity, RemoteEntity):
for _ in range(num_repeats):
await self._bridge.async_send_keys(command_list)
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn the remote on."""
await super()._async_turn_on()