GithubHelp home page GithubHelp logo

joshpirihi / meshtastic-mqtt Goto Github PK

View Code? Open in Web Editor NEW
31.0 2.0 9.0 72 KB

A python script to translate Meshtastic packets into a plain format. Currently sends positions to a Traccar instance, and publishes battery % and environmental plugin data to its own topic (eg for Grafana)

Python 96.02% Makefile 3.98%
mqtt meshtastic

meshtastic-mqtt's Introduction

Note: only functions with old v1.2 meshtastic device firmware

The newer version 2 of the device firmware supports JSON MQTT packets natively, so there is no need for this script.

meshtastic-mqtt

A python script to translate Meshtastic MQTT location messages into a plain format that other systems can easily understand. Currently takes position data and submits it to a Traccar instance, also publishes user info packets, battery levels and environmental plugin temperatures and humidity readings to mqtt as raw values.

The latest build of Meshtastic-device has support for publishing decrypted payloads, which you'll need in order to use this script.

There's a few config definitions at the top of meshtastic-mqtt.py that you'll need to change for your MQTT server.

Installation

Clone the repo git clone https://github.com/joshpirihi/meshtastic-mqtt cd meshtastic-mqtt

Edit the main script and enter your broker and/or traccar host details nano meshtastic_mqtt/meshtastic_mqtt.py

Install to your systen with pip pip install .

Run meshtastic-mqtt

There are some comments in meshtastic-mqtt.py that detail the tweaks needed to make this run under AppDaemon in Home Assistant.

meshtastic-mqtt's People

Contributors

joshpirihi avatar mkinney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

meshtastic-mqtt's Issues

Dockerfile and fix for protobuf error

When you try to build and run the package at the moment you will get an error like this:

TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

In order to fix this and to let the script run in a Docker container I used this Dockerfile (inspired by Python on DockerHub):

FROM python:3
WORKDIR /usr/src/meshtastic-mqtt
COPY . ./
RUN pip install protobuf==3.20.1 && pip install .
CMD [ "meshtastic-mqtt" ]

Detailed instructions for Home Assistant

Hi,
Could you give some more precise instructions on how to use this with Home Assistant (and AppDaemon). Do all the scripts need to be in AppDaemon or only the main meshtastic-mqtt.py? What to put in apps.yaml? What exactly does "on appdaemon remove the argument here" mean ? How do you get a device/entities that you can interact with in Home Assistant ?

AppDaemon separately

Not sure what AppDaemon is, but we can make the code handle it if you can describe what it does differently than from just running from main.

Battery level value is broken?

The battery_level field in the URL for Traccar is always 0, even if the actual battery level, visible in nodes table, is 100% or another.

image

image

image

Instalation

Please provide clear instructions on how to install and use that

Support encrypted protobufs

Add a step to decrypt the payload so that users can leave encryption turned on in their mesh, and not have to bodge the device firmware to do the decryption for us

Updating the script for use with Meshtastic 2.0 protobufs?

Nice work here!

I was hoping to work with the mqtt json mode in a new project I'm working on Meshtastic <-> Matrix Relay, but the Meshtastic devs are saying the current json implementation is unstable and shouldn't be used. If we were able to get this working with the latest protobufs, we'd work to add native MQTT support.

I cloned your repo and am looking at compiling the most recent Meshtastic protobufs & updating your script, but I'm not having much luck yet.

Would it take a lot of work to make this script compatible with the current protobufs? I think a good number of people would still get use out of it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.