Meshtasticjs Example

I feel dumb for asking this but does anyone have a simple example of using the meshtasticjs library? The only thing I can find is crossan007’s implementation which has a bunch of other stuff wrapped around it that I’m unfamiliar with.

My goal is to have a server app that connects to one or more nodes via https(s) and returns info/nodes/messages but it seems like the only method for that that’s been implemented is the js library and I’m just not familiar enough with node to get this working in a very simple implementation.

I have tried just a simple node server app but importing this library has been unsuccessful for me. Any help would be wonderful, thanks!

2 Likes

Take a look in /static of the device code. There’s A basic client with one button. You push the button, it connects to the device and send a message

Also take a look at Protoman

You can use that to directly interface with device and play around with the API without having to write any code. If you want to do that, PM me and I’ll send you my Protoman config file which should get you started.

1 Like

Thanks I will take a look at both of those items. Appreciate it!

So my goal here is a headless interface. That code in /static looks like it’s mean to be run in a browser with user button interaction.

i’d like to be able to do something like run
./node collector.js
and it would do the connection, data gathering, and saving of data.

maybe I’m barking up the wrong tree here, but i don’t always want to run this code on the same device connected to the meshtastic and if the python api doesn’t support https, not sure what else to do. I was really hoping to leverage the work done in the module.

2 Likes

Well, I totally overlooked the fact that the python api does have http connection to the API. I was so wrapped around using js that I neglected to dig deeper into the python side. This will work great for me. Thanks for the eyeballs!

2 Likes

just to clarify, the python api does talk over serial, USB, TCP, or BLE (pre-alpha - not yet supported) to the device. But it is not using HTTP, it is using a special port # where we provide our raw FromRadio/ToRadio ‘official’ protocol api.

So yeah - using the python API sounds perfect for you.

2 Likes

Ah ok good to know, but completely fine for my use case. I don’t care about the implementation :slight_smile:

FWIW, my day job is a sales engineer for Splunk. So I’m looking at writing an app (think, plug-in) that can be configured with 1 or more IP addresses of meshtastic endpoints for collecting event and unit data.

I would also build up some reports/visualizations to go with the data collection for easier consumption be end users. I’ve been trying to find my fit in the community, and I’m hoping this fits.

Thanks for the guidance as always.

2 Likes

could you fwd me that as well?

The config will need to be rebuilt for the 1.2.x device branch. Too much has changed.

Sorry.

It shouldn’t take too long for you to create if you’d like. The protoman docs are very complete.

1 Like