meshtastic / python

The Python CLI and API for talking to Meshtastic devices
https://meshtastic.org
379 stars 160 forks source link

onSend function #592

Open michaelachrisco opened 3 months ago

michaelachrisco commented 3 months ago

In the examples here: https://meshtastic.org/docs/development/python/library/

We have a method we can subscribe to called onReceive. Is there a way to hook into something similar like onSend? Like anytime the device sends out a package, we can subscribe/see what that packet is?

I see something like this in the source code here: https://github.com/meshtastic/python/blob/master/meshtastic/__main__.py#L430

ianmcorvidae commented 3 months ago

I'm not sure if this is possible for truly every message the device sends out, since I don't think everything the device sends out automatically is copied to the client API that we're using. I do think it could be good to add a hook around anything sent by the library itself, so I'll think a little about the best way to set that up.