trphoenix
2025-04-17 dfd5fb3d5327fd1c0fa7f937ca178d2e149d7ab6
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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="author" content="岱特智能科技(上海)有限公司" />
      <link rel="shortcut icon" href="../../../img/favicon.ico" />
    <title>系统初始化配置 - DT-HA</title>
    <link rel="stylesheet" href="../../../css/theme.css" />
    <link rel="stylesheet" href="../../../css/theme_extra.css" />
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/github.min.css" />
    
      <script>
        // Current page data
        var mkdocs_page_name = "\u7cfb\u7edf\u521d\u59cb\u5316\u914d\u7f6e";
        var mkdocs_page_input_path = "Usages\\initConfig\\initConfig.md";
        var mkdocs_page_url = null;
      </script>
    
    <!--[if lt IE 9]>
      <script src="../../../js/html5shiv.min.js"></script>
    <![endif]-->
      <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js"></script>
      <script>hljs.highlightAll();</script> 
</head>
 
<body class="wy-body-for-nav" role="document">
 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
    <div class="wy-side-scroll">
      <div class="wy-side-nav-search">
          <a href="../../.." class="icon icon-home"> DT-HA
        </a><div role="search">
  <form id ="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
      <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" title="Type search term here" />
  </form>
</div>
      </div>
 
      <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <ul>
                <li class="toctree-l1"><a class="reference internal" href="../../..">首页</a>
                </li>
              </ul>
              <ul>
                <li class="toctree-l1"><a class="reference internal" href="../../../about/">关于</a>
                </li>
              </ul>
              <p class="caption"><span class="caption-text">使用教程</span></p>
              <ul class="current">
                  <li class="toctree-l1"><a class="reference internal" href="../../../install-guide/installHa/">安装</a>
                  </li>
                  <li class="toctree-l1 current"><a class="reference internal current" >使用</a>
    <ul class="current">
                <li class="toctree-l2"><a class="reference internal" href="../../usage/">使用概述</a>
                </li>
                <li class="toctree-l2"><a class="reference internal" href="../../netconfig/netconfig/">配置网络</a>
                </li>
                <li class="toctree-l2 current"><a class="reference internal current" href="#">系统初始化配置</a>
    <ul class="current">
    <li class="toctree-l3"><a class="reference internal" href="#homeassistant_1">首次打开HomeAssistant</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#_1">更新必要的组件</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#-">配置-通用</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#-_1">配置-设置-加载项</a>
        <ul>
    <li class="toctree-l4"><a class="reference internal" href="#file-editor">安装File editor</a>
    </li>
    <li class="toctree-l4"><a class="reference internal" href="#samba-share">安装Samba share插件</a>
    </li>
    <li class="toctree-l4"><a class="reference internal" href="#terminal-ssh">安装Terminal &amp; SSH</a>
    </li>
    <li class="toctree-l4"><a class="reference internal" href="#mosquitto-broker">安装Mosquitto broker</a>
    </li>
    <li class="toctree-l4"><a class="reference internal" href="#node-red">安装Node-RED插件</a>
    </li>
    <li class="toctree-l4"><a class="reference internal" href="#docker-postgresql">利用 Docker 安装 PostgreSQL</a>
    </li>
        </ul>
    </li>
    </ul>
                </li>
    </ul>
                  </li>
              </ul>
      </div>
    </div>
    </nav>
 
    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
      <nav class="wy-nav-top" role="navigation" aria-label="Mobile navigation menu">
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../..">DT-HA</a>
        
      </nav>
      <div class="wy-nav-content">
        <div class="rst-content"><div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
    <li><a href="../../.." class="icon icon-home" aria-label="Docs"></a></li>
          <li class="breadcrumb-item">使用教程</li>
          <li class="breadcrumb-item">使用</li>
      <li class="breadcrumb-item active">系统初始化配置</li>
    <li class="wy-breadcrumbs-aside">
    </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div class="section" itemprop="articleBody">
              
                <h3 id="homeassistant">初始化配置HomeAssistant<a class="headerlink" href="#homeassistant" title="Permanent link">&para;</a></h3>
<h4 id="homeassistant_1">首次打开HomeAssistant<a class="headerlink" href="#homeassistant_1" title="Permanent link">&para;</a></h4>
<p>首次打开HomeAssistant通过,路由器为其分配的IP地址加端口号即可进行HomeAssistant.</p>
<p>格式如下:</p>
<div class="codehilite"><pre><span></span><code>http://Ip:Port
如:http://192.168.3.2:8123
基中:8123为其默认的端口后,当然,系统初始化成功后,可以改.
</code></pre></div>
 
<p>如下图所示:
<img src="https://dhcdn.leon056.com/bpfStudy/docs/20250416174015324.png" style="zoom:67%;" /></p>
<p>点击"创建我智能家家居"按进行下一步</p>
<p><img src="https://dhcdn.leon056.com/bpfStudy/docs/20250416174141899.png" style="zoom:67%;" /></p>
<p>在这里我们输入姓名,用户名,密码,确认密码
这里我们使用统一的信息</p>
<div class="codehilite"><pre><span></span><code>姓名:岱特智能
用户名:dtuser
密码:******
确认密码:*****
</code></pre></div>
 
<p><strong>注意:上述密码为了安全,没有显示,请咨询系统管理员获取真正的密码.</strong></p>
<p><img src="https://dhcdn.leon056.com/bpfStudy/docs/20250416174647992.png" style="zoom:67%;" /></p>
<p>点击"创建帐户",</p>
<p><img src="https://dhcdn.leon056.com/bpfStudy/docs/20250416174907500.png" style="zoom:67%;" /></p>
<p>这一步,会要求你输入位置,输入城市点获取,如果取下到会报错.没关系,直接下一步即可,系统配置完成后,还可更改.</p>
<p><img src="https://dhcdn.leon056.com/bpfStudy/docs/20250416175039994.png" style="zoom:67%;" /></p>
<p>这一步是要求,你输下所属的国家与地区,它会自动判断出来,国家,直接点下一步即可.</p>
<p>此时,它可能还会弹出一个对话框框,帮你检测位置 ,点确定即可</p>
<p><img src="https://dhcdn.leon056.com/bpfStudy/docs/1744797155585.png" style="zoom: 67%;" /></p>
<p>如果不想让其检测,直接点取消即可,因为其检测折可能很慢,所以,直接点取消,选择中国即可.</p>
<p><img src="https://dhcdn.leon056.com/bpfStudy/docs/20250416180125174.png" style="zoom:67%;" /></p>
<p>这里的几项,全部不用选,直接下一步</p>
<p><img src="https://dhcdn.leon056.com/bpfStudy/docs/20250416180225320.png" style="zoom:67%;" /></p>
<p>这一步,系统会自动扫描局域网中的能直接入的设备.直接点击完成,</p>
<p>然后,系统会转到如下界面</p>
<p><img src="https://dhcdn.leon056.com/bpfStudy/docs/20250416180400766.png" style="zoom:67%;" /></p>
<p>可能要持续一阵,等待其完成即可.</p>
<p><img src="https://dhcdn.leon056.com/bpfStudy/docs/20250416180639029.png" style="zoom:67%;" /></p>
<p>开始第一次,可能很慢</p>
<p>首次完成如下显示</p>
<p><img src="https://dhcdn.leon056.com/bpfStudy/docs/20250416180715339.png" style="zoom:67%;" /></p>
<h4 id="_1">更新必要的组件<a class="headerlink" href="#_1" title="Permanent link">&para;</a></h4>
<p>首次登录,可能会显示更新,如此时显示</p>
<p><img src="https://dhcdn.leon056.com/bpfStudy/docs/20250416181146547.png" style="zoom:67%;" /></p>
<p>提示更新Home Assistnat Operating System Update,点击如下按钮,以弹出的对话框中,点更新按钮
<img src="https://dhcdn.leon056.com/bpfStudy/docs/20250416181323600.png" style="zoom:67%;" /></p>
<p>如下图所示,系统将会,进行更新</p>
<p><img src="https://dhcdn.leon056.com/bpfStudy/docs/20250416181455221.png" style="zoom:67%;" /></p>
<p>注意,这个操作,一般是从两个地方获取更新包,一是github一个是docker的仓库,所以,<strong>要保持科学上网的畅通</strong>。这个过程 ,估计要几分钟,需要耐心等等,也有可能会更新失败,然后,再次更新。</p>
<p>更新时,如果网络有问题可能会出在日志 中报出如下错误</p>
<div class="codehilite"><pre><span></span><code>aiodns.error.DNSError: (12, &#39;Timeout while contacting DNS servers&#39;)
2025-04-16 17:26:15.438 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
aiodns.error.DNSError: (12, &#39;Timeout while contacting DNS servers&#39;)
2025-04-16 17:26:15.438 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
aiodns.error.DNSError: (12, &#39;Timeout while contacting DNS servers&#39;)
2025-04-16 17:26:15.438 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
aiodns.error.DNSError: (12, &#39;Timeout while contacting DNS servers&#39;)
2025-04-16 17:26:15.438 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
aiodns.error.DNSError: (12, &#39;Timeout while contacting DNS servers&#39;)
2025-04-16 17:26:15.438 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
aiodns.error.DNSError: (12, &#39;Timeout while contacting DNS servers&#39;)
2025-04-16 17:26:15.439 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
aiodns.error.DNSError: (12, &#39;Timeout while contacting DNS servers&#39;)
2025-04-16 17:26:15.440 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
aiodns.error.DNSError: (12, &#39;Timeout while contacting DNS servers&#39;)
2025-04-16 17:26:15.440 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
aiodns.error.DNSError: (12, &#39;Timeout while contacting DNS servers&#39;)
2025-04-16 17:26:15.440 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved (None)
aiodns.error.DNSError: (12, &#39;Timeout while contacting DNS servers&#39;)
[09:26:17] INFO: Home Assistant Core finish process exit code 0
[09:26:17] INFO: Home Assistant Core service shutdown
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun home-assistant (no readiness notification)
s6-rc: info: service legacy-services successfully started
2025-04-16 17:28:26.876 ERROR (MainThread) [homeassistant.components.homeassistant_alerts.coordinator] Timeout fetching homeassistant_alerts data
2025-04-16 17:51:56.276 WARNING (MainThread) [homeassistant.helpers.translation] Failed to load integration for translation: Invalid domain hassio.update
2025-04-16 17:51:56.278 WARNING (MainThread) [homeassistant.helpers.translation] Failed to load integration for translation: Invalid domain cloud.tts
2025-04-16 17:51:56.278 WARNING (MainThread) [homeassistant.helpers.translation] Failed to load integration for translation: Invalid domain mobile_app.notify
2025-04-16 17:51:56.278 WARNING (MainThread) [homeassistant.helpers.translation] Failed to load integration for translation: Invalid domain backup.sensor
2025-04-16 17:51:56.279 WARNING (MainThread) [homeassistant.helpers.translation] Failed to load integration for translation: Invalid domain energy.sensor
2025-04-16 17:51:56.279 WARNING (MainThread) [homeassistant.helpers.translation] Failed to load integration for translation: Invalid domain sun.sensor
2025-04-16 17:51:56.279 WARNING (MainThread) [homeassistant.helpers.translation] Failed to load integration for translation: Invalid domain homeassistant.scene
2025-04-16 17:51:56.279 WARNING (MainThread) [homeassistant.helpers.translation] Failed to load integration for translation: Invalid domain hassio.binary_sensor
2025-04-16 17:51:56.280 WARNING (MainThread) [homeassistant.helpers.translation] Failed to load integration for translation: Invalid domain hassio.sensor
</code></pre></div>
 
<p>上述错误多是由于网络问题引起的,要去检是科学上网是否还正常.</p>
<p>更完完成后,再次启动后,会显示没有可用的更新</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417092912822.png" /></p>
<h4 id="-">配置-通用<a class="headerlink" href="#-" title="Permanent link">&para;</a></h4>
<p>点击,开始,通用</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250416183224006.png" /></p>
<p>更改名称为:岱特智能
其它的不变</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250416183309109.png" /></p>
<p>#### 配置-网络-主机名</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417094434315.png" /></p>
<p>把主机名配置成为局域网中唯一的,实际让就是计算机名,因为同一局域网中,计算机名,不允许相同</p>
<h4 id="-_1">配置-设置-加载项<a class="headerlink" href="#-_1" title="Permanent link">&para;</a></h4>
<p>加载项中有许多必装组件,需要一一安装,首次进入时,可能会显示如下页面</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417102735914.png" /></p>
<p>点击下角的"加载项商店"</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/image-20250417103041576.png" /></p>
<h5 id="file-editor">安装File editor<a class="headerlink" href="#file-editor" title="Permanent link">&para;</a></h5>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/image-20250417103159193.png" /></p>
<p>File editor 是一个用于修改HA的配置文件的集成工具,属必装项,点击安装</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417103608598.png" /></p>
<p>点击安装,系统会在后台自动安装此插件,
<img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417104146679.png" /></p>
<p>安装完成后,会自动重启</p>
<p>有时也会提示安装失败</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417105230073.png" /></p>
<p>这种经查看日志 多为网强行问题无法访问.docker.io,这是因为科学上风的原因,重点排查网络,安装成功后,再次进入会显示如下界面</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417105547700.png" /></p>
<p>勾选,开机启动,自动恢复,显示于侧边栏</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417105644468.png" /></p>
<p>点击启动,或重启,将会在侧边栏看到此图标,点击打开网页界面</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417105820902.png" /></p>
<p>能看到如下界面,说明安装成功</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417105918681.png" /></p>
<p>此时加载项中,就多出了File editor选项</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417105949676.png" /></p>
<h5 id="samba-share">安装Samba share插件<a class="headerlink" href="#samba-share" title="Permanent link">&para;</a></h5>
<p>Samba share插件是一个提供共享目录的方式允行其它计算机用这种方式查看编辑ha的文件的组件.</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417111104287.png" /></p>
<p>点击安装</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417111140693.png" /></p>
<p>安装失败时,会有如下提下提示</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417111731068.png" /></p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417111959381.png" /></p>
<p>打开自动恢复</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417112429893.png" /></p>
<p>接下来我们需要到配置选项中</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417112959837.png" /></p>
<p>此处我们设置如下信息</p>
<div class="codehilite"><pre><span></span><code>Username:dtuser
Password:***** # 此处请咨询管理员
Workgroup:WORKGROUP # 保持不变
</code></pre></div>
 
<p>更改完成后,有如下配置</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417113757884.png" /></p>
<p>配置 完成后,点击启动</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417113840938.png" /></p>
<p>启动成功后,会出下图显示</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417114018464.png" /></p>
<p>此时,如果,与HA在同一局域网,我们可以使用如下方式查看HA的文件目录</p>
<p>在地址栏输入\HA的IP </p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417114610432.png" /></p>
<p>输入预设的用户名与密码,即可查看,编辑HA的各种文件。</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417114720695.png" /></p>
<h5 id="terminal-ssh">安装Terminal &amp; SSH<a class="headerlink" href="#terminal-ssh" title="Permanent link">&para;</a></h5>
<p>Terminal &amp; SSH 插件为HA提供了在web端使用控制台终端功能,及开启了ssh服务,使之可以远程使用SSH访问HA终端。</p>
<p>在搜索中输入Terminal &amp; SSH </p>
<p>结果有可能显示</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417115643048.png" /></p>
<p>搜索不到,这时,可能是因为仓库没有配置,还是使用的默认的仓库,我们可以增加一下仓库,如下:</p>
<div class="codehilite"><pre><span></span><code>https://github.com/AlexxIT/hassio-addons
</code></pre></div>
 
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417115838631.png" /></p>
<p>点击右上解的三个点,选中仓库</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417115914947.png" /></p>
<p>在弹出折对话框中输入,我们记录的仓库地址,然后点添加</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417120018086.png" /></p>
<p>完成后,点击关闭.</p>
<p>然后,点击返回,重新搜索</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417120233117.png" /></p>
<p>这次找到了Advance SSH &amp; Web Terminal</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417120233117.png" /></p>
<p>点击安装,打开如下页面</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417120802786.png" /></p>
<p>点击安装,有时会安装失败,</p>
<p>失败后,需再次安装,同时检查日志中提到的哪个网址无法访问 ,把其加科学上网的代理名单中.</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417122414637.png" /></p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417122910533.png" /></p>
<p>安装完成后,就变成如下</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417141712061.png" /></p>
<p>开启自动恢得,显示侧边栏</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417141740843.png" /></p>
<p>接下来,我们配置ssh的登录信息,如下</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417143151994.png" /></p>
<p>相关信息如下:</p>
<div class="codehilite"><pre><span></span><code>username:dtuser
passsword:**** # 此处需要咨询管理员
</code></pre></div>
 
<p>其它配置选项如下,注意选项,选错了ssh可能启不起来,sftp关闭,zsh关闭.compatibility_mode要开启</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417160113415.png" /></p>
<p>然后,点击启动按钮</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417143931697.png" /></p>
<p>启动后如下</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417143953506.png" /></p>
<p>我们可以通过两个地方进入</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/image-20250417144032876.png" /></p>
<p>在日志 端能看到 ssh已启动成功</p>
<div class="codehilite"><pre><span></span><code>s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-ssh: starting
s6-rc: info: service init-mysql: starting
s6-rc: info: service init-mosquitto: starting
s6-rc: info: service init-docker: starting
s6-rc: info: service init-docker successfully started
s6-rc: info: service init-mysql successfully started
s6-rc: info: service init-mosquitto successfully started
[14:51:05] WARNING: 
[14:51:05] WARNING: Logging in with a SSH password is security wise, a bad idea!
[14:51:05] WARNING: Please, consider using a public/private key pair.
[14:51:05] WARNING: What is this? https://kb.iu.edu/d/aews
[14:51:05] WARNING: 
[14:51:05] NOTICE: RSA host key missing, generating one...
Generating public/private rsa key pair.
Your identification has been saved in /data/ssh_host_rsa_key
Your public key has been saved in /data/ssh_host_rsa_key.pub
The key fingerprint is:
SHA256:+9pEl2QvyUqsu4B3gnPjhL/Ab71iBIDjWRdYvgZeg0c root@a0d7b954-ssh
The key&#39;s randomart image is:
+---[RSA 3072]----+
| .  oE.          |
|o .o+.           |
|..o+.=      o    |
| o. = o  . + +   |
|   . +  S + * .  |
|   ..+.  = o .   |
|    B.B.+ o      |
|     X+=.=       |
|     o=o=+o      |
+----[SHA256]-----+
[14:51:08] NOTICE: ED25519 host key missing, generating one...
Generating public/private ed25519 key pair.
Your identification has been saved in /data/ssh_host_ed25519_key
Your public key has been saved in /data/ssh_host_ed25519_key.pub
The key fingerprint is:
SHA256:MgbUsAJ+23skjVTwD0pWVRBCmZ0BjU3jwV/99gGnNVc root@a0d7b954-ssh
The key&#39;s randomart image is:
+--[ED25519 256]--+
|.   o+o*%O*.  . E|
|.. . .=+o*o  o =.|
| ...o+ o .. . = +|
|  ..*.+ o  . . .o|
|   . =+oS.     .o|
|     .+o        .|
|     . .         |
|      .          |
|                 |
+----[SHA256]-----+
s6-rc: info: service init-ssh successfully started
s6-rc: info: service init-user: starting
[14:51:08] NOTICE: Session sharing has been disabled!
s6-rc: info: service init-user successfully started
s6-rc: info: service ttyd: starting
s6-rc: info: service sshd: starting
s6-rc: info: service sshd successfully started
s6-rc: info: service ttyd successfully started
s6-rc: info: service legacy-services: starting
[14:51:09] INFO: Starting the ttyd daemon...
[14:51:09] INFO: Starting the SSH daemon...
s6-rc: info: service legacy-services successfully started
Server listening on 0.0.0.0 port 22.
Server listening on :: port 22.
</code></pre></div>
 
<p>配置成功后,可以通过如下命令来测试是否可以远程SSH连入</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417150734570.png" /></p>
<p>输入yes后会要求 输入密码,验证正确后,会进入看到如个图,就说明ssh已正常的开启成功了</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417155921995.png" /></p>
<p>以下界面是在ha中看到的内置的ssh</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417160212333.png" /></p>
<p>其它,当访问一些系统操作无权限时,可以关闭保护开关</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417171751950.png" /></p>
<h5 id="mosquitto-broker">安装Mosquitto broker<a class="headerlink" href="#mosquitto-broker" title="Permanent link">&para;</a></h5>
<p>Mosquitto broker是一个重要的插件,其提供的MQTT 服务为公司大多数数设备折集成,mqtt通信通道,所以,此为必装插件。</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417160954518.png" /></p>
<p>点击安装</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417161858614.png" /></p>
<p>看到如下界面,说明安装成功,
<img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417162347432.png" /></p>
<p>接下来是配置mqtt</p>
<h6 id="_2">开启自动恢复<a class="headerlink" href="#_2" title="Permanent link">&para;</a></h6>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417162755148.png" /></p>
<h6 id="mqtt">配置mqtt的用户名密码及定制配置<a class="headerlink" href="#mqtt" title="Permanent link">&para;</a></h6>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417165820612.png" /></p>
<div class="codehilite"><pre><span></span><code>username:dtuser
password:****** #此处的密码请咨询管理员
</code></pre></div>
 
<p>配置完成后,启动mqtt服务</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417163342388.png" /></p>
<p>日志中显示如下信息,说明成功</p>
<div class="codehilite"><pre><span></span><code>s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/mosquitto.sh
[16:33:27] INFO: Setting up user dtuser
[16:33:28] INFO: SSL is not enabled
cont-init: info: /etc/cont-init.d/mosquitto.sh exited 0
cont-init: info: running /etc/cont-init.d/nginx.sh
cont-init: info: /etc/cont-init.d/nginx.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun mosquitto (no readiness notification)
services-up: info: copying legacy longrun nginx (no readiness notification)
[16:33:29] INFO: Starting NGINX for authentication handling...
s6-rc: info: service legacy-services successfully started
[16:33:29] INFO: Starting mosquitto MQTT broker...
2025-04-17 16:33:29: Warning: Mosquitto should not be run as root/administrator.
2025-04-17 16:33:29: mosquitto version 2.0.20 starting
2025-04-17 16:33:29: Config loaded from /etc/mosquitto/mosquitto.conf.
2025-04-17 16:33:29: Loading plugin: /usr/share/mosquitto/go-auth.so
2025-04-17 16:33:29:  ├── Username/password checking enabled.
2025-04-17 16:33:29:  ├── TLS-PSK checking enabled.
2025-04-17 16:33:29:  └── Extended authentication not enabled.
2025-04-17 16:33:29: Opening ipv4 listen socket on port 1883.
2025-04-17 16:33:29: Opening ipv6 listen socket on port 1883.
2025-04-17 16:33:29: Opening websockets listen socket on port 1884.
2025-04-17 16:33:29: mosquitto version 2.0.20 running
2025-04-17 16:33:29: New connection from ::1:56336 on port 1883.
2025-04-17 16:33:29: Client &lt;unknown&gt; disconnected due to protocol error.
[16:33:30] INFO: Successfully send discovery information to Home Assistant.
[16:33:31] INFO: Successfully send service information to the Supervisor.
</code></pre></div>
 
<p>当消息,提示发现设备时,点击,弹出的消息中,点check it out,然后,看到已发现mqtt,点击添加</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417163617741.png" /></p>
<p>然后,点击完成</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417163633687.png" /></p>
<p>然后就会在设置-设备与服务-集成中,显示Mqtt,以后,所有增加的MQTT类设备,都会显示在这个类别中。</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417163705382.png" /></p>
<h5 id="node-red">安装Node-RED插件<a class="headerlink" href="#node-red" title="Permanent link">&para;</a></h5>
<p>Node-Red插件是我们集中各种设备的重要消息处理转换插件,属必装插件.</p>
<p>在加载项中,搜索nod显示如下</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417164340639.png" /></p>
<p>点击,进入详细页面</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417164440484.png" /></p>
<p>点击安装</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417164711564.png" /></p>
<p>如果安装出错,多半是科学上网的问题,</p>
<p>如现如下页面,说明安装成功</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/image-20250417165013539.png" /></p>
<p>开启自动恢复,关闭侧边栏</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/image-20250417165048899.png" /></p>
<p>配置nod-red</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417170501565.png" /></p>
<p>此处的配置信息为</p>
<div class="codehilite"><pre><span></span><code>username:admin
password:**** #此处的密码,请向管理员获取
### 默认情况下关闭ssl
</code></pre></div>
 
<p>然后启动node-red</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417170754947.png" /></p>
<p>点击打开web-页面如下</p>
<p><img alt="" src="https://dhcdn.leon056.com/bpfStudy/docs/20250417170638780.png" /></p>
<h5 id="docker-postgresql">利用 Docker 安装 PostgreSQL<a class="headerlink" href="#docker-postgresql" title="Permanent link">&para;</a></h5>
<p>虽然 Home Assistant OS 本身不允许直接访问系统底层,但它内置了 Docker 支持,因此可以直接运行 PostgreSQL 的 Docker 容器。</p>
<h6 id="_3"><strong>步骤</strong><a class="headerlink" href="#_3" title="Permanent link">&para;</a></h6>
<ol>
<li>
<p><strong>确保您有 SSH 访问权限</strong></p>
</li>
<li>
<p>安装 Home Assistant 的 SSH &amp; Web Terminal Add-on(高级模式)。</p>
</li>
<li>
<p>开启 SSH 访问,具体步骤如下:</p>
<ol>
<li>前往 <strong>Supervisor &gt; Add-on Store</strong>。</li>
<li>搜索并安装 <strong>SSH &amp; Web Terminal</strong>(官方插件)。</li>
<li>配置 SSH 插件,确保 <code>protected</code> 设置为 <code>false</code>,然后启动它。</li>
</ol>
</li>
<li>
<p><strong>运行 PostgreSQL 容器</strong></p>
</li>
<li>
<p>在 SSH 或 Web Terminal 中运行以下命令:</p>
<p><code>BASHdocker run -d \
   --name=postgresql \
   -e POSTGRES_USER=homeassistant \
   -e POSTGRES_PASSWORD=yourpassword \
   -e POSTGRES_DB=homeassistant \
   -v /mnt/data/supervisor/postgresql:/var/lib/postgresql/data \
   -p 5432:5432 \
   postgres</code></p>
<ul>
<li>替换 <code>yourpassword</code> 为您想要设置的数据库密码。</li>
<li>数据库名称为 <code>homeassistant</code>,用户名为 <code>homeassistant</code>。</li>
<li>数据将存储在 <code>/mnt/data/supervisor/postgresql</code>,确保数据在重启后不会丢失。</li>
</ul>
</li>
</ol>
              
            </div>
          </div><footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="Footer Navigation">
        <a href="../../netconfig/netconfig/" class="btn btn-neutral float-left" title="配置网络"><span class="icon icon-circle-arrow-left"></span> Previous</a>
    </div>
 
  <hr/>
 
  <div role="contentinfo">
    <!-- Copyright etc -->
  </div>
 
  Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
          
        </div>
      </div>
 
    </section>
 
  </div>
 
  <div class="rst-versions" role="note" aria-label="Versions">
  <span class="rst-current-version" data-toggle="rst-current-version">
    
        <span>
          <a href="http://dh.leon056.com:7499/r/Embedded/HomeAssistantPtoject.git" class="fa fa-code-fork" style="color: #fcfcfc"> Dh</a>
        </span>
    
    
      <span><a href="../../netconfig/netconfig/" style="color: #fcfcfc">&laquo; Previous</a></span>
    
    
  </span>
</div>
    <script src="../../../js/jquery-3.6.0.min.js"></script>
    <script>var base_url = "../../..";</script>
    <script src="../../../js/theme_extra.js"></script>
    <script src="../../../js/theme.js"></script>
      <script src="../../../search/main.js"></script>
    <script>
        jQuery(function () {
            SphinxRtdTheme.Navigation.enable(true);
        });
    </script>
 
</body>
</html>