Fix example

This commit is contained in:
Alex Wolden 2025-04-12 13:53:37 -07:00
parent 7b28029ae0
commit b700ae75e9
2 changed files with 6 additions and 4 deletions

View file

@ -3,16 +3,18 @@
import asyncio
from meshcore import MeshCore
PORT = "/dev/ttyUSB0"
PORT = "/dev/tty.usbserial-583A0069501"
BAUDRATE = 115200
DEST = "mchome"
DEST = "🦄"
MSG = "hello from serial"
async def main () :
mc = await MeshCore.create_serial(PORT, BAUDRATE)
await mc.ensure_contacts()
await mc.commands.send_msg(bytes.fromhex(mc.get_contact_by_name(DEST)["public_key"])[0:6], MSG)
contact = mc.get_contact_by_name(DEST)
await mc.commands.send_msg(bytes.fromhex(contact["public_key"])[0:6], MSG)
print ("Message sent ... awaiting")
asyncio.run(main())

View file

@ -208,7 +208,7 @@ class MeshCore:
if not self._contacts:
return None
for contact_id, contact in self._contacts.items():
for _, contact in self._contacts.items():
if contact.get("adv_name", "").lower() == name.lower():
return contact