home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.15k stars 29.83k forks source link

Commit #120026 (Switch onkyo to pyeiscp, making it local_push) breaks command concurrency #123143

Open damocles-dev opened 1 month ago

damocles-dev commented 1 month ago

The problem

Hello,

Since the update to 2024.07, if any command is executed without being with hass, it can cause communication failures between hass and the avr.

When hass starts, it makes a tcp connection to port 60128 that it keeps open to communicate with the avr.

If any command is executed to the avr with another app such the onkyo python package, the avr ends the communication with hass and performs the communication for the operation that was just sent to it.

So if hass performs any operation afterwards, a new connection is established with the avr.

When the integration used poll, sending concurrent commands did not affect any of the operations, but when communication is done with push, the external application is not able to communicate with the avr and, in addition, the connection between hass and the avr may fail and not be able to communicate with it.

Onkyo integration allows you to perform basic operations, if you need to do any other operation such as getting the internal temperature or making adjustments to bass, treble, subwoofer, listening modes, etc., the CLI command is used.

In the following fragment with 2024.06 you can see that a connection is started in packet 47 and in the relative time we see that at 10 second intervals it performs the poll which would be packets 55 and 63.

Note: host .7 is hass and host .8 is the avr

number  time                    time_relative   ip.src      ip.dst      srcport dstport tcp.flags.str
47  Aug  1, 2024 21:35:28.594184018 CEST    12.199135413    10.20.30.7  10.20.30.8  40704   60128   ··········S·
48  Aug  1, 2024 21:35:28.594562268 CEST    12.199513663    10.20.30.8  10.20.30.7  60128   38540   ·······A····
49  Aug  1, 2024 21:35:28.595011721 CEST    12.199963116    10.20.30.8  10.20.30.7  60128   40704   ·······A··S·
50  Aug  1, 2024 21:35:28.595027357 CEST    12.199978752    10.20.30.7  10.20.30.8  40704   60128   ·······A····
51  Aug  1, 2024 21:35:28.595112422 CEST    12.200063817    10.20.30.7  10.20.30.8  40704   60128   ·······AP···
52  Aug  1, 2024 21:35:28.596138368 CEST    12.201089763    10.20.30.8  10.20.30.7  60128   40704   ·······A····
53  Aug  1, 2024 21:35:29.009055482 CEST    12.614006877    10.20.30.8  10.20.30.7  60128   40704   ·······AP···
54  Aug  1, 2024 21:35:29.009077215 CEST    12.614028610    10.20.30.7  10.20.30.8  40704   60128   ·······A····
55  Aug  1, 2024 21:35:38.593463539 CEST    22.198414934    10.20.30.7  10.20.30.8  40704   60128   ·······AP···
56  Aug  1, 2024 21:35:38.595799389 CEST    22.200750784    10.20.30.8  10.20.30.7  60128   40704   ·······A····
57  Aug  1, 2024 21:35:38.713783963 CEST    22.318735358    10.20.30.8  10.20.30.7  60128   40704   ·······AP···
58  Aug  1, 2024 21:35:38.713799197 CEST    22.318750592    10.20.30.7  10.20.30.8  40704   60128   ·······A····
59  Aug  1, 2024 21:35:38.714884506 CEST    22.319835901    10.20.30.7  10.20.30.8  40704   60128   ·······AP···
60  Aug  1, 2024 21:35:38.715728212 CEST    22.320679607    10.20.30.8  10.20.30.7  60128   40704   ·······A····
61  Aug  1, 2024 21:35:38.911331797 CEST    22.516283192    10.20.30.8  10.20.30.7  60128   40704   ·······AP···
62  Aug  1, 2024 21:35:38.952090039 CEST    22.557041434    10.20.30.7  10.20.30.8  40704   60128   ·······A····
63  Aug  1, 2024 21:35:48.593948887 CEST    32.198900282    10.20.30.7  10.20.30.8  40704   60128   ·······AP···
64  Aug  1, 2024 21:35:48.596376161 CEST    32.201327556    10.20.30.8  10.20.30.7  60128   40704   ·······A····
65  Aug  1, 2024 21:35:48.683597267 CEST    32.288548662    10.20.30.8  10.20.30.7  60128   40704   ·······AP···
66  Aug  1, 2024 21:35:48.683620511 CEST    32.288571906    10.20.30.7  10.20.30.8  40704   60128   ·······A····
67  Aug  1, 2024 21:35:48.684709333 CEST    32.289660728    10.20.30.7  10.20.30.8  40704   60128   ·······AP···
68  Aug  1, 2024 21:35:48.685597255 CEST    32.290548650    10.20.30.8  10.20.30.7  60128   40704   ·······A····
69  Aug  1, 2024 21:35:48.930300505 CEST    32.535251900    10.20.30.8  10.20.30.7  60128   40704   ·······AP···
70  Aug  1, 2024 21:35:48.971090269 CEST    32.576041664    10.20.30.7  10.20.30.8  40704   60128   ·······A····

for this poll the log shows:

2024-08-01 21:35:38.714 DEBUG (SyncWorker_7) [homeassistant.components.onkyo.media_player] Result for system-power query: ('system-power', ('standby', 'off'))
2024-08-01 21:35:38.911 DEBUG (SyncWorker_9) [homeassistant.components.onkyo.media_player] Result for zone2.power=query: ('power', 'standby')

If I now run a command for e.g. get temperature:

$ onkyo --host avr main.temperature-data=query 
TX-NR6100: temperature-data = F 77C 25

we see that the avr closes the connection it had with hass in packet 102 and closes the new connection in packets 106 and 107:

number  time                    time_relative   ip.src      ip.dst      srcport dstport tcp.flags.str
97  Aug  1, 2024 21:36:19.388304209 CEST    62.993255604    10.20.30.7  10.20.30.8  59052   60128   ··········S·
98  Aug  1, 2024 21:36:19.390204423 CEST    62.995155818    10.20.30.8  10.20.30.7  60128   59052   ·······A··S·
99  Aug  1, 2024 21:36:19.390225374 CEST    62.995176769    10.20.30.7  10.20.30.8  59052   60128   ·······A····
100 Aug  1, 2024 21:36:19.390428735 CEST    62.995380130    10.20.30.7  10.20.30.8  59052   60128   ·······AP···
101 Aug  1, 2024 21:36:19.392016560 CEST    62.996967955    10.20.30.8  10.20.30.7  60128   59052   ·······A····
102 Aug  1, 2024 21:36:19.396000522 CEST    63.000951917    10.20.30.8  10.20.30.7  60128   40704   ·······A···F
103 Aug  1, 2024 21:36:19.436094434 CEST    63.041045829    10.20.30.7  10.20.30.8  40704   60128   ·······A····
104 Aug  1, 2024 21:36:19.784860545 CEST    63.389811940    10.20.30.8  10.20.30.7  60128   59052   ·······AP···
105 Aug  1, 2024 21:36:19.784875739 CEST    63.389827134    10.20.30.7  10.20.30.8  59052   60128   ·······A····
106 Aug  1, 2024 21:36:19.785068218 CEST    63.390019613    10.20.30.7  10.20.30.8  59052   60128   ·······A···F
107 Aug  1, 2024 21:36:19.788964677 CEST    63.393916072    10.20.30.8  10.20.30.7  60128   59052   ·······A···F
108 Aug  1, 2024 21:36:19.788977662 CEST    63.393929057    10.20.30.7  10.20.30.8  59052   60128   ·······A····

now the next poll comes and since the connection was previously closed it needs to open a new one in packet 122:

number  time                    time_relative   ip.src      ip.dst      srcport dstport tcp.flags.str
122 Aug  1, 2024 21:36:28.598622030 CEST    72.203573425    10.20.30.7  10.20.30.8  59074   60128   ··········S·
123 Aug  1, 2024 21:36:28.598991044 CEST    72.203942439    10.20.30.8  10.20.30.7  60128   40704   ·······A····
124 Aug  1, 2024 21:36:28.599419196 CEST    72.204370591    10.20.30.8  10.20.30.7  60128   59074   ·······A··S·
125 Aug  1, 2024 21:36:28.599435305 CEST    72.204386700    10.20.30.7  10.20.30.8  59074   60128   ·······A····
126 Aug  1, 2024 21:36:28.599477775 CEST    72.204429170    10.20.30.7  10.20.30.8  59074   60128   ·······AP···

this new connection is registered by hass:

2024-08-01 21:36:28.596 DEBUG (SyncWorker_7) [homeassistant.components.onkyo.media_player] Resetting connection to Onkyo AVR

we were able to run a command and hass recovers without problem.

With 2024.07 and the change from poll to push the following occurs.

A lot more information is sent starting with packet 1 up to 87:

number  time                    time_relative   ip.src      ip.dst      srcport dstport tcp.flags.str
1   Aug  1, 2024 21:44:09.720172398 CEST    0.000000000 10.20.30.7  10.20.30.8  56906   60128   ··········S·
2   Aug  1, 2024 21:44:09.722671152 CEST    0.002498754 10.20.30.8  10.20.30.7  60128   56906   ·······A··S·
[...]
86  Aug  1, 2024 21:44:12.000645712 CEST    2.280473314 10.20.30.8  10.20.30.7  60128   56906   ·······AP···
87  Aug  1, 2024 21:44:12.000660643 CEST    2.280488245 10.20.30.7  10.20.30.8  56906   60128   ·······A····

in this case the connection remains busy for a few seconds:

2024-08-01 21:44:09.714 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Manually creating receiver: Onkyo AVR (avr)
2024-08-01 21:44:09.727 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Adding Main Zone on Onkyo AVR
2024-08-01 21:44:09.729 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-01 21:44:10.348 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'power', 'standby')
2024-08-01 21:44:10.348 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Discovered Zone 2 on Onkyo AVR
2024-08-01 21:44:10.546 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'system-power', ('standby', 'off'))
2024-08-01 21:44:10.711 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'master-volume', 60)
2024-08-01 21:44:11.184 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'preset', 7)
2024-08-01 21:44:11.184 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'hdmi-output-selector', ('yes', 'out'))
2024-08-01 21:44:11.392 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'audio-muting', 'off')
2024-08-01 21:44:11.410 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'input-selector', ('video6', 'pc'))
2024-08-01 21:44:11.544 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'listening-mode', 'all-ch-stereo')
2024-08-01 21:44:11.560 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'audio-information', ('HDMI 5', 'PCM', '44.1 kHz', '2.0 ch', 'All Ch Stereo', '4.1 ch', ''))
2024-08-01 21:44:11.658 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'video-information', ('HDMI 5', '4K(3840x2160) 60 Hz', 'RGB', '24bit', 'MAIN', '4K(0x0      ) 60 Hz', '', '24bit', '', '', ''))
2024-08-01 21:44:11.658 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'system-power', ('standby', 'off'))
2024-08-01 21:44:11.712 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'master-volume', 60)
2024-08-01 21:44:11.712 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'preset', 7)
2024-08-01 21:44:11.725 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'hdmi-output-selector', ('yes', 'out'))
2024-08-01 21:44:11.816 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'audio-muting', 'off')
2024-08-01 21:44:11.849 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'input-selector', ('video6', 'pc'))
2024-08-01 21:44:11.995 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'listening-mode', 'all-ch-stereo')
2024-08-01 21:44:12.021 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'audio-information', ('HDMI 5', 'PCM', '44.1 kHz', '2.0 ch', 'All Ch Stereo', '4.1 ch', ''))

if we now run command by cli we get:

$ onkyo --host avr main.temperature-data=query
Traceback (most recent call last):
  File "/home/users/hass/homeassistant/bin/onkyo", line 8, in 
    sys.exit(run())
             ^^^^^
  File "/home/users/hass/homeassistant/lib/python3.12/site-packages/eiscp/script.py", line 179, in run
    sys.exit(main() or 0)
             ^^^^^^
  File "/home/users/hass/homeassistant/lib/python3.12/site-packages/eiscp/script.py", line 136, in main
    response = receiver.raw(iscp_message)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/users/hass/homeassistant/lib/python3.12/site-packages/eiscp/core.py", line 470, in raw
    return filter_for_message(self.get, iscp_message)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/users/hass/homeassistant/lib/python3.12/site-packages/eiscp/core.py", line 260, in filter_for_message
    candidate = getter_func(0.05)
                ^^^^^^^^^^^^^^^^^
  File "/home/users/hass/homeassistant/lib/python3.12/site-packages/eiscp/core.py", line 440, in get
    header = eISCPPacket.parse_header(header_bytes)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/users/hass/homeassistant/lib/python3.12/site-packages/eiscp/core.py", line 101, in parse_header
    assert len(bytes) == 16
           ^^^^^^^^^^^^^^^^
AssertionError

and the information requested by cli is passed to hass as callback at "21:46:16.186":

2024-08-01 21:46:14.711 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-01 21:46:14.998 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'system-power', 'on')
2024-08-01 21:46:15.023 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-01 21:46:15.119 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'master-volume', 60)
2024-08-01 21:46:15.140 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'preset', 7)
2024-08-01 21:46:15.160 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'hdmi-output-selector', ('yes', 'out'))
2024-08-01 21:46:15.180 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'audio-muting', 'off')
2024-08-01 21:46:15.200 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'input-selector', ('video6', 'pc'))
2024-08-01 21:46:15.221 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'listening-mode', 'all-ch-stereo')
2024-08-01 21:46:15.241 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'audio-information', ('HDMI 5', 'PCM', '44.1 kHz', '2.0 ch', 'All Ch Stereo', '4.1 ch', ''))
2024-08-01 21:46:15.263 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'video-information', ('HDMI 5', '4K(3840x2160) 60 Hz', 'RGB', '24bit', 'MAIN', '4K(0x0      ) 60 Hz', '', '24bit', '', '', ''))
2024-08-01 21:46:15.282 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'power', 'standby')
2024-08-01 21:46:15.302 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'volume', 58)
2024-08-01 21:46:15.323 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'preset', 7)
2024-08-01 21:46:15.342 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'muting', 'off')
2024-08-01 21:46:15.363 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'selector', 'fm')
2024-08-01 21:46:15.655 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'system-power', 'on')
2024-08-01 21:46:15.676 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'master-volume', 60)
2024-08-01 21:46:15.696 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'preset', 7)
2024-08-01 21:46:15.717 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'hdmi-output-selector', ('yes', 'out'))
2024-08-01 21:46:15.737 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'audio-muting', 'off')
2024-08-01 21:46:15.758 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'input-selector', ('video6', 'pc'))
2024-08-01 21:46:15.777 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'listening-mode', 'all-ch-stereo')
2024-08-01 21:46:15.797 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'audio-information', ('HDMI 5', 'PCM', '44.1 kHz', '2.0 ch', 'All Ch Stereo', '4.1 ch', ''))
2024-08-01 21:46:15.817 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'video-information', ('HDMI 5', '4K(3840x2160) 60 Hz', 'RGB', '24bit', 'MAIN', '4K(0x0      ) 60 Hz', '', '24bit', '', '', ''))
2024-08-01 21:46:15.857 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'volume', 58)
2024-08-01 21:46:15.877 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'preset', 7)
2024-08-01 21:46:15.884 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-01 21:46:15.898 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'muting', 'off')
2024-08-01 21:46:15.918 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'selector', 'fm')
2024-08-01 21:46:15.938 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'power', 'standby')
2024-08-01 21:46:16.186 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'temperature-data', 'F 77C 25')
2024-08-01 21:46:16.295 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'system-power', 'on')
2024-08-01 21:46:16.315 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'master-volume', 60)
2024-08-01 21:46:16.335 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'preset', 7)
2024-08-01 21:46:16.356 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'hdmi-output-selector', ('yes', 'out'))
2024-08-01 21:46:16.376 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'audio-muting', 'off')
2024-08-01 21:46:16.397 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'input-selector', ('video6', 'pc'))
2024-08-01 21:46:16.417 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'listening-mode', 'all-ch-stereo')
2024-08-01 21:46:16.537 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'audio-information', ('HDMI 5', 'PCM', '44.1 kHz', '2.0 ch', 'All Ch Stereo', '4.1 ch', ''))
2024-08-01 21:46:16.558 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'video-information', ('HDMI 5', '4K(3840x2160) 60 Hz', 'RGB', '24bit', 'MAIN', '4K(0x0      ) 60 Hz', '', '24bit', '', '', ''))

the problem is not only that the command does not work for us to perform the operations that hass does not perform natively but that executing it can confuse hass and be unable to use the avr for a period of time.

in fact if you run the command a few times it performs a DoS and hass takes several seconds to regain control:

watch -n 0.2 onkyo --host avr main.temperature-data=query
2024-08-04 10:36:37.004 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'power', 'standby')
2024-08-04 10:36:37.077 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'volume', 58)
2024-08-04 10:36:37.103 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:37.252 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:37.402 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:37.547 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:37.583 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'preset', 7)
2024-08-04 10:36:37.585 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'muting', 'off')
2024-08-04 10:36:37.585 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'selector', 'fm')
2024-08-04 10:36:37.692 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:37.842 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:37.993 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:38.063 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'temperature-data', 'F 77C 25')
2024-08-04 10:36:38.141 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:38.289 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:38.439 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:38.587 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:38.734 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:38.821 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'system-power', 'on')
2024-08-04 10:36:38.822 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'master-volume', 60)
2024-08-04 10:36:38.822 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'preset', 7)
2024-08-04 10:36:38.823 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'hdmi-output-selector', ('yes', 'out'))
2024-08-04 10:36:38.883 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:38.972 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'audio-muting', 'off')
2024-08-04 10:36:39.030 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:39.177 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:39.326 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:39.403 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'input-selector', ('video6', 'pc'))
2024-08-04 10:36:39.405 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'listening-mode', 'all-ch-stereo')
2024-08-04 10:36:39.405 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'audio-information', ('HDMI 5', 'PCM', '44.1 kHz', '2.0 ch', 'All Ch Stereo', '4.1 ch', ''))
2024-08-04 10:36:39.405 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'video-information', ('HDMI 5', '4K(3840x2160) 60 Hz', 'RGB', '24bit', 'MAIN', '4K(0x0      ) 60 H
z', '', '24bit', '', '', ''))
2024-08-04 10:36:39.405 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'power', 'standby')
2024-08-04 10:36:39.405 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'volume', 58)
2024-08-04 10:36:39.428 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'preset', 7)
2024-08-04 10:36:39.475 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:39.625 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:39.775 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:39.923 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:40.073 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:40.161 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'muting', 'off')
2024-08-04 10:36:40.163 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('zone2', 'selector', 'fm')
2024-08-04 10:36:40.163 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Received update callback from Onkyo AVR: ('main', 'temperature-data', 'F 77C 25')
2024-08-04 10:36:40.222 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:40.372 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:40.522 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:40.672 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)
2024-08-04 10:36:40.820 DEBUG (MainThread) [homeassistant.components.onkyo.media_player] Receiver (re)connected: Onkyo AVR (avr)

I don't know if it's possible to be able to run commands to make adjustments that hass can't do directly, this integration was the reason I started using hass and it would be desirable not to lose this functionality.

What version of Home Assistant Core has the issue?

core-2024.7.4

What was the last working version of Home Assistant Core?

core-2024.6.4

What type of installation are you running?

Home Assistant Core

Integration causing the issue

onkyo

Link to integration documentation on our website

https://www.home-assistant.io/integrations/onkyo/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 month ago

Hey there @arturpragacz, mind taking a look at this issue as it has been labeled with an integration (onkyo) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `onkyo` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign onkyo` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


onkyo documentation onkyo source (message by IssueLinks)

arturpragacz commented 1 month ago

Using any kind of external command like that is not and never was a supported use case.

Onkyo integration allows you to perform basic operations, if you need to do any other operation such as getting the internal temperature or making adjustments to bass, treble, subwoofer, listening modes, etc., the CLI command is used.

Things like that should be supported in the integration itself, in the form of additional sensors and services. There is a plan to extend the integration to support those use cases, but we first need to migrate it to config flow. Using any external executable, especially running on the same host, is the very wrong way to do this.

That being said, I will keep this issue open for now, because there is unfortunately also a more general problem with receiver not properly staying connected and having more logs is always good for troubleshooting. It would be good if you could post the packets from the time the integration gets confused about the input from external command and also from the time it is being constantly reconnected. Also, if you can, please mention what exact receiver model you are using.

damocles-dev commented 1 month ago

It would certainly be the best option to be able to control the extended functionalities using hass but for years the only option was to use commands via cli and right now it is impossible.

The avr is the current mid-range one for home theater: TX-NR6100

I incorporate the logs of a hass execution and a loop of operations that causes reconnections in the communication between the avr and hass.

If multiple operations are issued these accumulate and keep the avr busy sending the responses to hass over several seconds and during these responses hass is unable to correctly perform other operations.

the following logs are the result of the following command: watch -n .2 onkyo --host avr main.system-power=query

the times in the hass logs and in the captures are aligned and you can see how once the sending is finished it continues receiving updates. home-assistant_onkyo_debug_log.txt ha_onkyo.pcap.zip

trancefam commented 1 month ago

I have a TX-NR6050. For a couple years now I've also ran unsupported actions using

shell_command:
  onkyo_command: onkyo --host 10.0.0.5 {{ cmd }}

and then using it with a separate script call such as:

script:
  receiver_lr_quick_menu:
    alias: Receiver LR quick menu
    sequence:
      - service: shell_command.onkyo_command
        data:
          cmd: OSDQUICK

This worked fine, I know it isn't the intended use case but the functionality I needed wasn't there. Similar to others, this functionality broke after around the 2024.07 update.

After seeing the discussions, I decided to poke around and try an alternative solution. I know the receiver has a new (or new-to-me) UI at http://10.0.0.5/websetup.htm. After inspecting the web requests, I noticed there is a direct API you can call to pass in the lower level ISCP command you want: http://10.0.0.5/iscp_req.cgi?iscp=!1{command}. For example, to get audio info: http://10.0.0.5/iscp_req.cgi?iscp=!1IFAQSTN. The only requirement is to add the header Authorization: Bearer {base64 encoded version of username:password}.

Knowing that, I updated my existing sensors/scripts to use this. It doesn't seem to be impacted by having the HA onkyo integration still enabled, and Update: Using the API does seem to break the onkyo integration. To adjust for this, I updated my code sample below to use a "Universal Media Player" and added commands for power on/off, volume up/down/mute.

From my testing, the API is actually much faster than using the older shell_command action (example at top).

I've included a snippet of my code below, in hopes that this saves time for someone. I look forward to the next phase of this integration so this level of manual setup isn't necessary anymore. In the meantime, the below code can help bridge the gap until we get there for anyone else that was impacted by this change.

Code sample

Click to view code sample ```yml ########################################################## ## Secrets - base64 encoded version of "username:password" (the below is fake) - change it to yours ########################################################## receiver_lr_auth_base64: Basic dXNlcm5hbWU6cGFzc3dvcmQ= ########################################################## ## Media player ########################################################## media_player: - platform: universal name: Onkyo Receiver Living Room unique_id: receiver_lr commands: turn_on: action: rest_command.onkyo_command data: cmd: PWR01 turn_off: action: rest_command.onkyo_command data: cmd: PWR00 volume_up: action: rest_command.onkyo_command data: cmd: MVLUP volume_down: action: rest_command.onkyo_command data: cmd: MVLDOWN volume_mute: action: switch.toggle target: entity_id: switch.receiver_lr_mute select_source: action: select.select_option data: entity_id: select.receiver_lr_source option: "{{ source }}" attributes: is_volume_muted: sensor.receiver_lr_mute state: switch.receiver_lr_power source_list: select.receiver_lr_source|options source: sensor.receiver_lr_source device_class: receiver ########################################################## ## Sensors ########################################################## sensor: - platform: rest name: Receiver LR Power unique_id: bcec6202-0c54-4b94-8536-19736857c921 resource: http://10.0.0.5/iscp_req.cgi?iscp=!1PWRQSTN value_template: "{% set prefix = '!1PWR' %}{{ (value_json.ISCP[0][prefix | length:] if value_json.ISCP | length > 0 and value_json.ISCP[0].startswith(prefix) and (value_json.ISCP[0][prefix | length:] | length) > 0) | default('Unavailable') | replace('01', 'on') | replace('00', 'off') }}" scan_interval: 3 method: GET headers: Authorization: !secret receiver_lr_auth_base64 - platform: rest name: Receiver LR Mute unique_id: 10129bb6-8d01-4e83-8c60-a67d53e2fa0e resource: http://10.0.0.5/iscp_req.cgi?iscp=!1AMTQSTN value_template: "{% set prefix = '!1AMT' %}{{ (value_json.ISCP[0][prefix | length:] if value_json.ISCP | length > 0 and value_json.ISCP[0].startswith(prefix) and (value_json.ISCP[0][prefix | length:] | length) > 0) | default('Unavailable') | replace('01', 'on') | replace('00', 'off') }}" scan_interval: 4 method: GET headers: Authorization: !secret receiver_lr_auth_base64 - platform: rest name: Receiver LR Source unique_id: a41d1c41-7f78-4b39-be88-d780bfefb4fa resource: http://10.0.0.5/iscp_req.cgi?iscp=!1SLIQSTN value_template: > {% set prefix = '!1SLI' %} {% if value_json.ISCP | length > 0 and value_json.ISCP[0].startswith(prefix) %} {% set value = value_json.ISCP[0][prefix | length:] %} {% if value == '11' %}Shield {% elif value == '05' %}PC {% elif value == '2B' %}Network {% elif value == '2E' %}Bluetooth {% else %}Unavailable {% endif %} {% else %}Unavailable {% endif %} scan_interval: 4 method: GET headers: Authorization: !secret receiver_lr_auth_base64 - platform: rest name: Receiver LR Listening mode unique_id: 93362d6b-a6e3-4b32-9c12-736f0a71f389 resource: http://10.0.0.5/iscp_req.cgi?iscp=!1IFAQSTN value_template: > {% set prefix = '!1IFA' %} {% set content = value_json.ISCP[0][prefix | length:] if value_json.ISCP | length > 0 and value_json.ISCP[0].startswith(prefix) else '' %} {% set content_trimmed = content[prefix | length:] %} {% set count_commas = content_trimmed.count(',') %} {% if count_commas >= 4 %} {% set start = content_trimmed.find(',', content_trimmed.find(',', content_trimmed.find(',', content_trimmed.find(',', 0) + 1) + 1) + 1) + 1 %} {% set end = content_trimmed.find(',', start) %} {% if end == -1 %} {{ content_trimmed[start:] | trim }} {% else %} {{ content_trimmed[start:end] | trim }} {% endif %} {% else %} Unavailable {% endif %} scan_interval: 5 method: GET headers: Authorization: !secret receiver_lr_auth_base64 - platform: rest name: Receiver LR Audio info unique_id: bec80fbc-ed32-4c6d-b0dd-e7ccba6f06d6 resource: http://10.0.0.5/iscp_req.cgi?iscp=!1IFAQSTN value_template: "{% set prefix = '!1IFA' %}{{ (value_json.ISCP[0][prefix | length:] if value_json.ISCP | length > 0 and value_json.ISCP[0].startswith(prefix) and (value_json.ISCP[0][prefix | length:] | length) > 0) | default('Unavailable') }}" scan_interval: 20 method: GET headers: Authorization: !secret receiver_lr_auth_base64 - platform: rest name: Receiver LR Video info unique_id: 1aed476e-2a12-4b32-a29d-da9a7232a272 resource: http://10.0.0.5/iscp_req.cgi?iscp=!1IFVQSTN value_template: "{% set prefix = '!1IFV' %}{{ (value_json.ISCP[0][prefix | length:] if value_json.ISCP | length > 0 and value_json.ISCP[0].startswith(prefix) and (value_json.ISCP[0][prefix | length:] | length) > 0) | default('Unavailable') }}" scan_interval: 29 method: GET headers: Authorization: !secret receiver_lr_auth_base64 - platform: rest name: Receiver LR Vocal level unique_id: 65866f11-7bfe-4f27-aa64-d59dd6898a5d resource: http://10.0.0.5/iscp_req.cgi?iscp=!1VOCQSTN value_template: "{% set prefix = '!1VOC0' %}{{ (value_json.ISCP[0][prefix | length:] if value_json.ISCP | length > 0 and value_json.ISCP[0].startswith(prefix) and (value_json.ISCP[0][prefix | length:] | length) > 0) | default('Unavailable') }}" scan_interval: 4 method: GET headers: Authorization: !secret receiver_lr_auth_base64 - platform: rest name: Receiver LR Subwoofer level unique_id: c85faf8a-c4e9-4abd-a47f-4844a5ac44ad resource: http://10.0.0.5/iscp_req.cgi?iscp=!1SWLQSTN value_template: "{% set prefix = '!1SWL' %}{{ (value_json.ISCP[0][prefix | length:] if value_json.ISCP | length > 0 and value_json.ISCP[0].startswith(prefix) and (value_json.ISCP[0][prefix | length:] | length) > 0) | default('Unavailable') }}" scan_interval: 6 method: GET headers: Authorization: !secret receiver_lr_auth_base64 - platform: rest name: Receiver LR Late night unique_id: 096fdb0c-d0f2-4a7f-b86c-d6dcafa3c021 resource: http://10.0.0.5/iscp_req.cgi?iscp=!1LTNQSTN value_template: "{% set prefix = '!1LTN' %}{{ (value_json.ISCP[0][prefix | length:] if value_json.ISCP | length > 0 and value_json.ISCP[0].startswith(prefix) and (value_json.ISCP[0][prefix | length:] | length) > 0) | default('Unavailable') }}" scan_interval: 11 method: GET headers: Authorization: !secret receiver_lr_auth_base64 # results: 0 is off, 1 is modified for music - platform: rest name: Receiver LR Manual Eq Preset unique_id: ce2b262e-c3b6-49d5-afdf-0051a53f5d1e resource: http://10.0.0.5/iscp_req.cgi?iscp=!1EQSQSTN value_template: "{% set prefix = '!1EQS0' %}{{ (value_json.ISCP[0][prefix | length:] if value_json.ISCP | length > 0 and value_json.ISCP[0].startswith(prefix) and (value_json.ISCP[0][prefix | length:] | length) > 0) | default('Unavailable') }}" scan_interval: 9 method: GET headers: Authorization: !secret receiver_lr_auth_base64 ########################################################## ## Switches ########################################################## switch: - platform: template switches: receiver_lr_power: unique_id: 6e8e561b-81eb-4fed-a4cc-c4ad7a15a318 friendly_name: "Receiver LR Power" value_template: "{{ is_state('sensor.receiver_lr_power', 'on') }}" turn_on: action: rest_command.onkyo_command data: cmd: PWR01 turn_off: action: rest_command.onkyo_command data: cmd: PWR00 - platform: template switches: receiver_lr_mute: unique_id: c365840e-d8e2-4d94-bb6f-195795a985f7 friendly_name: "Receiver LR Mute" value_template: "{{ is_state('sensor.receiver_lr_mute', 'on') }}" turn_on: action: rest_command.onkyo_command data: cmd: AMT01 turn_off: action: rest_command.onkyo_command data: cmd: AMT00 ########################################################## ## Templates ########################################################## template: - select: - name: Receiver Living Room Source unique_id: receiver_lr_source options: "{{['Shield','PC','Network','Bluetooth']}}" state: "{{ states('sensor.receiver_lr_source') }}" select_option: service: rest_command.onkyo_command data: cmd: > {% if option == 'Shield' %}SLI11 {% elif option == 'PC' %}SLI05 {% elif option == 'Network' %}SLI2B {% elif option == 'Bluetooth' %}SLI2E {% else %}SLI11 {% endif %} ########################################################## ## Rest command ########################################################## rest_command: onkyo_command: url: "http://10.0.0.5/iscp_req.cgi?iscp=!1{{ cmd }}" method: GET headers: authorization: !secret receiver_lr_auth_base64 ########################################################## ## Scripts ########################################################## script: #Common buttons receiver_lr_menu: alias: Receiver LR menu sequence: - service: rest_command.onkyo_command data: cmd: OSDMENU receiver_lr_quick_menu: alias: Receiver LR quick menu sequence: - service: rest_command.onkyo_command data: cmd: OSDQUICK receiver_lr_up: alias: Receiver LR up sequence: - service: rest_command.onkyo_command data: cmd: OSDUP receiver_lr_down: alias: Receiver LR down sequence: - service: rest_command.onkyo_command data: cmd: OSDDOWN receiver_lr_left: alias: Receiver LR left sequence: - service: rest_command.onkyo_command data: cmd: OSDLEFT receiver_lr_right: alias: Receiver LR right sequence: - service: rest_command.onkyo_command data: cmd: OSDRIGHT receiver_lr_enter: alias: Receiver LR enter sequence: - service: rest_command.onkyo_command data: cmd: OSDENTER receiver_lr_exit: alias: Receiver LR exit sequence: - service: rest_command.onkyo_command data: cmd: OSDEXIT #Vocal receiver_lr_vocal_up: alias: Receiver LR vocal up sequence: - service: rest_command.onkyo_command data: cmd: VOCUP receiver_lr_vocal_down: alias: Receiver LR vocal down sequence: - service: rest_command.onkyo_command data: cmd: VOCDOWN #Subwoofer receiver_lr_subwoofer_up: alias: Receiver LR subwoofer up sequence: - service: rest_command.onkyo_command data: cmd: SWLUP receiver_lr_subwoofer_down: alias: Receiver LR subwoofer down sequence: - service: rest_command.onkyo_command data: cmd: SWLDOWN #Listening modes receiver_lr_listening_mode_stereo: alias: Receiver LR listening mode - stereo sequence: - service: rest_command.onkyo_command data: cmd: LMD00 receiver_lr_listening_mode_all_ch_stereo: alias: Receiver LR listening mode - all ch stereo sequence: - service: rest_command.onkyo_command data: cmd: LMD0C receiver_lr_listening_mode_dolby_surround: alias: Receiver LR listening mode - dolby surround sequence: - service: rest_command.onkyo_command data: cmd: LMD80 receiver_lr_listening_mode_up: alias: Receiver LR listening mode - up sequence: - service: rest_command.onkyo_command data: cmd: LMDUP receiver_lr_listening_mode_down: alias: Receiver LR listening mode - down sequence: - service: rest_command.onkyo_command data: cmd: LMDDOWN #Late night receiver_lr_late_night_up: alias: Receiver LR late night up sequence: - service: rest_command.onkyo_command data: cmd: LTNUP #Eq presets - can also do eqs02 and 03, but not in use currently receiver_lr_eq_preset_off: alias: Receiver LR EQ preset - off sequence: - service: rest_command.onkyo_command data: cmd: EQS00 receiver_lr_eq_preset_1: alias: Receiver LR EQ preset - 1 music sequence: - service: rest_command.onkyo_command data: cmd: EQS01 #Sequence receiver_lr_toggle_zone_b: alias: Receiver LR toggle zone b sequence: - service: script.receiver_lr_quick_menu - delay: seconds: 0.5 - service: script.receiver_lr_down - delay: seconds: 0.5 - service: script.receiver_lr_enter - delay: seconds: 0.5 - service: script.receiver_lr_down - delay: seconds: 0.5 - service: script.receiver_lr_down - delay: seconds: 0.5 - service: script.receiver_lr_right - delay: seconds: 0.5 - service: script.receiver_lr_exit - delay: seconds: 0.5 - service: script.receiver_lr_exit receiver_lr_auto_set_music_mode: alias: Receiver LR auto - set music mode sequence: - service: script.receiver_lr_listening_mode_all_ch_stereo - delay: seconds: 4 - service: script.receiver_lr_eq_preset_1 receiver_lr_auto_set_tv_movie_mode: alias: Receiver LR auto - set tv/movie mode sequence: - service: script.receiver_lr_listening_mode_dolby_surround - delay: seconds: 4 - service: script.receiver_lr_eq_preset_off ```