State returned as JSON - reading your Pwnagotchi's mind

I’ve got multiple Pwnagotchi units - some of which have displays, some don’t. I’d like a way of being able to retrieve the data from each Pwnagotchi in a consistent way so that I can consolidate everything. Different displays also means that the PNG varies from unit to unit. I’ve got WS2/Inky/WS2.7.

I’d see the statemachine rendered as JSON so we can HTTP GET the Pwnagotchi emotion, current status text, pwnd stats, pwnd SSIDs and so on.

Not asking for the Pwnagotchi being responsible for doing anything with this data other than making it accessible - but allowing us to read its mind :slight_smile:

Maybe something to consider once we integrate Flask so that it’s easier?

What about and ?

Because that’s geared for gotchi<–>gotchi or gotchi<–>grid comms I wasn’t sure whether it would be classed as internal API abuse to expose it beyond

GET /api/v1/mesh/data - contains a lot of the info needed, but missing a couple of items I’d see on the screen (status text, channel, AP Info). I’m not sure whether putting this data on the mesh API would start to distort what the mesh API is meant for, or whether it justifies a separate API call.

then maybe just a generic plugin that will expose any data you want as a REST api?

I liked that idea so much I ended up doing it as a REST api - credit to you for the extensibility of the plugin interface provided :smile:

that’s great! to be fair, @dadav is the one that implemented the webhook specifically :smiley:

1 Like

Question for you, in your README you say add the py and state-api folder in the plugins folder, but there is no folder named as such in the repo? I’m missing something but I’m not quite sure what it is…

Have a look at /usr/local/src/pwnagotchi/pwnagotchi you’ll find it :slight_smile:
But just in case, make a new directory for custom plugins and define it on your config.yml
This is the safest way IMHO :slight_smile:

1 Like