สารบัญ
การแจ้งเตือนบนมือถือที่มากับ Home Assistant กลมกลืนไปกับทุกอย่างบนมือถือของคุณ Echobell เพิ่มระดับความสำคัญเข้าไป ทั้งแบบพุช สำคัญตามเวลา หรือสายโทรเข้าจริง ๆ เพื่อไม่ให้เหตุการณ์สำคัญในบ้านอัจฉริยะจมหายไป การเชื่อมต่อนี้ไม่ต้องใช้คอมโพเนนต์เสริมใด ๆ ใช้แค่ REST command กับ URL ของ webhook ของคุณ
การตั้งค่าเบื้องต้น
- ดาวน์โหลด Echobell / Google Play แล้วสร้างช่องหนึ่งช่อง (เช่น "Home Alerts")
- คัดลอก URL ของ webhook จากหน้าตั้งค่าช่อง
- เพิ่ม REST command ลงใน
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 }}"}'
- รีสตาร์ต Home Assistant
- เรียกใช้บริการนี้จากออโตเมชันใดก็ได้
ทดสอบด้วยออโตเมชันเซนเซอร์ประตูง่าย ๆ:
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') }}"
ตัวอย่างออโตเมชันที่ใช้ได้จริง
มอนิเตอร์อุณหภูมิพร้อมสายโทรแจ้งเตือน
สำหรับเซนเซอร์ที่ปกป้องอาหาร อุปกรณ์ หรือความปลอดภัย ให้ตั้งประเภทช่อง Echobell เป็น โทรเข้า เพื่อให้ดังเหมือนสายโทรศัพท์:
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"
แจ้งเตือนความปลอดภัยอย่างชาญฉลาด
ส่งตัวแปรบริบทไปกับ webhook แล้วใช้เงื่อนไขของ Echobellกรองที่ฝั่งช่อง:
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 }}"
เงื่อนไขของช่อง: alarm_state == "armed_away" || (hour >= 22 || hour <= 7)
แบบนี้จะส่งการแจ้งเตือนเฉพาะตอนที่ระบบกันขโมยถูกเปิดใช้งานหรือเป็นเวลากลางคืน ซึ่งช่วยกรองสัญญาณรบกวนจากความเคลื่อนไหวตอนกลางวันออกไป โดยไม่ต้องปิดออโตเมชันทิ้ง
แจ้งเตือนเมื่อเครื่องใช้ไฟฟ้าทำงานเสร็จ
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!"
สรุปประจำเช้า
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 %}
ฟีเจอร์ขั้นสูง
ลิงก์ตามบริบท
ตัวแปร externalLink จะเพิ่มลิงก์ที่แตะได้ลงในประวัติการแจ้งเตือนของคุณใน 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"
กลยุทธ์แบบหลายช่อง
ใช้ช่องแยกกันโดยตั้งประเภทการแจ้งเตือนต่างกัน:
- กิจวัตรในบ้าน (ปกติ): เครื่องใช้ไฟฟ้า สรุปประจำวัน
- การมอนิเตอร์บ้าน (สำคัญตามเวลา): อุณหภูมิ ความชื้น การใช้พลังงานที่พุ่งสูง
- ความปลอดภัยในบ้าน (โทรเข้า): ความเคลื่อนไหวขณะเปิดระบบกันขโมย เซนเซอร์ประตู ความล้มเหลวร้ายแรง
เก็บ URL ของ Webhook ให้ปลอดภัย
ใช้ระบบ secrets ของ Home Assistant เพื่อไม่ให้ URL ของ webhook ปรากฏในไฟล์คอนฟิก:
# secrets.yaml
echobell_webhook: "https://hook.echobell.one/t/<channel-token>"
# configuration.yaml
rest_command:
echobell_home:
url: !secret echobell_webhook
ดูเอกสารทางเทคนิคฉบับเต็ม รวมถึงการใช้เทมเพลตขั้นสูงและการแก้ปัญหา ได้ที่คู่มือการเชื่อมต่อ Home Assistant ส่วนการเชื่อมต่ออื่น ๆ ดูได้ที่การแจ้งเตือนจาก GitHub Actions และการแจ้งเตือนการมอนิเตอร์ด้วย Grafana