<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>HomeAssistant on 修远</title><link>https://blog.l6l6.xyz/tags/homeassistant/</link><description>Recent content in HomeAssistant on 修远</description><generator>Hugo -- gohugo.io</generator><language>zh-cn</language><lastBuildDate>Fri, 29 Jul 2022 09:59:43 +0800</lastBuildDate><atom:link href="https://blog.l6l6.xyz/tags/homeassistant/index.xml" rel="self" type="application/rss+xml"/><item><title>HomeAssistant安装和配置（Docker）</title><link>https://blog.l6l6.xyz/p/homeassistant%E5%AE%89%E8%A3%85%E5%92%8C%E9%85%8D%E7%BD%AEdocker/</link><pubDate>Fri, 29 Jul 2022 09:59:43 +0800</pubDate><guid>https://blog.l6l6.xyz/p/homeassistant%E5%AE%89%E8%A3%85%E5%92%8C%E9%85%8D%E7%BD%AEdocker/</guid><description>&lt;img src="https://s2.loli.net/2022/07/29/QFPHVtUmc2suykf.png" alt="Featured image of post HomeAssistant安装和配置（Docker）" />&lt;h1 id="homeassistant安装和配置docker">HomeAssistant安装和配置（Docker）
&lt;/h1>&lt;h2 id="安装">安装
&lt;/h2>&lt;h3 id="image新建">Image新建
&lt;/h3>&lt;p>Image：&lt;strong>&lt;code>homeassistant/home-assistant:latest&lt;/code>&lt;/strong>&lt;/p>
&lt;h3 id="containers新建">Containers新建
&lt;/h3>&lt;p>使用Docker 的图形化管理工具Portainer进行配置&lt;/p>
&lt;p>&lt;strong>name：&lt;/strong> HomeAssistant 或 HASS&lt;/p>
&lt;p>&lt;strong>volume：&lt;/strong> host-volume为 &lt;code>/root/docker/homeassistant/config&lt;/code>，Path in container为 &lt;code>/config&lt;/code>&lt;/p>
&lt;p>&lt;strong>Connected networks&lt;/strong> ：必须为 &lt;code>host&lt;/code> 模式&lt;/p>
&lt;p>&lt;strong>ENV&lt;/strong> ：增加时区参数 &lt;code>TZ&lt;/code> ，值为 &lt;code>Asia/ShangHai&lt;/code>&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;span class="lnt">6
&lt;/span>&lt;span class="lnt">7
&lt;/span>&lt;span class="lnt">8
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-fallback" data-lang="fallback">&lt;span class="line">&lt;span class="cl">docker run --init -d \
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">--name homeassistant \
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">--restart=unless-stopped \
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">-v /etc/localtime:/etc/localtime:ro \
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">-v /root/docker/homeassistant/config:/config \
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">-e &amp;#34;TZ=Asia/Shanghai&amp;#34; \
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">--network=host \
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">homeassistant/home-assistant:lates
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h2 id="配置">配置
&lt;/h2>&lt;h3 id="安装hacs">安装HACS
&lt;/h3>&lt;p>进入docker环境：&lt;/p>
&lt;p>执行：&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">wget -q -O - https://install.hacs.xyz &lt;span class="p">|&lt;/span> bash -
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>重启HA或Docker&lt;/p>
&lt;p>打开【配置】-【设备与服务】-【集成】，搜索&lt;strong>HACS&lt;/strong>，安装&lt;/p>
&lt;h3 id="添加小米设备">添加小米设备
&lt;/h3>&lt;p>打开HACS，搜索“&lt;strong>&lt;code>Xiaomi MIoT&lt;/code>&lt;/strong>”，下载&lt;/p>
&lt;p>打开【配置】-【设备与服务】-【集成】，搜索“&lt;strong>&lt;code>Xiaomi MIoT&lt;/code>&lt;/strong>”，安装&lt;/p>
&lt;p>输入小米账号、密码，多选选择设备添加&lt;/p>
&lt;h3 id="添加yeelight灯">添加Yeelight灯
&lt;/h3>&lt;p>设置用户名密码后进入主界面。&lt;/p>
&lt;p>选择 &lt;code>配置 → 集成 → 添加集成&lt;/code> 搜索 Yeelight ，填入灯的 &lt;code>IP地址&lt;/code>，IP地址可以从米家或Yeelight应用中查看。建议在路由器上将这些灯的IP固定化，避免自动获取IP不同的情况。&lt;/p>
&lt;p>按照以上方式逐个添加即可。&lt;/p>
&lt;h3 id="添加homekit">添加Homekit
&lt;/h3>&lt;p>打开配置文件，路径：&lt;code>/config/configuration.yaml&lt;/code>&lt;/p>
&lt;p>配置文件的末尾行添加&lt;code>homekit:&lt;/code>后保存&lt;/p>
&lt;p>重启HomeAssistant，操作 &lt;code>配置 → 服务控制 →&lt;/code> 重新启动&lt;/p>
&lt;p>重启成功后，在 通知 中可看到 &lt;code>HomeKit Bridge&lt;/code> 的接入 二维码，使用 iPhone 手机 的家庭APP 扫描添加。&lt;/p>
&lt;blockquote>
&lt;p>注意：如果添加 Containers 的时候使用的 bridge 模式网络，这里添加 homekit 的时候会出现发现不了设备的问题，调整为使用 &lt;strong>host&lt;/strong> 模式可正常添加。&lt;/p>
&lt;/blockquote></description></item><follow_challenge><feedId>68852316548471808</feedId><userId>55783422475808768</userId></follow_challenge></channel></rss>