Improve type hint in denon media player entity (#77036)

This commit is contained in:
epenet 2022-08-20 08:40:51 +02:00 committed by GitHub
parent 1edb68f8ba
commit c9fe1f44b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -84,7 +84,7 @@ def setup_platform(
"""Set up the Denon platform."""
denon = DenonDevice(config[CONF_NAME], config[CONF_HOST])
if denon.update():
if denon.do_update():
add_entities([denon])
@ -161,8 +161,12 @@ class DenonDevice(MediaPlayerEntity):
telnet.read_very_eager() # skip response
telnet.close()
def update(self):
def update(self) -> None:
"""Get the latest details from the device."""
self.do_update()
def do_update(self) -> bool:
"""Get the latest details from the device, as boolean."""
try:
telnet = telnetlib.Telnet(self._host)
except OSError: