Hi all,
I open-sourced a Home Assistant custom integration for Matrix messaging.
GitHub:
What it supports
- Send messages to Matrix users and rooms.
- Send media (image/video/file) with Element X compatible payloads.
- Reply, edit, and reaction support.
notify.matrix_chatnotify platform.- Optional encrypted gateway for E2EE rooms and encrypted DMs.
- Inbound webhook events for automations.
- Optional command dispatch (
!ha) with strict allowlists. - Outbound retry queue and manual flush tools.
- Room/user helper services (
resolve_target,list_rooms,join_room,invite_user,ensure_dm,ensure_room_encrypted).
Installation (quick)
- Copy
custom_components/matrix_chatto/config/custom_components/matrix_chat - Restart Home Assistant
- Add integration:
Settings -> Devices & Services -> Add Integration -> Matrix Chat
Minimal config example
matrix_chat:
homeserver: "https://matrix.example.org"
user_id: "@ha_bot:matrix.example.org"
access_token: !secret matrix_access_token
verify_ssl: true
dm_encrypted: true
Service examples
Send text:
service: matrix_chat.send_message
data:
target: "@user:matrix.example.org"
message: "Home Assistant event: motion detected."
Send image:
service: matrix_chat.send_media
data:
target: "!roomid:matrix.example.org"
file_path: "/config/www/camera/snapshot.jpg"
message: "Camera snapshot"
Send video:
service: matrix_chat.send_media
data:
target: "!roomid:matrix.example.org"
file_path: "/config/www/camera/clip.mp4"
message: "Camera clip"
auto_convert: true
Notify platform:
service: notify.matrix_chat
data:
target:
- "!roomid:matrix.example.org"
message: "System check: OK"
Optional encrypted gateway
cd encrypted_gateway
cp .env.example .env
mkdir -p data/store
docker compose up -d --build
Documentation
- README
docs/HOWTO.mddocs/DEVELOPER_GUIDE.mddocs/OPERATIONS_AND_LESSONS.mdwiki/pages for onboarding, troubleshooting, and deep-dive details
Feedback and issues are welcome.