Skip to content

Commit 308ac93

Browse files
committed
add to configure
1 parent 84417f0 commit 308ac93

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

meshtastic/__main__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ def onConnected(interface):
362362
print(f"Setting device owner short to {args.set_owner_short}")
363363
interface.getNode(args.dest, False, **getNode_kwargs).setOwner(long_name=args.set_owner, short_name=args.set_owner_short)
364364

365-
# TODO: add to export-config and configure
366365
if args.set_canned_message:
367366
closeNow = True
368367
waitForAckNak = True
@@ -371,7 +370,6 @@ def onConnected(interface):
371370
args.set_canned_message
372371
)
373372

374-
# TODO: add to export-config and configure
375373
if args.set_ringtone:
376374
closeNow = True
377375
waitForAckNak = True
@@ -705,6 +703,16 @@ def onConnected(interface):
705703
interface.getNode(args.dest, **getNode_kwargs).setURL(configuration["channelUrl"])
706704
time.sleep(0.5)
707705

706+
if "canned_messages" in configuration:
707+
print("Setting canned message messages to", configuration["canned_messages"])
708+
interface.getNode(args.dest, **getNode_kwargs).set_canned_message(configuration["canned_messages"])
709+
time.sleep(0.5)
710+
711+
if "ringtone" in configuration:
712+
print("Setting ringtone to", configuration["ringtone"])
713+
interface.getNode(args.dest, **getNode_kwargs).set_ringtone(configuration["ringtone"])
714+
time.sleep(0.5)
715+
708716
if "location" in configuration:
709717
alt = 0
710718
lat = 0.0

meshtastic/mesh_interface.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,15 +1078,17 @@ def getPublicKey(self):
10781078
return None
10791079

10801080
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()
1081+
"""Get canned message"""
1082+
node = self.localNode
1083+
if node is not None:
1084+
return node.get_canned_message()
10841085
return None
1085-
1086+
10861087
def getRingtone(self):
1087-
"""Fetch and return the ringtone from the local node."""
1088-
if hasattr(self, "localNode") and self.localNode:
1089-
return self.localNode.get_ringtone()
1088+
"""Get ringtone"""
1089+
node = self.localNode
1090+
if node is not None:
1091+
return node.get_ringtone()
10901092
return None
10911093

10921094
def _waitConnected(self, timeout=30.0):

0 commit comments

Comments
 (0)