meshtastic / js Goto Github PK
View Code? Open in Web Editor NEWJS/TS library for interfacing with Meshtastic devices
Home Page: https://meshtastic.org
License: GNU General Public License v3.0
JS/TS library for interfacing with Meshtastic devices
Home Page: https://meshtastic.org
License: GNU General Public License v3.0
Not sure if the dev-https
branch of meshtastic-device
has support for it yet, but I wonder if WebSockets would be a better fit than HTTP polling.
It might get around the // Important: the connect action must be called from a user interaction (e.g. button press), otherwise the browsers won't allow the connect
situation as well.
This will retire sub-events in favor of RxJS
Here's a good article showing the power of RxJS: https://blog.mimacom.com/eight-reasons-why-you-should-be-using-rxjs/
As for client side changes, it's almost nothing as you still call a subscribe
method on any event you want to listen to.
I've been able to connect to a device and read data (heartbeat, user packet, etc), but the writeLock is true and ever finishes
What am I missing?
Error: Error in meshtasticjs.IBLEConnection.connect: Error in meshtasticjs.IMeshDevice.onConnected: GATT operation not authorized.
at EventTarget.connect (meshtastic.js:formatted:3999)
I've been able to succesfully connect to a device over HTTP in a Node.js app, but discovered when that connecting over Serial is dependent on navigator
and doesn't work in Node.js. Is there any workaround, or possibility to remove this dependency?
Make it possible to connect to a meshtastic device via the Web Serial API.
It is currently in origin trial in chrome.
https://www.chromestatus.com/feature/6577673212002304
Example:
https://codelabs.developers.google.com/codelabs/web-serial/?hl=iw
Maybe: add a feature to the meshtastic device code so that "autodiscover" works; meaning when you connect the device via usb a notification from the browser pops up that tells the user what to do. (Link to a meshtastic web app under app.meshtastic.org)
Currently, you export types as a namespace and as a named export, so usage is a little convoluted:
import type { Types as MeshtasticTypes } from '@meshtastic/js';
params: MeshtasticTypes.HttpConnectionParameters
But that's not the best.
It would be great if you could simply export each type directly so we can do....
import type { HttpConnectionParameters } from '@meshtastic/js';
params: HttpConnectionParameters
Many thanks,
Drew
Other
Heltec V3
2.3.1
Trying to save MQTT config via web interface doesn't work.
Console output Chrome:
index-nsbd6Oaw.js:84 Uncaught (in promise) TypeError: o.toBinary is not a function
at zg (index-nsbd6Oaw.js:84:14940)
at Vg (index-nsbd6Oaw.js:84:14228)
at Object.writeMessage (index-nsbd6Oaw.js:84:11921)
at i.toBinary (index-nsbd6Oaw.js:83:29735)
at zg (index-nsbd6Oaw.js:84:14940)
at Vg (index-nsbd6Oaw.js:84:14228)
at Object.writeMessage (index-nsbd6Oaw.js:84:11921)
at i.toBinary (index-nsbd6Oaw.js:83:29735)
at zg (index-nsbd6Oaw.js:84:14940)
at Vg (index-nsbd6Oaw.js:84:14228)
Allow users to call method with desired packet and get the packet size back and weather it is too large etc.
https://meshtastic.org/docs/developers/protobufs/api#constants
While trying to run pnpm add @meshtastic/meshtasticjs
I get the following error βERR_PNPM_FETCH_404β GET https://registry.npmjs.org/@buf%2Fmeshtastic_protobufs.bufbuild_es: Not Found - 404
This issue seems to have been created in version 2.0.13-2? Not really sure what it's about.
currently only events tagged with INFO
, DEBUG
, WARNING
and ERROR
get output to the console, this should include all members of LogLevelEnum
Hello there
Would like to know if it's possible to modify the source code from Atak Forwarder 4.10 to make it work on Atak mil version
Currently it's running on civtak, would like to make it work on the milspec one
Sry for bad english :)
This project is super cool! Bravo. Is it okay for me to add links to it from the main webpage?
Also - if you'd like to put it in the meshtastic github project, I'm happy to add you as a committer there and you can do so. (but no pressure)
I originally discovered an occasional type mismatch in received protobufs when working on the meshtastic.js library, and found that enums are sent as there property name as against there index, i.e. "modemConfig": "Bw125Cr48Sf4096"
vs "modemConfig": 3
This has two issues, firstly messages are much larger than they need to be, secondly, some protobuf libraries aren't smart enough to automatically handle these inconsistencies.
meshtastic/protobufs@e439934
Removal of location from Data and changing Location name to Waypoint breaks the build. sendLocation is going to need to be reworked to deal with the changes to Data. Do we intend to change sendLocation to use POSITION_APP / WAYPOINT_APP instead of TEXT_MESSAGE_APP?
Hi, I have started using the meshtastic.js lib recently, but as a typescript developer I am having to generate my own type definitions.
looking at the how the library is being written, it should be easy to convert to ts, which would allow for better es6 support and targeting js versions for the output, I would be willing to make this conversion and make a pr, just seeing what people's opinions are first.
The examples I see all use react and rxjs. A simple javascript / typescript cli app that shows all the functionality as a test would be very helpful to get started using this. I would be able to help improve it if someone could help me get started.
I've been trying to pnpm add @meshtastic/meshtasticjs into an existing create-react-app but I keep getting errors
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
- install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "os": false }
This is how I created the react app:
pnpm create react-app pnpm-cra
cd pnpm-cra/
pnpm add @meshtastic/meshtasticjs
Then I added the snippet from the docs to a file Mesh.js
:
import { IHTTPConnection } from "@meshtastic/meshtasticjs";
export const Connection = () => {
const connection = new IHTTPConnection();
const connect = () => {
void connection.connect({
address: "10.0.0.10",
fetchInterval: 3000,
});
};
return <button onClick={connect}>Connect Bluetooth</button>;
};
And then I tried to use it in App.js
:
import logo from "./logo.svg";
import "./App.css";
import { Connection } from "./Mesh";
function App() {
return (
<div className="App">
<Connection />
</div>
);
}
export default App;
Using:
~/projects/pnpm-cra$ node -v
v18.12.1
Preliminary support for the portnum architecture is done, however the library still accesses and writes to some deprecated properties, this should be fixed.
I have installed meshtasticjs using npm and there were no errors.
When I tried to import in node v16.17.0 using this line:
import { IHTTPConnection } from "@meshtastic/meshtasticjs";
I get an error:
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/gtnoble/Documents/Projects/meshtastic-test/node_modules/@meshtastic/meshtasticjs/dist/generated/module_config' imported from /home/gtnoble/Documents/Projects/meshtastic-test/node_modules/@meshtastic/meshtasticjs/dist/generated/mesh.js at new NodeError (node:internal/errors:387:5) at finalizeResolution (node:internal/modules/esm/resolve:429:11) at moduleResolve (node:internal/modules/esm/resolve:1006:10) at defaultResolve (node:internal/modules/esm/resolve:1214:11) at nextResolve (node:internal/modules/esm/loader:165:28) at ESMLoader.resolve (node:internal/modules/esm/loader:844:30) at ESMLoader.getModuleJob (node:internal/modules/esm/loader:431:18) at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40) at link (node:internal/modules/esm/module_job:75:36) { code: 'ERR_MODULE_NOT_FOUND' }
This could be a mistake on my part, but I thought I would reach out in case it was a deeper problem.
Provide native functions that make calls to all of the Meshtastic HTTP endpoints.
All methods currently listed here: https://github.com/meshtastic/Meshtastic-device/wiki/How-to-use-%22Meshtastic-Web%22-over-WiFi#restart
Should we change the INodeSerialConnection baud rate to 921600? This is what the python CLI app uses for serial connections. I can't connect to the device without changing the baud rate for INodeSerialConnection to 921600. Another possibility is to add a parameter in the constructor to allow the use of different baud rates.
Right now, the TTGO-TBeams go into bluetooth sleep after a while.
If the library then tries to read/write from device, it is no longer available, so it fires the "disconnected" event and tries to reconnect three times (with an exponentially increasing wait time between tries).
This could lead to confusion, because the behaviour when using http is different, as there is no real connection state.
Proposed behaviour:
Make behaviour consistent so that it is clear when a device is finally disconnected and connect needs to be called again.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.