Split update method in pioneer media player (#145212)

Split method in pioneer media player
This commit is contained in:
epenet 2025-05-19 17:40:12 +02:00 committed by GitHub
parent f44cb9b03e
commit e491629143
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -59,7 +59,7 @@ def setup_platform(
config[CONF_SOURCES], config[CONF_SOURCES],
) )
if pioneer.update(): if pioneer.update_device():
add_entities([pioneer]) add_entities([pioneer])
@ -122,7 +122,11 @@ class PioneerDevice(MediaPlayerEntity):
except telnetlib.socket.timeout: except telnetlib.socket.timeout:
_LOGGER.debug("Pioneer %s command %s timed out", self._name, command) _LOGGER.debug("Pioneer %s command %s timed out", self._name, command)
def update(self): def update(self) -> None:
"""Update the entity."""
self.update_device()
def update_device(self) -> bool:
"""Get the latest details from the device.""" """Get the latest details from the device."""
try: try:
telnet = telnetlib.Telnet(self._host, self._port, self._timeout) telnet = telnetlib.Telnet(self._host, self._port, self._timeout)