mirror of
https://github.com/pdxlocations/contact.git
synced 2026-03-28 17:12:35 +01:00
refactor
This commit is contained in:
19
get-channels.py
Normal file
19
get-channels.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import meshtastic.serial_interface
|
||||
import base64
|
||||
|
||||
# Initialize Meshtastic interface
|
||||
interface = meshtastic.serial_interface.SerialInterface()
|
||||
|
||||
# Get node information
|
||||
node = interface.getNode('^local')
|
||||
channels = node.channels
|
||||
print (channels)
|
||||
if channels:
|
||||
print("Channels:")
|
||||
for channel in channels:
|
||||
if channel.role:
|
||||
psk_base64 = base64.b64encode(channel.settings.psk).decode('utf-8')
|
||||
print(f"Index: {channel.index}, Role: {channel.role}, PSK (Base64): {psk_base64}, Name: {channel.settings.name}")
|
||||
else:
|
||||
print("No channels found.")
|
||||
|
||||
Reference in New Issue
Block a user