---
title: "Thông báo Home Assistant với Echobell: Cảnh báo tức thì cho nhà thông minh"
description: "Kết nối Home Assistant với Echobell qua lệnh REST để nhận thông báo đẩy có phân cấp ưu tiên hoặc cuộc gọi cho các sự kiện an ninh và tự động hóa."
date: 2025-12-01
author: Nooc
authorAvatarLink: /images/avatars/nooc.webp
authorLink: https://nooc.me
tags:
  - Echobell
  - Home Assistant
  - Nhà thông minh
  - Tự động hóa nhà cửa
  - Thông báo webhook
---

# Thông báo Home Assistant với Echobell: Cảnh báo tức thì cho nhà thông minh

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

1. [Tải Echobell](https://apps.apple.com/app/apple-store/id6743597198?pt=128151925&ct=blog-home-assistant-notifications-1ozbir&mt=8) / [Google Play](https://play.google.com/store/apps/details?id=one.echobell.echobellandroid) và tạo một kênh (ví dụ "Home Alerts")
2. Sao chép webhook URL trong phần cài đặt kênh
3. Thêm một lệnh REST vào `configuration.yaml`:

```yaml
rest_command:
  echobell_home:
    url: "https://hook.echobell.one/t/<channel-token>"
    method: POST
    content_type: "application/json"
    payload: '{"title": "{{ title }}", "message": "{{ message }}"}'
```

4. Khởi động lại Home Assistant
5. 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:

```yaml
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:

```yaml
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](/vi/docs/conditions) để lọc ở phía kênh:

```yaml
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

```yaml
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

```yaml
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:

```yaml
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:

1. **Home Routine** (thông thường): Thiết bị gia dụng, tóm tắt hằng ngày
2. **Home Monitoring** (khẩn cấp): Nhiệt độ, độ ẩm, đột biến điện năng
3. **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:

```yaml
# 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](/vi/docs/developer/home-assistant). Với các tích hợp khác, xem [thông báo GitHub Actions](/vi/blog/github-actions-notifications) và [cảnh báo giám sát Grafana](/vi/blog/grafana-call-notification).
