Prepair for release
This commit is contained in:
parent
897b443034
commit
5c1e5ee60d
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Build artifacts
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
build/
|
||||||
|
dist/
|
||||||
|
*.egg-info/
|
||||||
|
.eggs/
|
||||||
|
|
||||||
|
# Virtual environments
|
||||||
|
venv/
|
||||||
|
env/
|
||||||
|
|
||||||
|
# Testing
|
||||||
|
.pytest_cache/
|
||||||
|
.coverage
|
||||||
|
coverage.xml
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
16
README.md
16
README.md
@ -6,7 +6,6 @@ A lightweight Python library for parsing Meshtastic MQTT messages into JSON form
|
|||||||
|
|
||||||
This library connects to a Meshtastic MQTT broker and decodes various message types into JSON format, making it simple to process Meshtastic mesh network data in your Python applications.
|
This library connects to a Meshtastic MQTT broker and decodes various message types into JSON format, making it simple to process Meshtastic mesh network data in your Python applications.
|
||||||
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Connects to any Meshtastic MQTT broker
|
- Connects to any Meshtastic MQTT broker
|
||||||
@ -16,16 +15,25 @@ This library connects to a Meshtastic MQTT broker and decodes various message ty
|
|||||||
- Message type filtering support
|
- Message type filtering support
|
||||||
- Simple command-line interface
|
- Simple command-line interface
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
Install from PyPI:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install cryptography protobuf meshtastic paho-mqtt
|
pip install pip install meshtastic-mqtt
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## usage
|
## usage
|
||||||
```bash
|
```bash
|
||||||
python meshtastic_mqtt.py [options]
|
python meshtastic_mqtt [options]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```python
|
||||||
|
from meshtastic_mqtt import MeshtasticMQTT
|
||||||
|
client = MeshtasticMQTT()
|
||||||
|
client.connect(broker='mqtt.meshtastic.org', port=1883, root='msh/US/2/e/', channel='LongFast', username='meshdev', password='large4cats', key='AQ==')
|
||||||
|
```
|
||||||
|
|
||||||
### Command Line Options
|
### Command Line Options
|
||||||
| Option | Description | Default |
|
| Option | Description | Default |
|
||||||
|
6
pyproject.toml
Normal file
6
pyproject.toml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[tool.setuptools_scm]
|
||||||
|
write_to = "src/meshtastic_mqtt/_version.py"
|
43
setup.py
Normal file
43
setup.py
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name="meshtastic_mqtt",
|
||||||
|
version='0.1.0',
|
||||||
|
author='acidvegas',
|
||||||
|
author_email='acid.vegas@acid.vegas',
|
||||||
|
description='A lightweight Python library for parsing Meshtastic MQTT messages',
|
||||||
|
long_description=open('README.md').read(),
|
||||||
|
long_description_content_type='text/markdown',
|
||||||
|
url='https://github.com/acidvegas/meshtastic_mqtt',
|
||||||
|
project_urls={
|
||||||
|
'Bug Tracker' : 'https://github.com/acidvegas/meshtastic_mqtt/issues',
|
||||||
|
'Documentation' : 'https://github.com/acidvegas/meshtastic_mqtt#readme',
|
||||||
|
'Source Code' : 'https://github.com/acidvegas/meshtastic_mqtt',
|
||||||
|
},
|
||||||
|
packages=find_packages(where='src'),
|
||||||
|
package_dir={'': 'src'},
|
||||||
|
classifiers=[
|
||||||
|
'Development Status :: 3 - Alpha',
|
||||||
|
'Intended Audience :: Developers',
|
||||||
|
'License :: OSI Approved :: ISC License (ISCL)',
|
||||||
|
'Operating System :: OS Independent',
|
||||||
|
'Programming Language :: Python :: 3',
|
||||||
|
'Programming Language :: Python :: 3.6',
|
||||||
|
'Programming Language :: Python :: 3.7',
|
||||||
|
'Programming Language :: Python :: 3.8',
|
||||||
|
'Programming Language :: Python :: 3.9',
|
||||||
|
'Topic :: Communications',
|
||||||
|
],
|
||||||
|
python_requires='>=3.6',
|
||||||
|
install_requires=[
|
||||||
|
'cryptography',
|
||||||
|
'protobuf',
|
||||||
|
'meshtastic',
|
||||||
|
'paho-mqtt',
|
||||||
|
],
|
||||||
|
entry_points={
|
||||||
|
'console_scripts': [
|
||||||
|
'meshtastic-mqtt=meshtastic_mqtt.client:main',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
)
|
9
src/meshtastic_mqtt/__init__.py
Normal file
9
src/meshtastic_mqtt/__init__.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
"""
|
||||||
|
Meshtastic MQTT Interface - A lightweight Python library for parsing Meshtastic MQTT messages
|
||||||
|
"""
|
||||||
|
|
||||||
|
from .client import MeshtasticMQTT
|
||||||
|
|
||||||
|
__version__ = "0.1.0"
|
||||||
|
__author__ = "acidvegas"
|
||||||
|
__license__ = "ISC"
|
@ -26,6 +26,7 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
raise ImportError('missing the paho-mqtt module (pip install paho-mqtt)')
|
raise ImportError('missing the paho-mqtt module (pip install paho-mqtt)')
|
||||||
|
|
||||||
|
|
||||||
class MeshtasticMQTT(object):
|
class MeshtasticMQTT(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
'''Initialize the Meshtastic MQTT client'''
|
'''Initialize the Meshtastic MQTT client'''
|
||||||
@ -301,21 +302,26 @@ class MeshtasticMQTT(object):
|
|||||||
print(mp)
|
print(mp)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='Meshtastic MQTT Interface')
|
parser = argparse.ArgumentParser(description='Meshtastic MQTT Interface')
|
||||||
parser.add_argument('--broker', default='mqtt.meshtastic.org', help='MQTT broker address')
|
parser.add_argument('--broker', default='mqtt.meshtastic.org', help='MQTT broker address')
|
||||||
parser.add_argument('--port', default=1883, type=int, help='MQTT broker port')
|
parser.add_argument('--port', default=1883, type=int, help='MQTT broker port')
|
||||||
parser.add_argument('--root', default='msh/US/2/e/', help='Root topic')
|
parser.add_argument('--root', default='msh/US/2/e/', help='Root topic')
|
||||||
parser.add_argument('--channel', default='LongFast', help='Channel name')
|
parser.add_argument('--channel', default='LongFast', help='Channel name')
|
||||||
parser.add_argument('--username', default='meshdev', help='MQTT username')
|
parser.add_argument('--username', default='meshdev', help='MQTT username')
|
||||||
parser.add_argument('--password', default='large4cats', help='MQTT password')
|
parser.add_argument('--password', default='large4cats', help='MQTT password')
|
||||||
parser.add_argument('--key', default='AQ==', help='Encryption key')
|
parser.add_argument('--key', default='AQ==', help='Encryption key')
|
||||||
parser.add_argument('--filter', help='Filter message types (comma-separated). Example: NODEINFO,POSITION,TEXT_MESSAGE')
|
parser.add_argument('--filter', help='Filter message types (comma-separated). Example: NODEINFO,POSITION,TEXT_MESSAGE')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
client = MeshtasticMQTT()
|
client = MeshtasticMQTT()
|
||||||
if args.filter:
|
if args.filter:
|
||||||
client.filters = [f'{f.strip()}_APP' for f in args.filter.upper().split(',')]
|
client.filters = [f'{f.strip()}_APP' for f in args.filter.upper().split(',')]
|
||||||
else:
|
else:
|
||||||
client.filters = None
|
client.filters = None
|
||||||
client.connect(args.broker, args.port, args.root, args.channel, args.username, args.password, args.key)
|
client.connect(args.broker, args.port, args.root, args.channel, args.username, args.password, args.key)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
Loading…
Reference in New Issue
Block a user