This is a custom component for Home Assistant that allows sending and receiving messages through Nextcloud Talk.
- Send messages to Nextcloud Talk channels using the Nextcloud OCS API.
- Receive messages from Nextcloud Talk via webhooks, and trigger Home Assistant automations based on those messages.
- Simple configuration and setup via Home Assistant UI.
-
Download the custom component: Clone this repository or download it as a ZIP file and place it in the
custom_components/nextcloud_talk
directory inside your Home Assistant configuration folder.git clone [email protected]:highTowerSU/ha-nextcloud-chat.git
-
Ensure the directory structure looks like this:
custom_components/ └── nextcloud_talk ├── __init__.py ├── manifest.json ├── notify.py ├── auth_flow.py └── services.yaml
-
Restart Home Assistant: After placing the files in the correct directory, restart Home Assistant to load the custom component.
Once the component is installed, you can configure it either via the UI (if using auth_flow.py
), or by adding the following to your configuration.yaml
:
notify:
- platform: nextcloud_talk
url: "https://your-nextcloud-instance.com"
api_key: "Base64-encoded-auth-string"
chat_id: "your_conversation_id"
- url: The URL of your Nextcloud instance (e.g., https://nextcloud.example.com).
- api_key: Your Base64-encoded authentication credentials (
username:password
encoded in Base64). - chat_id: The 'conversation_id' of the Nextcloud Talk chat where messages should be sent.
Once configured, you can use the notify
service in Home Assistant to send messages to a Nextcloud Talk channel. Example:
service: notify.nextcloud_talk
data:
message: "This is a message sent to Nextcloud Talk from Home Assistant."
Messages sent to the Nextcloud Talk channel will trigger the webhook registered by this component. You can create automations in Home Assistant based on received messages:
automation:
- alias: "React to Nextcloud Talk Message"
trigger:
platform: event
event_type: nextcloud_talk_message
action:
service: notify.persistent_notification
data_template:
title: "New Message from Nextcloud Talk"
message: "{{ trigger.event.data.sender }}: {{ trigger.event.data.message }}"
``