Files
python/examples/info_example.py
2022-02-10 14:51:22 -08:00

24 lines
577 B
Python

"""Simple program to demo how to use meshtastic library.
To run: python examples/info.py
"""
import meshtastic
import meshtastic.serial_interface
iface = meshtastic.serial_interface.SerialInterface()
# call showInfo() just to ensure values are populated
#info = iface.showInfo()
if iface.myInfo:
#print(f'myInfo:{iface.myInfo}')
print(f'firmware_version:{iface.myInfo.firmware_version}')
if iface.nodes:
for n in iface.nodes.values():
if n['num'] == iface.myInfo.my_node_num:
print(n['user']['hwModel'])
break
iface.close()