跳到主要内容

智能家居助手:HomeAssistant

HomeAssistant 介绍

HomeAssistant 是一个开源的智能家居管理系统,通常是直接以操作系统形式安装到设备里,但也提供了容器化部署的方式,本文介绍将 HomeAssistant 部署到 Kubernetes 的方法。

开源项目

目录结构

home-assistant
├── daemonset.yaml
└── kustomization.yaml

配置 daemonset.yaml

daemonset.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
app: home-assistant
name: home-assistant
namespace: default
spec:
selector:
matchLabels:
app: home-assistant
template:
metadata:
labels:
app: home-assistant
spec:
terminationGracePeriodSeconds: 1
containers:
- image: homeassistant/home-assistant:stable
imagePullPolicy: IfNotPresent
name: home-assistant
ports:
- containerPort: 8123
name: web
env:
- name: TZ
value: Asia/Shanghai
volumeMounts:
- mountPath: /config
name: config
- mountPath: /run/dbus
name: dbus
readOnly: true
dnsPolicy: Default
hostNetwork: true
restartPolicy: Always
volumes:
- name: config
hostPath:
path: /data/home-assistant/config
type: DirectoryOrCreate
- name: dbus
hostPath:
path: /run/dbus
updateStrategy:
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
type: RollingUpdate

配置 kustomization.yaml

kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- daemonset.yaml

namespace: default

访问 HomeAssistant

访问入口:http://路由器内网 IP:8123/