mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 02:37:08 +00:00
Split update method in pioneer media player (#145212)
Split method in pioneer media player
This commit is contained in:
parent
f44cb9b03e
commit
e491629143
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user