Compare commits

..

4 Commits

Author SHA1 Message Date
github-actions
0c38a9eb0b bump version to 2.6.0 2025-03-10 23:18:47 +00:00
Ian McEwen
e591cc184f set 2.6 version num 2025-03-10 16:17:40 -07:00
rcarteraz
ed908fc4b6 Merge pull request #748 from rcarteraz/master
update README
2025-03-03 11:44:08 -07:00
rcarteraz
3710e6e909 update README 2025-03-03 11:42:15 -07:00
5 changed files with 18 additions and 92 deletions

BIN
.github/meshtastic_logo.png vendored Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

View File

@@ -1,4 +1,10 @@
# Meshtastic Python
<div align="center" markdown="1">
<img src=".github/meshtastic_logo.png" alt="Meshtastic Logo" width="80"/>
<h1 align="center"> Meshtastic Python
</h1>
<p style="font-size:15px;" align="center">A Python library and client for use with Meshtastic devices. </p>
[![codecov](https://codecov.io/gh/meshtastic/python/branch/master/graph/badge.svg?token=TIWPJL73KV)](https://codecov.io/gh/meshtastic/python)
![PyPI - Downloads](https://img.shields.io/pypi/dm/meshtastic)
@@ -7,17 +13,20 @@
[![Fiscal Contributors](https://opencollective.com/meshtastic/tiers/badge.svg?label=Fiscal%20Contributors&color=deeppink)](https://opencollective.com/meshtastic/)
![GPL-3.0](https://img.shields.io/badge/License-GPL%20v3-blue.svg)
</div>
<div align="center">
<a href="https://meshtastic.org/docs/software/python/cli/installation">Getting Started Guide</a>
-
<a href="https://python.meshtastic.org">API Documentation</a>
</div>
## Overview
A Python client for use with Meshtastic devices.
This small library (and example application) provides an easy API for sending and receiving messages over mesh radios.
It also provides access to any of the operations/data available in the device user interface or the Android application.
Events are delivered using a publish-subscribe model, and you can subscribe to only the message types you are interested in.
**[Getting Started Guide](https://meshtastic.org/docs/software/python/cli/installation)**
**[API Documentation](https://python.meshtastic.org)**
## Call for Contributors
This library and CLI has gone without a consistent maintainer for a while, and there's many improvements that could be made. We're all volunteers here and help is extremely appreciated, whether in implementing your own needs or helping maintain the library and CLI in general.

View File

@@ -59,7 +59,7 @@ except ImportError as e:
have_powermon = False
powermon_exception = e
meter = None
from meshtastic.protobuf import admin_pb2, channel_pb2, config_pb2, portnums_pb2
from meshtastic.protobuf import channel_pb2, config_pb2, portnums_pb2
from meshtastic.version import get_active_version
def onReceive(packet, interface) -> None:
@@ -462,22 +462,6 @@ def onConnected(interface):
waitForAckNak = True
interface.getNode(args.dest, False, **getNode_kwargs).removeFavorite(args.remove_favorite_node)
if args.backup_prefs:
closeNow = True
waitForAckNak = True
print(f"Backing up preferences to {args.backup_prefs}")
interface.getNode(args.dest, False, **getNode_kwargs).backupPreferences(args.backup_prefs)
if args.restore_prefs:
closeNow = True
waitForAckNak = True
interface.getNode(args.dest, False, **getNode_kwargs).restorePreferences(args.restore_prefs)
if args.remove_backup_prefs:
closeNow = True
waitForAckNak = True
interface.getNode(args.dest, False, **getNode_kwargs).removePreferencesBackups(args.remove_backup_prefs)
if args.set_ignored_node:
closeNow = True
waitForAckNak = True
@@ -1810,40 +1794,12 @@ def addRemoteAdminArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPars
action="store_true",
)
group.add_argument(
"--backup-prefs",
help="Tell the destination node to create a backup preferences file."
"Location: 0 for local flash, 1 for SD card.",
default=admin_pb2.AdminMessage.BackupLocation.FLASH,
nargs="?",
const=0,
)
group.add_argument(
"--restore-prefs",
help="Tell the destination node to remove backup preferences files."
"Location: 0 for local flash, 1 for SD card.",
default=admin_pb2.AdminMessage.BackupLocation.FLASH,
nargs="?",
const=0,
)
group.add_argument(
"--remove-backup-prefs",
help="Tell the destination node to remove backup preferences files."
"Location: 0 for local flash, 1 for SD card.",
default=admin_pb2.AdminMessage.BackupLocation.FLASH,
nargs="?",
const=0,
)
group.add_argument(
"--remove-node",
help="Tell the destination node to remove a specific node from its NodeDB. "
"Use the node ID with a '!' or '0x' prefix or the node number.",
metavar="!xxxxxxxx"
)
group.add_argument(
"--set-favorite-node",
help="Tell the destination node to set the specified node to be favorited on the NodeDB. "

View File

@@ -707,47 +707,8 @@ class Node:
onResponse = self.onAckNak
return self._sendAdmin(p, onResponse=onResponse)
def backupPreferences(self, location: Optional[admin_pb2.AdminMessage.BackupLocation.ValueType] = 0):
"""Tell the node to backup preferences to flash."""
self.ensureSessionKey()
p = admin_pb2.AdminMessage()
p.backup_preferences = location
if self == self.iface.localNode:
onResponse = None
else:
onResponse = self.onAckNak
return self._sendAdmin(p, onResponse=onResponse)
def restorePreferences(self, location: Optional[admin_pb2.AdminMessage.BackupLocation.ValueType] = 0):
"""Tell the node to restore preferences from backup."""
self.ensureSessionKey()
p = admin_pb2.AdminMessage()
p.restore_preferences = location
if self == self.iface.localNode:
onResponse = None
else:
onResponse = self.onAckNak
return self._sendAdmin(p, onResponse=onResponse)
def removePreferencesBackups(self, location: Optional[admin_pb2.AdminMessage.BackupLocation.ValueType] = 0):
"""Tell the node to remove backup preferences from the filesystem."""
self.ensureSessionKey()
p = admin_pb2.AdminMessage()
p.remove_backup_preferences = location
if self == self.iface.localNode:
onResponse = None
else:
onResponse = self.onAckNak
return self._sendAdmin(p, onResponse=onResponse)
def removeFavorite(self, nodeId: Union[int, str]):
"""Tell the node to set the specified node ID to be un-favorited on the NodeDB on the device."""
"""Tell the node to set the specified node ID to be un-favorited on the NodeDB on the device"""
self.ensureSessionKey()
if isinstance(nodeId, str):
if nodeId.startswith("!"):

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "meshtastic"
version = "2.6.0a1"
version = "2.6.0"
description = "Python API & client shell for talking to Meshtastic devices"
authors = ["Meshtastic Developers <contact@meshtastic.org>"]
license = "GPL-3.0-only"