@@ -111,6 +111,121 @@ Message activity creates binary sensor entities that track communication:
111111- ** State** : Always "Active" when messages exist
112112- ** Attributes** : Public key
113113
114+ ## Channel Configuration
115+
116+ Meshcore devices support multiple channels with configurable names and hash-based encryption.
117+
118+ ### Hash-Based Channel Encryption
119+
120+ Channels use hash-based encryption where the channel name is hashed to derive the encryption key. Only nodes with the exact channel name can decrypt messages on that channel.
121+
122+ ** How it works:**
123+ - Each channel has a name and a hash derived from that name
124+ - The hash is used as the encryption key for the channel
125+ - Only devices configured with the same name+hash combination can communicate
126+ - You can create private channels by using unique names and sharing them securely
127+
128+ ### Setting Channel Names
129+
130+ Use the ` set_channel ` command to configure channel names:
131+
132+ ``` yaml
133+ service : meshcore.execute_command
134+ data :
135+ command : " set_channel 1 #pdx {{ '#pdx' | sha256 | truncate(32, true, '') }}"
136+ ` ` `
137+
138+ **Important**: When using ` #` in YAML, the entire command must be quoted (as shown above) since `#` starts a comment in YAML.
139+
140+ # ### Command Format
141+
142+ ```
143+ set_channel <channel_idx> <name > <hash >
144+ ```
145+
146+ - **channel_idx**: Channel number (e.g., 0, 1, 2, etc.)
147+ - **name**: Display name (e.g., `#pdx`, `private`, `work`, `my-secret-channel`)
148+ - **hash**: SHA256 hash of the channel name, truncated to 32 characters
149+
150+ The template `{{ '#pdx' | sha256 | truncate(32, true, '') }}` automatically generates the correct hash from the name.
151+
152+ **Note**: The `#` prefix is a convention for public/community channels but is not required. You can name channels anything you want.
153+
154+ ### Channel Management UI Card
155+
156+ Create a dashboard card to manage your channels:
157+
158+ ```yaml
159+ type: vertical-stack
160+ cards:
161+ - type: markdown
162+ content: |
163+ ## Channel Configuration
164+ Configure channels with hash-based encryption.
165+ - type: entities
166+ entities:
167+ - entity: input_text.meshcore_channel_name
168+ - entity: input_number.meshcore_channel_index
169+ - type: button
170+ name: Set Channel
171+ icon: mdi:pound
172+ tap_action:
173+ action: call-service
174+ service: meshcore.execute_command
175+ data:
176+ command: >
177+ set_channel {{ states('input_number.meshcore_channel_index') | int }}
178+ {{ states('input_text.meshcore_channel_name') }}
179+ {{ states('input_text.meshcore_channel_name') | sha256 | truncate(32, true, '') }}
180+ ```
181+
182+ ** Required Helper Entities** (create in Settings → Devices & Services → Helpers):
183+
184+ 1 . ** Channel Index** (Number):
185+ - Name: ` Meshcore Channel Index `
186+ - Entity ID: ` input_number.meshcore_channel_index `
187+ - Min: 0, Max: 99, Step: 1
188+ - Icon: ` mdi:numeric `
189+
190+ 2 . ** Channel Name** (Text):
191+ - Name: ` Meshcore Channel Name `
192+ - Entity ID: ` input_text.meshcore_channel_name `
193+ - Max length: 32
194+ - Icon: ` mdi:pound `
195+
196+ ### Example Channel Configurations
197+
198+ #### Public Channel (Convention: # prefix)
199+ ``` yaml
200+ service : meshcore.execute_command
201+ data :
202+ command : " set_channel 0 #public {{ '#public' | sha256 | truncate(32, true, '') }}"
203+ ` ` `
204+
205+ #### Regional Channel
206+ ` ` ` yaml
207+ service : meshcore.execute_command
208+ data :
209+ command : " set_channel 1 #pdx {{ '#pdx' | sha256 | truncate(32, true, '') }}"
210+ ` ` `
211+
212+ #### Private Channel (Any name)
213+ ` ` ` yaml
214+ service : meshcore.execute_command
215+ data :
216+ command : " set_channel 2 my-secret-channel {{ 'my-secret-channel' | sha256 | truncate(32, true, '') }}"
217+ ` ` `
218+
219+ ### Viewing Configured Channels
220+
221+ To see your currently configured channels, use the **MeshCore Channel** select entity:
222+ - Entity ID: ` select.meshcore_channel`
223+ - Shows all configured channels with their names
224+ - Displays as "Name (idx)" format (e.g., "#pdx (1)", "work (2)")
225+ - Updates automatically when channels are configured
226+
227+ Use this select entity in your messaging UI to choose which channel to send to.
228+
114229# # Message Services
115230
116231Send messages using these services :
0 commit comments