智能家居框架homeassistant

时间:Nov. 21, 2019 分类:

目录:

直接docker启动,方便以后迁移

$ docker run -itd -p 8888:8888 -p 8123:8123 --name ha centos
$ docker exec -it ha /bin/bash

安装homeassistant

$ yum install -y python3 python3-devel
$ pip3 install homeassistant
$ pip3 install home-assistant-frontend
$ hass --open-ui --daemon 

会生成~/.homeassistant/,做下软链接,方便后边

$ ln -s  ~/.homeassistant/  /ha

如果出现下不来包的情况可以换一下pip源

$ mkdir ~/.pip/
$ vi ~/.pip/pip.conf
[global]
index-url = https://mirrors.aliyun.com/pypi/simple

安装jupyter方便后续使用,也可以不安装

$ pip3 install jupyter
$ jupyter notebook --generate-config
Writing default config to: /root/.jupyter/jupyter_notebook_config.py

编辑生成的默认配置文件

c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
c.NotebookApp.notebook_dir = '/ha/'

设置密码

jupyter notebook password
Enter password: 
Verify password: 
[NotebookPasswordApp] Wrote hashed password to /root/.jupyter/jupyter_notebook_config.json

启动服务

jupyter notebook --allow-root

对于docker容器导入和导出

docker ps -a
dCONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                    PORTS                    NAMES
e470c79eefa2        centos              "/bin/bash"              2 hours ago         Up 2 hours                                         ha
docker export e470c79eefa2 > ha.tar
cat ha.tar | docker import - ha