A Home Assistant custom integration that enables bidirectional communication with Lark/Feishu (飛書). Send notifications from Home Assistant to Lark and trigger automations from Lark messages.
✨ HA → Lark Notifications
- Send text messages, images, and rich interactive cards
- Support for action buttons in cards
- Multiple notification targets (private DMs and group chats)
- Easy integration with Home Assistant automations
🔔 Lark → HA Commands
- Receive messages from Lark bot
- Trigger Home Assistant automations from Lark
- Interactive button callbacks execute HA services directly
- Event-based architecture for flexible automation
🌍 Multi-language Support
- English
- 繁體中文 (Traditional Chinese)
- 简体中文 (Simplified Chinese)
- Open HACS in your Home Assistant instance
- Click on "Integrations"
- Click the three dots in the top right corner
- Select "Custom repositories"
- Add this repository URL:
https://github.com/calvinastroboy/ha-lark-integration - Select category: "Integration"
- Click "Add"
- Find "Lark (飛書)" in the integration list and click "Download"
- Restart Home Assistant
- Download the latest release from GitHub
- Copy the
custom_components/larkfolder to your Home Assistantconfig/custom_components/directory - Restart Home Assistant
Before setting up this integration, you need to create a Lark bot application:
- Go to Lark Open Platform
- Create a new app or use an existing one
- Enable the bot capability
- Add the following permissions:
im:message:send_as_bot(send messages as bot)im:chat:readonly(read chat list)im:message(receive messages)
- Subscribe to the following events:
im.message.receive_v1(receive messages)
- Note down your App ID and App Secret
- Go to Settings → Devices & Services
- Click + Add Integration
- Search for Lark (or 飛書)
- Enter your App ID and App Secret
- Select default notification target chats (you can change this later)
- Click Submit
After setup, you need to configure the webhook URL in Lark:
- Get your webhook URL from the integration settings:
- Format:
https://your-ha-instance.com/api/webhook/<webhook_id>
- Format:
- Go to your Lark app settings → Event Subscriptions
- Enter the webhook URL
- Lark will send a verification request
- Save the configuration
Note: Your Home Assistant instance must be accessible from the internet for webhooks to work.
action: notify.lark
data:
message: "Motion detected in living room"action: notify.lark
data:
title: "Security Alert"
message: "Front door opened at {{ now() }}"action: notify.lark
data:
message: "🔔 Doorbell rang"
data:
image_url: "http://your-camera-ip/snapshot.jpg"action: notify.lark
data:
title: "🔔 Someone at the door"
message: "Detected at {{ now().strftime('%H:%M:%S') }}"
data:
image_url: "http://frigate.local:5000/api/doorbell/latest.jpg"
buttons:
- text: "Open Door"
action: switch.turn_on
entity_id: switch.door_lock
- text: "Turn on Light"
action: light.turn_on
entity_id: light.entrance
- text: "Ignore"
action: dismissYou can override the default target in each notification:
action: notify.lark
data:
message: "Test message"
target: "oc_abc123xyz" # Specific chat_id or open_idautomation:
- alias: "Turn on lights from Lark"
trigger:
- platform: event
event_type: lark_command
event_data:
text: "開燈"
action:
- action: light.turn_on
target:
entity_id: light.living_room
- action: notify.lark
data:
message: "✅ Living room light turned on"When a user clicks a button in an interactive card, the integration automatically executes the specified action. You can also listen for the event:
automation:
- alias: "Log button presses"
trigger:
- platform: event
event_type: lark_button_callback
action:
- action: logbook.log
data:
name: "Lark Button"
message: "Action: {{ trigger.event.data.action }}, Entity: {{ trigger.event.data.entity_id }}"Send notifications to multiple chats:
action: notify.lark
data:
message: "System update completed"
target:
- "oc_abc123xyz"
- "oc_def456uvw"Specify whether the target is a user or chat:
action: notify.lark
data:
message: "Direct message"
data:
target_type: "open_id" # For direct messages to users
target: "ou_user123"Default is chat_id for group chats.
Fired when a message is received from Lark.
Event Data:
message_type: Type of message (text, image, etc.)content: Full message contenttext: Extracted text from messagesender_id: ID of the senderchat_id: ID of the chatmessage_id: ID of the message
Fired when a button in an interactive card is clicked.
Event Data:
action: The action type (e.g., "switch.turn_on")entity_id: The target entitysender_id: ID of the user who clickedmessage_id: ID of the message
- Check that your App ID and App Secret are correct
- Verify the bot is added to the target chat
- Check Home Assistant logs for error messages
- Ensure the chat_id is correct (check in Lark app settings)
- Ensure your Home Assistant instance is accessible from the internet
- Verify the webhook URL is correctly configured in Lark
- Check that Lark has successfully verified the webhook URL
- Check Home Assistant logs for incoming webhook requests
- Add the bot to the desired chat in Lark
- The bot must be a member of the chat to send messages
- Refresh the integration options to see updated chat list
If you encounter any issues or have questions:
- Check the Issues page
- Search for existing solutions
- Create a new issue with detailed information:
- Home Assistant version
- Integration version
- Error logs
- Steps to reproduce
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Developed by calvinastroboy
Note: This integration is not officially affiliated with Lark/Feishu or ByteDance.