1
0
Fork 0

home-assistant: Deploy Piper and Whisper

Piper is the new text-to-speech service for Home Assistant.  Whisper is
a speech-to-text service.  Together, these services, which communicate
with Home Assistant via the Wyoming protocol, provide the speech
interface to the new Home Assistant Voice Assistant feature.
Dustin 2023-08-02 19:59:30 -05:00
parent a7eac14d39
commit 0cbda0fd73
6 changed files with 237 additions and 27 deletions

View File

@ -27,6 +27,8 @@ The Home Assistant ecosystem consists of these components:
* Mosquitto (MQTT server) * Mosquitto (MQTT server)
* Zigbee2MQTT (Zigbee integration) * Zigbee2MQTT (Zigbee integration)
* ZWaveJS2MQTT (ZWave integration) * ZWaveJS2MQTT (ZWave integration)
* Piper (Text-to-speech)
* Whisper (Speech-to-text)
Each of these components runs in a container in separate pods within the Each of these components runs in a container in separate pods within the
*home-assistant* namespace. *home-assistant* namespace.
@ -121,6 +123,22 @@ StatefulSet with a PersistentVolume Claim.
[ZWaveJS2MQTT]: https://github.com/zwave-js/zwavejs2mqtt/ [ZWaveJS2MQTT]: https://github.com/zwave-js/zwavejs2mqtt/
### Piper/Whisper
[Piper] and [Whisper] provide the text-to-speech and speech-to-text
capabilities, respectively, for Home Assistant [Voice Control]. These
processes are designed to run as Add-Ons for Home Assistant OS, but work just
fine as Kubernetes containers as well.
Piper and Whisper need mutable storage in order to download their machine
learning models. Since the model data are downloaded automatically when the
container starts, using ephemeral volumes is sufficient.
[Piper]: https://github.com/rhasspy/piper
[Whisper]: https://github.com/guillaumekln/faster-whisper/
[Voice Control]: https://www.home-assistant.io/voice_control/
## Raspberry Pi Node ## Raspberry Pi Node
While Home Assistant Core and Mosquitto can run on any node in the Kubernetes While Home Assistant Core and Mosquitto can run on any node in the Kubernetes

View File

@ -1,3 +1,4 @@
// vim: set sw=4 ts=4 sts=4 et :
@startuml @startuml
person User person User
@ -12,6 +13,8 @@ cloud Kubernetes {
node "Main Node Cluster" { node "Main Node Cluster" {
[Home Assistant] as hass [Home Assistant] as hass
queue Mosquitto as mqtt queue Mosquitto as mqtt
[Piper] as piper
[Whisper] as whisper
database PostgreSQL as postgres database PostgreSQL as postgres
} }
@ -37,6 +40,8 @@ cloud Kubernetes {
ingress --[#purple]-> mqtt ingress --[#purple]-> mqtt
hass -[#teal]-> postgres hass -[#teal]-> postgres
hass -[#orange]-> zwavejs hass -[#orange]-> zwavejs
hass -[#pink]--> piper
hass -[#pink]--> whisper
hass -[#purple]> mqtt hass -[#purple]> mqtt
z2m -[#purple]-> mqtt z2m -[#purple]-> mqtt
@ -51,5 +56,6 @@ legend right
|<color:teal><&arrow-right></color> | PostgreSQL | |<color:teal><&arrow-right></color> | PostgreSQL |
|<color:red><&arrow-right></color> | USB | |<color:red><&arrow-right></color> | USB |
|<color:lightblue><&arrow-right></color> | ESPHome, etc. | |<color:lightblue><&arrow-right></color> | ESPHome, etc. |
|<color:pink><&arrow-right></color> | Wyoming |
end legend end legend
@enduml @enduml

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -10,6 +10,8 @@ resources:
- mosquitto.yaml - mosquitto.yaml
- zigbee2mqtt.yaml - zigbee2mqtt.yaml
- zwavejs2mqtt.yaml - zwavejs2mqtt.yaml
- piper.yaml
- whisper.yaml
- ingress.yaml - ingress.yaml
configMapGenerator: configMapGenerator:

90
home-assistant/piper.yaml Normal file
View File

@ -0,0 +1,90 @@
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/component: piper
app.kubernetes.io/instance: piper
app.kubernetes.io/name: piper
app.kubernetes.io/part-of: home-assistant
name: piper
spec:
ports:
- port: 10200
name: wyoming
selector:
app.kubernetes.io/component: piper
app.kubernetes.io/instance: piper
app.kubernetes.io/name: piper
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/component: piper
app.kubernetes.io/instance: piper
app.kubernetes.io/name: piper
app.kubernetes.io/part-of: home-assistant
name: piper
spec:
selector:
matchLabels:
app.kubernetes.io/component: piper
app.kubernetes.io/instance: piper
app.kubernetes.io/name: piper
template:
metadata:
labels:
app.kubernetes.io/component: piper
app.kubernetes.io/instance: piper
app.kubernetes.io/name: piper
app.kubernetes.io/part-of: home-assistant
spec:
containers:
- name: piper
image: docker.io/rhasspy/wyoming-piper
args:
- --voice=en-us-amy-low
ports:
- containerPort: 10200
name: wyoming
readinessProbe: &probe
tcpSocket:
port: 10200
failureThreshold: 3
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 1
startupProbe:
<<: *probe
failureThreshold: 30
periodSeconds: 3
initialDelaySeconds: 3
securityContext:
readOnlyRootFilesystem: true
runAsUser: 300
runAsGroup: 300
volumeMounts:
- mountPath: /data
name: piper-data
subPath: data
- mountPath: /tmp
name: piper-temp
subPath: tmp
securityContext:
fsGroup: 300
volumes:
- name: piper-data
ephemeral:
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 500Mi
- name: piper-temp
emptyDir:
medium: Memory

View File

@ -0,0 +1,85 @@
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/component: whisper
app.kubernetes.io/instance: whisper
app.kubernetes.io/name: whisper
app.kubernetes.io/part-of: home-assistant
name: whisper
spec:
ports:
- port: 10300
name: wyoming
selector:
app.kubernetes.io/component: whisper
app.kubernetes.io/instance: whisper
app.kubernetes.io/name: whisper
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/component: whisper
app.kubernetes.io/instance: whisper
app.kubernetes.io/name: whisper
app.kubernetes.io/part-of: home-assistant
name: whisper
spec:
selector:
matchLabels:
app.kubernetes.io/component: whisper
app.kubernetes.io/instance: whisper
app.kubernetes.io/name: whisper
template:
metadata:
labels:
app.kubernetes.io/component: whisper
app.kubernetes.io/instance: whisper
app.kubernetes.io/name: whisper
app.kubernetes.io/part-of: home-assistant
spec:
containers:
- name: whisper
image: docker.io/rhasspy/wyoming-whisper
args:
- --model=base
- --language=en
ports:
- containerPort: 10300
name: wyoming
readinessProbe: &probe
tcpSocket:
port: 10300
failureThreshold: 3
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 1
startupProbe:
<<: *probe
failureThreshold: 30
periodSeconds: 3
initialDelaySeconds: 3
securityContext:
readOnlyRootFilesystem: true
runAsUser: 300
runAsGroup: 300
volumeMounts:
- name: whisper-data
mountPath: /data
subPath: data
securityContext:
fsGroup: 300
volumes:
- name: whisper-data
ephemeral:
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi