diff --git a/docs/meshtastic/index.html b/docs/meshtastic/index.html index 3c0e845..8a62811 100644 --- a/docs/meshtastic/index.html +++ b/docs/meshtastic/index.html @@ -127,6 +127,7 @@ import time import sys import traceback import time +import base64 from . import mesh_pb2 from . import util from pubsub import pub @@ -261,6 +262,14 @@ class MeshInterface: t.set_radio.CopyFrom(self.radioConfig) self._sendToRadio(t) + @property + def channelURL(self): + """The sharable URL that describes the current channel + """ + bytes = self.radioConfig.channel_settings.SerializeToString() + s = base64.urlsafe_b64encode(bytes).decode('ascii') + return f"https://www.meshtastic.org/c/#{s}" + def _generatePacketId(self): """Get a new unique packet ID""" if self.currentPacketId is None: @@ -704,6 +713,7 @@ class StreamInterface(MeshInterface):
MeshInterface:
channelURLsendDatasendPacketsendPositionvar channelURLThe sharable URL that describes the current channel
@property
+def channelURL(self):
+ """The sharable URL that describes the current channel
+ """
+ bytes = self.radioConfig.channel_settings.SerializeToString()
+ s = base64.urlsafe_b64encode(bytes).decode('ascii')
+ return f"https://www.meshtastic.org/c/#{s}"
+
@@ -1378,6 +1415,7 @@ start the reading thread later.
MeshInterface:
+channelURL
sendData
sendPacket
sendPosition
@@ -1423,7 +1461,8 @@ start the reading thread later.
-
MeshInterface
-
+
+channelURL
sendData
sendPacket
sendPosition
diff --git a/meshtastic/__init__.py b/meshtastic/__init__.py
index 57dbfe6..8167911 100644
--- a/meshtastic/__init__.py
+++ b/meshtastic/__init__.py
@@ -56,6 +56,7 @@ import time
import sys
import traceback
import time
+import base64
from . import mesh_pb2
from . import util
from pubsub import pub
@@ -190,6 +191,14 @@ class MeshInterface:
t.set_radio.CopyFrom(self.radioConfig)
self._sendToRadio(t)
+ @property
+ def channelURL(self):
+ """The sharable URL that describes the current channel
+ """
+ bytes = self.radioConfig.channel_settings.SerializeToString()
+ s = base64.urlsafe_b64encode(bytes).decode('ascii')
+ return f"https://www.meshtastic.org/c/#{s}"
+
def _generatePacketId(self):
"""Get a new unique packet ID"""
if self.currentPacketId is None:
diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py
index 4ac2891..431c55c 100644
--- a/meshtastic/__main__.py
+++ b/meshtastic/__main__.py
@@ -127,6 +127,7 @@ def onConnected(interface):
closeNow = True
print(interface.myInfo)
print(interface.radioConfig)
+ print(f"Channel URL {interface.channelURL}")
print("Nodes in mesh:")
for n in interface.nodes.values():
print(n)
diff --git a/setup.py b/setup.py
index 86a8ecf..63e580a 100644
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@ with open("README.md", "r") as fh:
# This call to setup() does all the work
setup(
name="meshtastic",
- version="1.0.5",
+ version="1.0.6",
description="Python API & client shell for talking to Meshtastic devices",
long_description=long_description,
long_description_content_type="text/markdown",