Installation Home Assistant on Docker

Stella981
• 阅读 502

docker 是个好东西,想着Raspbian 是基于 Debian的系统,那定然是支持 docker的。

而有了docker,再raspberry pi上安装 Home Assistant就有了一种极其简单的方法。

1. 在Raspberry Pi 上安装docker

curl -sSL https://get.docker.com | sh

参考:https://www.raspberrypi.org/blog/docker-comes-to-raspberry-pi/

2. 验证docker的安装是否正确

pi@raspberrypi:~ $ sudo docker --version
Docker version 18.06.0-ce, build 0ffa825

pi@raspberrypi:~ $ sudo docker info
Containers: 3
 Running: 2
 Paused: 0
 Stopped: 1
Images: 2
Server Version: 18.06.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init...

参考:https://docs.docker.com/get-started/#prepare-your-docker-environment

3. 在Raspberry Pi上基于Docker安装 Home Assistant

$ docker run -d --name="home-assistant" -v /path/to/your/config:/config -v /etc/localtime:/etc/localtime:ro --net=host homeassistant/raspberrypi3-homeassistant:0.XX.x

注意:
1. /path/to/your/config 指的是你本地的HA配置目录,用来在本地存放你要运行的 HA 配置,比如  configuration.yaml 等配置文件

2. :/config 这里的config指的是你 docker 镜像中HA的配置目录,如果/path/to/your/config 这个目录在本地存在,则HA启动时会读取本地的配置,入伏哦/path/to/your/config 在本地不存在,则读取docker镜像中HA的配置目录

3. 0.XX.x 指的是要指定的HA版本,比如0.72.0,具体版本可以到HA官网查询 https://www.home-assistant.io/

实际在本机安装案例:

mkdir /home/pi/workplace/config -psudo docker run -d --name="home-assistant" -v /home/pi/workplace/config:/config -v /etc/localtime:/etc/localtime:ro --net=host homeassistant/raspberrypi3-homeassistant:0.72.0

安装成功后验证

pi@raspberrypi:~ $ sudo docker image ls
REPOSITORY                                 TAG                 IMAGE ID            CREATED             SIZE
homeassistant/raspberrypi3-homeassistant   0.72.0              df8da8840c1d        8 weeks ago         1.06GB

4. 在Raspberry Pi 上启动Docker中的 

homeassistant/raspberrypi3-homeassistant, 注意要指定版本0.72.0,不然docker会提示本地不存在,然后又重新去docker hup去下载

pi@raspberrypi:~ $ sudo docker run -v /home/pi/workplace/config:/config homeassistant/raspberrypi3-homeassistant:0.72.0
starting version 3.2.4
2018-08-18 07:33:44 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=homeassistant, service=turn_off>
2018-08-18 07:33:44 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=homeassistant, service=turn_on>
2018-08-18 07:33:44 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=homeassistant, service=toggle>
2018-08-18 07:33:44 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=homeassistant, service=stop>
2018-08-18 07:33:44 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=homeassistant, service=restart>
2018-08-18 07:33:44 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=homeassistant, service=check_config>
2018-08-18 07:33:44 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=homeassistant, service=reload_core_config>
2018-08-18 07:33:44 INFO (MainThread) [homeassistant.bootstrap] Home Assistant core initialized
2018-08-18 07:33:45 INFO (MainThread) [homeassistant.loader] Loaded frontend from homeassistant.components.frontend
2018-08-18 07:33:46 INFO (MainThread) [homeassistant.loader] Loaded api from homeassistant.components.api2018-08-18 07:33:46 INFO (MainThread) [homeassistant.loader] Loaded introduction from homeassistant.components.introduction
2018-08-18 07:33:46 INFO (MainThread) [homeassistant.setup] Setting up introduction
2018-08-18 07:33:46 INFO (MainThread) [homeassistant.components.introduction] 

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        Hello, and welcome to Home Assistant!

        We'll hope that we can make all your dreams come true.

        Here are some resources to get started:

         - Configuring Home Assistant:
           https://home-assistant.io/getting-started/configuration/

         - Available components:
           https://home-assistant.io/components/

         - Troubleshooting your configuration:
           https://home-assistant.io/getting-started/troubleshooting-configuration/

         - Getting help:
           https://home-assistant.io/help/

        This message is generated by the introduction component. You can
        disable it in configuration.yaml.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

5. 登陆HAweb查看

http://192.168.1.x:8123

注意: 该ip是装docker的宿主ip,也就是你的本机ip

6. 修改配置文件,定制你喜欢的智能家居系统

pi@raspberrypi:~/workplace/config $ ls /home/pi/workplace/config
automations.yaml  configuration.yaml  customize.yaml  deps  groups.yaml  home-assistant_v2.db  scripts.yaml  secrets.yaml  tts
点赞
收藏
评论区
推荐文章
blmius blmius
2年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Jacquelyn38 Jacquelyn38
2年前
2020年前端实用代码段,为你的工作保驾护航
有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )
皕杰报表之UUID
​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为
Stella981 Stella981
2年前
KVM调整cpu和内存
一.修改kvm虚拟机的配置1、virsheditcentos7找到“memory”和“vcpu”标签,将<namecentos7</name<uuid2220a6d1a36a4fbb8523e078b3dfe795</uuid
Easter79 Easter79
2年前
Twitter的分布式自增ID算法snowflake (Java版)
概述分布式系统中,有一些需要使用全局唯一ID的场景,这种时候为了防止ID冲突可以使用36位的UUID,但是UUID有一些缺点,首先他相对比较长,另外UUID一般是无序的。有些时候我们希望能使用一种简单一些的ID,并且希望ID能够按照时间有序生成。而twitter的snowflake解决了这种需求,最初Twitter把存储系统从MySQL迁移
Wesley13 Wesley13
2年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Wesley13 Wesley13
2年前
00:Java简单了解
浅谈Java之概述Java是SUN(StanfordUniversityNetwork),斯坦福大学网络公司)1995年推出的一门高级编程语言。Java是一种面向Internet的编程语言。随着Java技术在web方面的不断成熟,已经成为Web应用程序的首选开发语言。Java是简单易学,完全面向对象,安全可靠,与平台无关的编程语言。
Stella981 Stella981
2年前
Django中Admin中的一些参数配置
设置在列表中显示的字段,id为django模型默认的主键list_display('id','name','sex','profession','email','qq','phone','status','create_time')设置在列表可编辑字段list_editable
Wesley13 Wesley13
2年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
Python进阶者 Python进阶者
3个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这