MeshCore/MeshCore2Discord

From Ottawa Mesh
Revision as of 18:27, 26 September 2025 by MrAlders0n (talk | contribs)
Jump to navigation Jump to search

Sending MeshCore Messages to Discord via Home Assistant

This guide explains how to forward MeshCore messages into Discord using Home Assistant as the bridge. You’ll need the MeshCore-HA integration (installed via HACS), and Home Assistant’s built-in Discord integration.

Prerequisites

  • A working Home Assistant setup
  • HACS installed and configured
  • Discord webhook or bot token ready
  • A configured MeshCore node

Steps

1. Setup MeshCore-HA

  • Open HACS in Home Assistant
  • Search for MeshCore-HA
  • Install the integration and restart Home Assistant
  • Configure the integration by adding your MeshCore node details in Home Assistant

2. Add the Discord Integration

  • In Home Assistant, go to Devices & Services
  • Click Add Integration
  • Search for and select Discord
  • Request the API token from MrAlderson
  • Enter the token and click Submit

3. Add the Testing Channel to the HA Companion

  • Disconnect MeshCore-HA from your Companion device
  • If using Wi‑Fi: connect to your Companion via the MeshCore mobile app
  • If using USB: connect to your PC and open [[1](https://app.meshcore.nz) app.meshcore.nz]
 Click Connectthe 3‑dot menuConnect via USB
  • Once connected, join the Testing channel just like you would in the mobile app
  • When finished, disconnect and reconnect to Home Assistant

4. Verify the Channel Number

  • Determine which channel number corresponds to Testing (likely Channel 2).
  • In Home Assistant, navigate to: Devices → MeshCore → your Companion node
  • From your mobile device, send a message to the Testing channel
  • Check the Status page in Home Assistant — the message should appear under Channel 0 or Channel 1

5. Create an Automation to Forward #testing to Discord

  • In Home Assistant, go to Settings → Automations & Scenes → Automations
  • Click New Automation
  • Open the 3‑dot menu (top right) → Edit in YAML
  • Paste the YAML below and Save
alias: MeshCore - Bot - Forward testing to discord
description: When Testing receives a message forward it to Discord
triggers:
  - event_type: meshcore_message
    event_data:
      message_type: channel
      channel_idx: 1
    trigger: event
    enabled: true
conditions: []
actions:
  - action: notify.benderha
    metadata: {}
    data:
      target:
        - "DISCORD-THREAD-ID"
      message: "{{ trigger.event.data.sender_name }}: {{ trigger.event.data.message }}"
mode: parallel
max: 20
Replace values
  • DISCORD-THREAD-ID → Request the thread ID from MrAlders0n and replace it in the YAML.
  • channel_idx: 1 → Replace with the channel number for Testing that you discovered in Step 4.