mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-04-20 22:13:49 +00:00
29 lines
802 B
Python
Executable file
29 lines
802 B
Python
Executable file
#!/usr/bin/python
|
|
|
|
import asyncio
|
|
|
|
from meshcore import MeshCore
|
|
from meshcore.events import EventType
|
|
|
|
PORT = "/dev/tty.usbserial-583A0069501"
|
|
BAUDRATE = 115200
|
|
|
|
REPEATER="Orion"
|
|
PASSWORD="floopyboopy"
|
|
|
|
async def main () :
|
|
mc = await MeshCore.create_serial(PORT, BAUDRATE)
|
|
await mc.commands.get_contacts()
|
|
repeater = mc.get_contact_by_name(REPEATER)
|
|
|
|
await mc.commands.send_login(bytes.fromhex(repeater["public_key"]), PASSWORD)
|
|
|
|
print("Login sent ... awaiting")
|
|
|
|
if await mc.wait_for_event(EventType.LOGIN_SUCCESS):
|
|
print("Logged in success")
|
|
await mc.commands.send_statusreq(bytes.fromhex(repeater["public_key"]))
|
|
print("Status request sent ... awaiting")
|
|
print(await mc.wait_for_event(EventType.STATUS_RESPONSE))
|
|
|
|
asyncio.run(main())
|