Mục lục
Thông báo di động dựng sẵn của Home Assistant lẫn vào mọi thứ khác trên điện thoại bạn. Echobell bổ sung các mức ưu tiên — thông báo đẩy, khẩn cấp, hoặc một cuộc gọi thật — để những sự kiện nhà thông minh quan trọng không bị chôn vùi. Việc tích hợp không cần custom component nào: chỉ một lệnh REST và webhook URL của bạn.
Thiết lập cơ bản
- Tải Echobell / Google Play và tạo một kênh (ví dụ "Home Alerts")
- Sao chép webhook URL trong phần cài đặt kênh
- Thêm một lệnh REST vào
configuration.yaml:
rest_command:
echobell_home:
url: "https://hook.echobell.one/t/<channel-token>"
method: POST
content_type: "application/json"
payload: '{"title": "{{ title }}", "message": "{{ message }}"}'
- Khởi động lại Home Assistant
- Gọi service này từ bất kỳ automation nào
Hãy thử với một automation cảm biến cửa đơn giản:
automation:
- alias: "Door Open Test"
trigger:
- platform: state
entity_id: binary_sensor.front_door
to: "on"
action:
- service: rest_command.echobell_home
data:
title: "Front Door"
message: "Door opened at {{ now().strftime('%H:%M') }}"
Vài ví dụ automation thực tế
Giám sát nhiệt độ kèm cảnh báo cuộc gọi
Với những cảm biến bảo vệ thực phẩm, thiết bị hay an toàn — hãy đặt kiểu kênh Echobell là Cuộc gọi để nó reo như điện thoại:
automation:
- alias: "Freezer Temperature Alert"
trigger:
- platform: numeric_state
entity_id: sensor.freezer_temperature
above: -10
for:
minutes: 15
action:
- service: rest_command.echobell_home
data:
title: "⚠️ Freezer Temperature Alert"
message: "Freezer is at {{ states('sensor.freezer_temperature') }}°C for 15+ minutes"
severity: "critical"
Cảnh báo an ninh thông minh
Hãy gửi kèm các biến bối cảnh trong webhook, rồi dùng điều kiện của Echobell để lọc ở phía kênh:
automation:
- alias: "Smart Security Alert"
trigger:
- platform: state
entity_id:
- binary_sensor.motion_living_room
- binary_sensor.motion_bedroom
to: "on"
action:
- service: rest_command.echobell_home
data:
title: "Security Event"
message: "{{ trigger.to_state.attributes.friendly_name }} detected motion"
alarm_state: "{{ states('alarm_control_panel.home_alarm') }}"
hour: "{{ now().hour }}"
Điều kiện của kênh: alarm_state == "armed_away" || (hour >= 22 || hour <= 7)
Cách này chỉ gửi cảnh báo khi hệ thống báo động đang bật hoặc đang là ban đêm — lọc bỏ nhiễu chuyển động ban ngày mà không phải tắt automation.
Cảnh báo thiết bị chạy xong
automation:
- alias: "Laundry Done"
trigger:
- platform: state
entity_id: sensor.washer_power
to: "0"
for:
minutes: 3
action:
- service: rest_command.echobell_home
data:
title: "🧺 Laundry Complete"
message: "Washing machine finished. Don't let it sit!"
Bản tóm tắt buổi sáng
automation:
- alias: "Morning Home Report"
trigger:
- platform: time
at: "08:00:00"
action:
- service: rest_command.echobell_home
data:
title: "Good Morning - Home Status"
message: >
Temperature: {{ states('sensor.living_room_temperature') }}°C
Humidity: {{ states('sensor.living_room_humidity') }}%
Energy yesterday: {{ states('sensor.daily_energy') }} kWh
All windows: {% if is_state('binary_sensor.window_group', 'off') %}Closed{% else %}OPEN{% endif %}
Tính năng nâng cao
Liên kết theo ngữ cảnh
Biến externalLink thêm một liên kết bấm được vào lịch sử thông báo trong Echobell:
action:
- service: rest_command.echobell_home
data:
title: "Motion at Front Door"
message: "Check the camera feed"
externalLink: "https://my-home-assistant.duckdns.org/lovelace/security"
Chiến lược nhiều kênh
Hãy dùng các kênh riêng với kiểu thông báo khác nhau:
- Home Routine (thông thường): Thiết bị gia dụng, tóm tắt hằng ngày
- Home Monitoring (khẩn cấp): Nhiệt độ, độ ẩm, đột biến điện năng
- Home Security (cuộc gọi): Chuyển động khi đã bật báo động, cảm biến cửa, sự cố nghiêm trọng
Bảo vệ webhook URL
Hãy dùng secrets của Home Assistant để không lộ webhook URL trong file cấu hình:
# secrets.yaml
echobell_webhook: "https://hook.echobell.one/t/<channel-token>"
# configuration.yaml
rest_command:
echobell_home:
url: !secret echobell_webhook
Muốn xem tài liệu kỹ thuật đầy đủ, gồm cả cách viết template nâng cao và xử lý sự cố, hãy đọc hướng dẫn tích hợp Home Assistant. Với các tích hợp khác, xem thông báo GitHub Actions và cảnh báo giám sát Grafana.