mirror of
https://github.com/meshtastic/python.git
synced 2025-12-24 00:17:54 -05:00
22 lines
525 B
Python
22 lines
525 B
Python
"""Simple program to demo how to use meshtastic library.
|
|
To run: python examples/get_hw.py
|
|
"""
|
|
|
|
import sys
|
|
|
|
import meshtastic
|
|
import meshtastic.serial_interface
|
|
|
|
# simple arg check
|
|
if len(sys.argv) != 1:
|
|
print(f"usage: {sys.argv[0]}")
|
|
print("Print the hardware model for the local node.")
|
|
sys.exit(3)
|
|
|
|
iface = meshtastic.serial_interface.SerialInterface()
|
|
if iface.nodes:
|
|
for n in iface.nodes.values():
|
|
if n["num"] == iface.myInfo.my_node_num:
|
|
print(n["user"]["hwModel"])
|
|
iface.close()
|