一键部署Home Assistant ubuntu 20.4.3 树莓派3b+脚本
树莓派3b+安装好 Ubuntu Server 20.04.3 LTS 32bit 后即可适用此脚本,其他版本树莓派/系统可能需要微调脚本
*为方便一些未知/已知错误排查 脚本存在冗余部分,足够了解linux的可自行精简,Y/N在需要时手动键入
下面HA驱动处根据需要修改
# 树莓派3b+安装好 Ubuntu Server 20.04.3 LTS 32bit 后即可适用此脚本,其他版本树莓派/系统可能需要微调脚本
# 下面HA驱动处根据需要修改
# author: bright
# docker安装
# 更新源
cat>/etc/apt/sources.list<<EOF
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib
deb [arch=armhf] https://download.docker.com/linux/ubuntu focal stable
# deb-src [arch=armhf] https://download.docker.com/linux/ubuntu focal stable
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
EOF
# 服务密钥重置
gpg --keyserver keyserver.ubuntu.com --recv-keys 9165938D90FDDD2E
gpg --export --armor 9165938D90FDDD2E | sudo apt-key add -
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=armhf] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update && sudo apt-get upgrade
# 安装步骤
sudo apt-get install docker-ce
apt-get install docker.io
apt-get install runc >= 1.0.0
apt install docker # docker拉取&&安装homeassistant
docker pull homeassistant/raspberrypi3-homeassistant # 启动homeassistant
docker run -d --name homeassistant -p 8123:8123 homeassistant/raspberrypi3-homeassistant # 配置HA自启动
# 获取容器id
cid=$(docker ps -a|grep "homeassistant" | awk '{print $1}')
echo $cid
# 添加homeassistant自启动配置文件
touch /etc/init.d/homeassistant.sh
cat>/etc/init.d/homeassistant.sh<<EOF
#!/bin/bash
docker restart $cid
exit 0
EOF
touch /etc/rc.local
cat>/etc/rc.local<<EOF
#!/bin/bash
docker restart $cid
exit 0
EOF
# 权限+自启
chmod 755 /etc/rc.local
chmod 755 /etc/init.d/homeassistant.sh
update-rc.d homeassistant.sh defaults 90 # homeassistant配置Xiaomi_gateway3 和 air_condition驱动
# 进入容器 # 如需直接跑跳到终端不运行可将下面命令新建一个setup.sh 脚本
# docker exec -it $cid /bin/bash
# docker ps -a 可以拿到cid
# touch setup.sh # 复制下面这些命令到脚本中在ha container中跑 # vi setup.sh # bash setup.sh
# 驱动相关
# 进行驱动拉取
docker restart $cid
docker exec -i $cid mkdir custom_components
docker exec -i $cid cd custom_components
docker exec -i $cid mkdir bak
docker exec -i $cid cd bak
# XiaomiGateway3
docker exec -i $cid git clone https://github.com/AlexxIT/XiaomiGateway3
docker exec -i $cid cp -r XiaomiGateway3/custom_components/xiaomi_gateway3 ../../custom_components/
# 01 02 11LM 空调伴侣驱动
docker exec -i $cid git clone https://github.com/syssi/xiaomi_airconditioningcompanion.git
docker exec -i $cid cp -r xiaomi_airconditioningcompanion/custom_components/xiaomi_miio_airconditioningcompanion ../../custom_components/
# 如需其他驱动仿照此中方式添加进来 # 修改yaml主配置文件
docker exec -i $cid cd /config && mv configuration.yaml configuration.bak
docker exec -i $cid touch configuration.yaml
docker exec -i $cid cat>configuration.yaml<<EOF
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
climate:
- platform: xiaomi_miio_airconditioningcompanion
name: Aqara Air Conditioning Companion
host: 192.168.1.xx # 需要修改空调伴侣的ip
token: xx # 修改空调伴侣对应的token
target_sensor: sensor.temperature_158d0001f53706
scan_interval: 60
EOF
docker exec -i $cid exit
apt install ntpdate
ntpdate us.pool.ntp.org
reboot
其他home assistant iot参考:
https://www.cnblogs.com/cutesnow/p/15511959.html
一键部署Home Assistant ubuntu 20.4.3 树莓派3b+脚本的更多相关文章
- 直接使用!安装WordPress一键部署轻松建站教程
关于 WordPress WordPress (opens new window)简称WP,最初是一款博客系统,后逐步演化成一款功能强大的企业级 CMS(内容管理/建站系统),目前是公认的全球最佳建站 ...
- ubuntu 20.04 基于kubeadm部署kubernetes 1.22.4集群及部署集群管理工具
一.环境准备: 集群版本:kubernetes 1.22.4 服务器系统 节点IP 节点类型 服务器-内存/CUP hostname Ubuntu 20.04 192.168.1.101 主节点 2G ...
- 如何自动化一键部署PHP项目
1.技能需求 完成自动化一键部署PHP需要:PHP(略懂),Shell(略懂),git(略懂) 2.最终效果 输入密码,回车,5~20秒后(一般一天一次持续交付,部署的代码量和sql脚本都不会很大) ...
- Centos 环境一键部署脚本(shell脚本)
谨以此文纪念吊炸天的Centos环境一键部署方案的新鲜出炉 辛苦大半年,产品准备上线了,BOSS亲自体验安装部署,看着超过200+页的安装文档直接崩溃了(需要部署23个基础服务),经历了超过3个小时的 ...
- Git+Gitlab+Ansible的roles实现一键部署Nginx静态网站(一)--技术流ken
前言 截止目前已经写了<Ansible基础认识及安装使用详解(一)--技术流ken>,<Ansible常用模块介绍及使用(二)--技术流ken><Ansible剧本介绍及 ...
- Docker Compose 一键部署LNMP
Docker Compose 一键部署LNMP 目录结构 [root@localhost ~]# tree compose_lnmp/ compose_lnmp/ ├── docker-compose ...
- Docker Compose 一键部署Nginx代理Tomcat集群
Docker Compose 一键部署Nginx代理Tomcat集群 目录结构 [root@localhost ~]# tree compose_nginx_tomcat/ compose_nginx ...
- Docker Compose 一键部署多节点爬虫程序
Docker Compose 一键部署多节点爬虫程序 目录结构 [root@localhost ~]# tree compose_crawler/ compose_crawler/ ├── cento ...
- 基于Docker一键部署大规模Hadoop集群及设计思路
一.背景: 随着互联网的发展.互联网用户的增加,互联网中的数据也急剧膨胀.每天产生的数据量数以万计,本地文件系统和单机CPU已无法满足存储和计算要求.Hadoop分布式文件系统(HDFS)是海量数据存 ...
- docker开启2376端口CA认证及IDEA中一键部署docker项目
嘿,大家好,今天更新的内容是docker开启2376端口CA认证及IDEA中一键部署docker项目... 先看效果 我们可以通过idea一键部署docker项目,还以通过idea的控制台实时查看容器 ...
随机推荐
- 【转帖】32.MinorGC、MajorGC和FullGC的对比
目录 1.MinorGC.MajorGC和FullGC的对比 2.GC触发机制 1.MinorGC.MajorGC和FullGC的对比 1.JVM在进行GC的时候,并不是每次都是对新生代.老年代.永久 ...
- [转帖]Linux CPU频率控制
1. 概述 Linux 内部共有五种对频率的管理策略 userspace , conservative , ondemand , powersave 和 performance. l ...
- 计划任务方式定期获取jvm dump的方法
说明 产品最近有一些问题,想着能够每隔一段时间抓取一下dump文件. 需求 可以定期抓取, 需要注意磁盘空间的使用. 实现方法 定时任务使用 crontab 计划任务来做 预定义获取jvm dump的 ...
- flex 布局子元素被挤压的问题
Flex 意为 "弹性布局",是一种在开发静态页面过程中常用的布局模式. 开发购物车使用flex布局的时候遇到的一种场景:子元素被挤压 具体如图所示, 当商品名称超出两行文字时显示 ...
- 【k哥爬虫普法】爬取数据是否一定构成不正当竞争?
我国目前并未出台专门针对网络爬虫技术的法律规范,但在司法实践中,相关判决已屡见不鲜,K 哥特设了"K哥爬虫普法"专栏,本栏目通过对真实案例的分析,旨在提高广大爬虫工程师的法律意识, ...
- ABP-VNext 用户权限管理系统实战02---用户权限表的创建与迁移
一.表实体建立 1.菜单表 [Comment("菜单表")] [Table("t_identity_menu")] public class Menu : Au ...
- Gin 框架介绍与快速入门
Gin 框架介绍与快速入门 目录 Gin 框架介绍与快速入门 一.Gin框架介绍 1. 快速和轻量级 2. 路由和中间件 3. JSON解析 4. 支持插件 5. Gin相关文档 二.基本使用 1.安 ...
- TienChin-系统功能介绍
线索管理 添加线索 查看线索 删除线索 修改线索 分配线索: 将录入到系统的线索,分配给某一个市场专员去处理 跟进线索: 持续跟进一条线索 1.判断是否伪线索 2.持续跟进,每次跟进需要有记录 3 ...
- 8.5 Windows驱动开发:内核注册表增删改查
注册表是Windows中的一个重要的数据库,用于存储系统和应用程序的设置信息,注册表是一个巨大的树形结构,无论在应用层还是内核层操作注册表都有独立的API函数可以使用,而在内核中读写注册表则需要使用内 ...
- C# 字符与字符串操作
在C#中,字符和字符串是两个重要的数据类型,有许多内置的方法可以处理字符和字符串.这些方法是非常有用的,可以帮助开发人员更方便.更高效地处理文本数据. 格式化字符串: using System; us ...