Home Assistant 联动语音控制智能家居
语音控制是智能家居的重要交互方式。对于使用 Home Assistant(HA)的用户,将 HA 与主流语音助手打通是实现'动口不动手'智能生活的关键。
为什么选择 Home Assistant?
HA 不卖硬件、不锁生态、数据本地流转。作为开源的家庭操作系统,它支持超过 2000 种设备协议(Zigbee、Z-Wave、MQTT 等),可统一管理不同品牌的设备。
实现语音联动的核心逻辑
语音助手本身不认识 Zigbee 或 MQTT,需将 HA 中的实体'翻译'为语音助手能理解的设备模型(如 light、switch)。
Google Assistant
需通过 Google Device Access 项目对接。
- 配置 HA 公网 HTTPS 地址(可使用 DuckDNS + Let's Encrypt)。
- 在 Google Developer Console 注册项目并下载服务账户密钥。
- 在
configuration.yaml中配置:
google_assistant:
project_id: your-device-access-project-id
service_account: !include google_service_account.json
report_state: true
exposed_domains:
- light
- switch
- climate
- 在 Google Home App 中添加账号同步设备。
注意:建议给设备起具体名称(如'客厅吸顶灯'),开启 report_state 以同步状态。
Amazon Alexa
通过 Smart Home Skill 机制对接。HA 内置 alexa 集成,支持 HTTPS 端点接收指令。
配置示例:
http:
ssl_certificate: /ssl/fullchain.pem
ssl_key: /ssl/privkey.pem
alexa:
smart_home:
endpoint: https://your-domain.duckdns.org/api/alexa/smart_home
client_id: amzn-client-id
client_secret: amzn-secret-key

