前言

  • 最近想整家庭 5.0 方案,于是在多多 3170 元购入了天龙 DENON AVR-X1800H 功放。价格方面还是比较满意,海鲜市场 X1700H 都要 2999 了IMG_0474

    4K 60Hz 输入 8K 60Hz 输入 8K 60Hz 输出 声道
    3 个 3 个 1 个 7.2
  • 音箱

    • 主:Polk ES20
    • 中置:Polk ES30
    • 环绕:Polk ES10
  • 线材

    • 音箱线:佳耐美 2S9F
    • HDMI线
      • <= 2米:优籁特铜线(是真便宜)
      • > 2米:优籁特光纤线(这玩意 10 米才 100 出头)

问题

  • 电视盒子和 PC 都接在功放上,然后功放接电视,一切看似很美好
  • 如果不开电视只开功放,功放每次开机也是上一次关机时候的输入源,这个也没有问题
  • 但是当我们接上电视的时候,操蛋的事情发生了,这个输入源会被电视盒子疯狂抢走,持续接近 1min,然后我们的 PC 由于没有获取到电视的 EDID,就会出现分辨率和缩放问题,只能重启

尝试解决

让我们捋一捋这个过程,由于 PC 的显卡没有 HDMI CEC,所以经过功放之后,电视那边是看不到 PC 的,电视的输入源只能看到电视盒子。当电视开机的时候,它就会通过 CEC 一直喊,你们谁活着吱一声,电视盒子都在下面喊,“我我我我我”,电视的输入源就切过去了。所以即使我们用功放切成 PC,电视还是会给输入源切到电视盒子,这个过程会持续接近 1min

  1. 那我们先尝试延迟 PC 开机,等电视稳定下来再把输入源切到 PC。我从 5s 尝试到了 30s,实在蚌埠住了,时间太久了,电视输入源还是经常会被抢走,所以我才在上面推断这个过程会持续 1min
  2. 那我们关掉电视的 CEC?LG 的 CEC 叫 SIMPLINK,即使我们关了它,在我们按下电视盒子的遥控器的时候,它还是会自动打开,难绷
  3. 会不会是 ARC 的问题?虽然我没走 ARC,但还是试试吧,把功放插在电视的非 ARC HDMI 口上。这下开机确实不会乱抢了,但是出现了一些另外的问题
    • 偶尔功放切输入源不会切过去,电视一直显示黑屏
    • PC 打开游戏电视不会自动进入游戏模式了,ALLM 失效了

吐槽

我是真蚌埠住了,难道只能 PC 直连电视,然后音频走 eARC 么?

最终解决办法

昨晚我突然灵机一动,既然你这么喜欢抢,那我把它抢回来不就行了?在开机执行后,每秒检查一下功放的输入源,如果不是 PC 就切到 PC,持续 60s,不就得了?这么喜欢抢,我就跟你抢到底,Node-RED 流程如下(自行替换自己的实体 ID):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
[
{
"blockInputOverrides": true,
"checkCurrentState": true,
"comparator": "is",
"entities": {
"entity": [
"media_player.denon_avr_x1800h"
],
"regex": [],
"substring": []
},
"g": "8766ed1263420d5c",
"id": "344cdcf3cd5b40f3",
"name": "等待天龙功放启动",
"outputProperties": [],
"outputs": 1,
"property": "state",
"server": "9bc3d25b988a4b02",
"timeout": "0",
"timeoutType": "num",
"timeoutUnits": "seconds",
"type": "ha-wait-until",
"value": "on",
"valueType": "str",
"version": 3,
"wires": [
[
"init_counter_force",
"cbe44108c9d9535a"
]
],
"x": 310,
"y": 1100,
"z": "ff315c3fee7892bb"
},
{
"action": "switch.turn_on",
"areaId": [],
"blockInputOverrides": true,
"data": "",
"dataType": "jsonata",
"debugenabled": false,
"deviceId": [],
"domain": "switch",
"entityId": [
"switch.pc_switch"
],
"floorId": [],
"g": "8766ed1263420d5c",
"id": "cbe44108c9d9535a",
"labelId": [],
"mergeContext": "",
"mustacheAltTags": false,
"name": "打开 PC",
"outputProperties": [],
"queue": "none",
"server": "9bc3d25b988a4b02",
"service": "turn_on",
"type": "api-call-service",
"version": 7,
"wires": [
[]
],
"x": 500,
"y": 1160,
"z": "ff315c3fee7892bb"
},
{
"action": "",
"from": "",
"g": "8766ed1263420d5c",
"id": "init_counter_force",
"name": "初始化计数为 0",
"property": "",
"reg": false,
"rules": [
{
"p": "loop_count",
"pt": "msg",
"t": "set",
"to": "0",
"tot": "num"
}
],
"to": "",
"type": "change",
"wires": [
[
"loop_controller_force"
]
],
"x": 520,
"y": 1100,
"z": "ff315c3fee7892bb"
},
{
"finalize": "",
"func": "// 获取计数\nvar count = msg.loop_count;\ncount++;\n\n// 判断边界\nif (count <= 60) {\n msg.loop_count = count;\n return msg;\n} else {\n // 60次跑完,彻底结束\n return null;\n}",
"g": "8766ed1263420d5c",
"id": "loop_controller_force",
"initialize": "",
"libs": [],
"name": "循环 60 次",
"noerr": 0,
"outputs": 1,
"timeout": "",
"type": "function",
"wires": [
[
"get_denon_state",
"wait_1s_force"
]
],
"x": 710,
"y": 1100,
"z": "ff315c3fee7892bb"
},
{
"allowrate": false,
"drop": false,
"g": "8766ed1263420d5c",
"id": "wait_1s_force",
"name": "等 1 秒",
"nbRateUnits": "1",
"outputs": 1,
"pauseType": "delay",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"rate": "1",
"rateUnits": "second",
"timeout": "1",
"timeoutUnits": "seconds",
"type": "delay",
"wires": [
[
"loop_controller_force"
]
],
"x": 700,
"y": 1160,
"z": "ff315c3fee7892bb"
},
{
"blockInputOverrides": false,
"entity_id": "media_player.denon_avr_x1800h",
"entity_location": "data",
"for": "0",
"forType": "num",
"forUnits": "minutes",
"g": "8766ed1263420d5c",
"halt_if": "",
"halt_if_compare": "is",
"halt_if_type": "str",
"id": "get_denon_state",
"name": "获取天龙功放数据",
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "string",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"outputs": 1,
"override_data": "msg",
"override_payload": "msg",
"override_topic": false,
"server": "9bc3d25b988a4b02",
"state_location": "payload",
"state_type": "str",
"type": "api-current-state",
"version": 3,
"wires": [
[
"check_source_attr"
]
],
"x": 910,
"y": 1100,
"z": "ff315c3fee7892bb"
},
{
"checkall": "true",
"g": "8766ed1263420d5c",
"id": "check_source_attr",
"name": "判断源是否为 PC",
"outputLabels": [
"不是Game (执行命令)",
"是Game (跳过)"
],
"outputs": 2,
"property": "data.attributes.source",
"propertyType": "msg",
"repair": false,
"rules": [
{
"t": "neq",
"v": "Game",
"vt": "str"
},
{
"t": "else"
}
],
"type": "switch",
"wires": [
[
"16422d250c62ab1e"
],
[]
],
"x": 1130,
"y": 1100,
"z": "ff315c3fee7892bb"
},
{
"action": "media_player.select_source",
"areaId": [],
"blockInputOverrides": false,
"data": "{ \"source\": \"Game\" }",
"dataType": "json",
"debugenabled": false,
"deviceId": [],
"domain": "media_player",
"entityId": [
"media_player.denon_avr_x1800h"
],
"floorId": [],
"g": "8766ed1263420d5c",
"id": "16422d250c62ab1e",
"labelId": [],
"mergeContext": "",
"mustacheAltTags": false,
"name": "天龙功放输入源切换为 PC",
"outputProperties": [],
"queue": "none",
"server": "9bc3d25b988a4b02",
"service": "select_source",
"type": "api-call-service",
"version": 7,
"wires": [
[]
],
"x": 1370,
"y": 1100,
"z": "ff315c3fee7892bb"
},
{
"addon": true,
"areaSelector": "friendlyName",
"cacheJson": true,
"connectionDelay": true,
"deviceSelector": "friendlyName",
"enableGlobalContextStore": false,
"entitySelector": "friendlyName",
"ha_boolean": [
"y",
"yes",
"true",
"on",
"home",
"open"
],
"heartbeat": false,
"heartbeatInterval": "30",
"id": "9bc3d25b988a4b02",
"name": "Home Assistant",
"rejectUnauthorizedCerts": true,
"statusDay": "numeric",
"statusHourCycle": "default",
"statusMonth": "short",
"statusSeparator": ": ",
"statusTimeFormat": "h:m",
"statusYear": "hidden",
"type": "server",
"version": 6
},
{
"env": [],
"id": "b4e6f5ca2babb61b",
"modules": {
"node-red-contrib-home-assistant-websocket": "0.80.3"
},
"type": "global-config"
}
]