meshcore_py/examples/ble_t1000_msg.py

22 lines
449 B
Python
Raw Normal View History

2025-03-29 12:32:10 +01:00
#!/usr/bin/python
import asyncio
import json
from meshcore import MeshCore
2025-03-30 08:42:52 +02:00
from meshcore import BLEConnection
2025-03-29 12:32:10 +01:00
2025-03-30 08:42:52 +02:00
ADDRESS = "t1000" # node ble adress or name
DEST = "mchome"
2025-03-29 12:32:10 +01:00
MSG = "Hello World"
async def main () :
2025-03-30 08:42:52 +02:00
con = BLEConnection(ADDRESS)
2025-03-29 12:32:10 +01:00
await con.connect()
mc = MeshCore(con)
await mc.connect()
await mc.ensure_contacts()
await mc.send_msg(bytes.fromhex(mc.contacts[DEST]["public_key"])[0:6],MSG)
asyncio.run(main())