Skip to content

Commit 0bb3389

Browse files
committed
init
1 parent db21942 commit 0bb3389

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

meshtastic/__main__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,7 @@ def export_config(interface) -> str:
10971097
owner_short = interface.getShortName()
10981098
channel_url = interface.localNode.getURL()
10991099
myinfo = interface.getMyNodeInfo()
1100+
canned_messages = interface.getCannedMessage()
11001101
pos = myinfo.get("position")
11011102
lat = None
11021103
lon = None
@@ -1115,6 +1116,8 @@ def export_config(interface) -> str:
11151116
configObj["channelUrl"] = channel_url
11161117
else:
11171118
configObj["channel_url"] = channel_url
1119+
# if canned_messages:
1120+
# configObj["cannedMessages"] = canned_messages
11181121
# lat and lon don't make much sense without the other (so fill with 0s), and alt isn't meaningful without both
11191122
if lat or lon:
11201123
configObj["location"] = {"lat": lat or float(0), "lon": lon or float(0)}

meshtastic/mesh_interface.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,13 @@ def getPublicKey(self):
10761076
if user is not None:
10771077
return user.get("publicKey", None)
10781078
return None
1079+
1080+
def getCannedMessage(self):
1081+
"""Fetch and return the canned message from the local node."""
1082+
if hasattr(self, "localNode") and self.localNode:
1083+
return self.localNode.get_canned_message()
1084+
else:
1085+
raise RuntimeError("No local node available.")
10791086

10801087
def _waitConnected(self, timeout=30.0):
10811088
"""Block until the initial node db download is complete, or timeout

0 commit comments

Comments
 (0)