New plugin - Render the Pwnagotchi as HTML

I needed some internal details from the pwnagotchi as JSON for a dashboard I have that includes all my gotchis.

However, I’d noticed a call for different themes, dark mode, or people had issues with scaling artifacts when rendering the gotchi image.


It outputs a single HTML page (for scripts/display), or a JSON response (for dynamic data). If you know what you’re doing you could write a responsive HTML page that’s vertical-device friendly.

Some sample pages:
Default page:


Dark mode, but I’ve resized the page and it’s dynamically adjusted.


I added a HotDog theme :smile: The colours of the CPU/Memory/Temperature go from green to orange to red depending on their usage.




realy great plugin!

i want to add this to my plugin dir - but it would be great, if only two things needs to be linked to my plugin dir:

the “” and a “state-api/” subdir with all other files and image/ dir inside.

1 Like

Good plan - also stops your plugin directory getting cluttered. Should be an easy add.


and one other thing:

change the URIs, most people needs to type the html URI in the browser, so make the / default for html:

Call /plugins/state-api/ to retrieve the default page
Call /plugins/state-api/json to retrieve the state JSON

1 Like

(just pushed the directory change into github)

I was touch and go on that URL approach (it’s what I originally had) and I changed it. BUT - it makes more sense given the RESTful nature of the beast. Another commit incoming :smile:

1 Like

Should be good now. Updated the handling and the themes to use /json

1 Like

looks great!

i think i will use you api to show the infos on my map plugin too.

realy realy nice!

the minimal can be used on a smart-watch :slight_smile:


(Love both your plugins btw, happy to see you helping eachother)

1 Like

The architecture of pwnagotchi really encourages this kind of thing. From the webhooks to the local API, to the Grid.

I went from thinking we’d need to change the core of the application to expose a JSON interface, to realising it could all be done through a plug-in :smile:

1 Like

I really love this idea actually, i’m just having issues getting it to work for mine.
I add the and state-api folder into the plugins directory(/usr/local/src/pwnagotchi/pwnagotchi/plugins/default/), add this to my config.yml:

      enabled: true
      theme: darkmode # optional - can be default, minimal,darkmode or hotdog. Uses state-default.html by default.

and once I restart the pwnagotchi service, on my PC I go to “” but I run into “Internal Server Error - The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application”. So can someone tell me what I messed up or what I am doing wrong? Much appreciated.


So this is on me to make better error messages in future rather than crashing out :slight_smile:

I’ve only tested through a pip3 install where the and the state-api drectory are in the install directory /usr/local/lib/python3.7/dist-packages/pwnagotchi/plugins/default

If you’re adding the plugin into /usr/local/src/pwnagotchi/pwnagotchi/plugins/default/, you would normally do a pip3 install . to build everything and get it moved over into the dist-packages directory.

Alternatively, if you don’t want to do all that building you could copy and the directory over to /usr/local/lib/python3.7/dist-packages/pwnagotchi/plugins/default manually.

If you need to do any more debugging, you can also do this from the command line when your SSH’ed in.

sudo systemctl stop pwnagotchi && sudo /usr/bin/python3 /usr/local/bin/pwnagotchi --debug

…then you’ll see all the good stuff, including any exceptions that are causing it to bomb.

So I moved the and state-api folder over to “/usr/local/lib/python3.7/dist-packages/pwnagotchi/plugins/default/” as you suggested but i’m still running into the same error.
Here is my debug output:

[2019-11-12 08:42:36,675] [ERROR] Exception on /plugins/state-api/ [GET]
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/flask/”, line 2292, in wsgi_app
response = self.full_dispatch_request()
File “/usr/lib/python3/dist-packages/flask/”, line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File “/usr/lib/python3/dist-packages/flask/”, line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “/usr/lib/python3/dist-packages/flask/”, line 35, in reraise
raise value
File “/usr/lib/python3/dist-packages/flask/”, line 1813, in full_dispatch_request
rv = self.dispatch_request()
File “/usr/lib/python3/dist-packages/flask/”, line 1799, in dispatch_request
return self.view_functionsrule.endpoint
File “/usr/local/lib/python3.7/dist-packages/pwnagotchi/ui/web/”, line 51, in plugins
plugins.loaded[name].on_webhook(subpath, args=arguments, req_method=req_method))
TypeError: on_webhook() got an unexpected keyword argument ‘args’

Update, i had the same thing after some dumb modifications.

Interesting - I’ll check in case the web handling has changed from the last pwnagotchi release and what’s in /master.

I just place all my plugins into the normal default folder, /usr/local/src/pwnagotchi/pwnagotchi/plugins/default
I have yet to try this one but i will try it out in a bit and see what happens

I apologize if this sounds dumb but… how? When I google I get a few different results and not quite sure one of these fits.

Im probably doing it the wrong way because i am quite a noob but i deleted the old edited file and used wget to get the latest one from the github

Any testing appreciated, thanks :slight_smile: I’m running this based off a git pull/pip3 install . and hadn’t hit any webhook issues.

I DID notice Merge pull request #545 from dadav/fix/webhook_arguments which might be the issue here. It was 5 days ago, and the last release 1.2.1 was 7 days ago, and I’m basing my code on the latest stuff rather than the last release.

1 Like