mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
parent
279f82acc4
commit
f09b888a8a
@ -62,7 +62,14 @@ class DenonDevice(MediaPlayerDevice):
|
|||||||
def telnet_request(cls, telnet, command):
|
def telnet_request(cls, telnet, command):
|
||||||
"""Execute `command` and return the response."""
|
"""Execute `command` and return the response."""
|
||||||
telnet.write(command.encode('ASCII') + b'\r')
|
telnet.write(command.encode('ASCII') + b'\r')
|
||||||
return telnet.read_until(b'\r', timeout=0.2).decode('ASCII').strip()
|
lines = []
|
||||||
|
while True:
|
||||||
|
line = telnet.read_until(b'\r', timeout=0.2)
|
||||||
|
if not line:
|
||||||
|
break
|
||||||
|
lines.append(line.decode('ASCII').strip())
|
||||||
|
|
||||||
|
return lines[0]
|
||||||
|
|
||||||
def telnet_command(self, command):
|
def telnet_command(self, command):
|
||||||
"""Establish a telnet connection and sends `command`."""
|
"""Establish a telnet connection and sends `command`."""
|
||||||
@ -79,9 +86,6 @@ class DenonDevice(MediaPlayerDevice):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
self._pwstate = self.telnet_request(telnet, 'PW?')
|
self._pwstate = self.telnet_request(telnet, 'PW?')
|
||||||
# PW? sends also SISTATUS, which is not interesting
|
|
||||||
telnet.read_until(b"\r", timeout=0.2)
|
|
||||||
|
|
||||||
volume_str = self.telnet_request(telnet, 'MV?')[len('MV'):]
|
volume_str = self.telnet_request(telnet, 'MV?')[len('MV'):]
|
||||||
self._volume = int(volume_str) / 60
|
self._volume = int(volume_str) / 60
|
||||||
self._muted = (self.telnet_request(telnet, 'MU?') == 'MUON')
|
self._muted = (self.telnet_request(telnet, 'MU?') == 'MUON')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user