First steps
Do these tasks in sequence after you install the integration. Use an administrator account: meshcore.execute_command and meshcore.add_selected_contact are admin-only. The examples use the companion mynode with the prefix abc123.
Step 0. Open the action editor
You run most actions on this page in the action editor.
- Go to Developer Tools > Actions.
- Select Go to YAML mode.
To run an action, paste its YAML and select Perform action. When an action returns data, the response shows below the form.
Step 1. Check the companion entities
- Go to Settings > Devices & services > MeshCore.
- Open the device
MeshCore mynode (abc123). - Make sure that Node Status shows Online.
- Compare Frequency, Bandwidth and Spreading Factor with the settings of your local mesh.
If Node Status is not Online, see Troubleshooting.
Step 2. Send a test message on a private channel
CAUTION: Do not send test messages on the Public channel (channel 0). All nodes in the mesh receive it, and each message uses airtime for all users.
-
Make a 16-byte secret:
openssl rand -hex 16. -
Find a free channel index. See Find a free channel index. The examples use index 2.
-
Run
meshcore.execute_command:action: meshcore.execute_command
data:
command: "set_channel 2 mytest <secret>" -
Make sure that
select.meshcore_channelhas the optionmytest (2). -
Send a test message:
action: meshcore.send_channel_message
data:
channel_idx: 2
message: "Test 1" -
Wait a maximum of 20 seconds. Then read
sensor.meshcore_abc123_last_message_delivery_mynode.
| Final state | Meaning |
|---|---|
1 Repeater, 2 Repeaters and more | The companion heard this number of repeaters relay the message |
0 Repeaters | The companion heard no repeat. This is usual when no repeater is in range. |
Unconfirmed | The message is too long for the companion to report repeats |
Find a free channel index
- Run
meshcore.get_channels. The response lists only the channels that are in use. - In Developer Tools > States, open
select.meshcore_channel. Its options show all channel slots of the companion as<name> (<channel_idx>). - Select an index that is not in the
get_channelsresponse.
Step 3. Add a contact
The integration keeps the nodes that the companion hears as discovered contacts. Add a node to send direct messages to it or to track it.
-
Wait until the companion hears adverts.
-
In Developer Tools > States, filter on
_contact. -
Find a contact sensor with the state
discovered, for examplebinary_sensor.meshcore_myrepeater_def456abc012_contact. -
Copy its
pubkey_prefixattribute. -
Run this command:
action: meshcore.execute_command
data:
command: "add_contact def456abc012" -
Make sure that the contact sensor changes to
freshorstale.
In Data only discovery mode, discovered contacts have no sensor. Use the options of select.meshcore_discovered_contact to find the prefix. See Contact Management.
Step 4. Add a hashtag channel
All nodes that use the same hashtag channel name share the channel.
-
Get the exact channel name from the other users. The name starts with
#and is case-sensitive. -
Find a free channel index. See Find a free channel index.
-
Run this command. Use quotes, because YAML reads
#as the start of a comment:action: meshcore.execute_command
data:
command: "set_channel 1 #mychannel" -
Make sure that
select.meshcore_channelhas the option#mychannel (1).
CAUTION: Do not use set_channel on channel 0. If the key of channel 0 changes, the companion cannot read or send on the Public channel.
Step 5. Track a repeater
The repeater must be an added contact (step 3).
- Go to Settings > Devices & services > MeshCore.
- Select Configure.
- In Choose an action, select Add Repeater Station.
- Select Submit.
- In Available Repeaters, select the repeater.
- In Password, enter the repeater password. If the repeater ACL gives access without a password, leave it blank.
- Keep the default Telemetry Refresh Rate (seconds) of 7200.
- Select Submit.
The integration adds the device MeshCore Repeater: myrepeater (def456). The sensors stay unavailable until the first status response. Each poll uses airtime on the mesh. Do not set an interval shorter than the default unless you need more frequent data. See Remote Node Tracking.
Step 6. Add a dashboard
Use the cards in Dashboard cards, or a full dashboard: Basic Node or Basic Repeater.
Step 7. Create a first automation
This automation shows a notification for each received message. The condition ignores the messages that Home Assistant sends.
-
Go to Settings > Automations & scenes.
-
Create a new automation.
-
Open the three-dot menu.
-
Select Edit in YAML.
-
Paste this automation:
alias: MeshCore message notification
triggers:
- trigger: event
event_type: meshcore_message
conditions:
- condition: template
value_template: "{{ not (trigger.event.data.outgoing | default(false)) }}"
actions:
- action: persistent_notification.create
data:
title: MeshCore message
message: >-
{{ trigger.event.data.sender_name | default('Unknown', true) }}:
{{ trigger.event.data.message }}
mode: queued -
Select Save.
For more examples, see Automation.