Custom plugin/add-on to pursalink?
I have added an OLED and AHT20 (temperature and humidity sensor) to my raspberry pi 2W running PRUSALINK with a rc.local python script that executes periodically and stores off the time and parameters. (I am using this information as part of understanding the temperature stability of my enclosure.) I would really like to add a plugin/graph to the main page of PRUSALINK that shows this information. Is there a guide or a reference where I can find your webpage source code? I know you are using openapi (per Prusa-Link-Web/master/spec/openapi.yaml) to generate the webpages, but when I look on my raspberry pi I cannot find the relevant files on the raspberry pi itself. (also I am happy to provide schematics and software for others to use and integrate the same type of information.)
RE: Custom plugin/add-on to pursalink?
Hi, the Prusa-Link-Web repo contains most of the web code. The exceptions are prusalink specific things like tge wizard. The open API spec is there as a reference on how to communicate with PrusaLink itself. The api is just for data exchange.
Building it is not very straightforward. Let me know once you need to do that
RE: Custom plugin/add-on to pursalink?
okay - thanks! When I am on the raspberry pi image itself, I cannot find the location of the html/css files themself. Could you point me in the correct direction?
RE:
They are in a "static" folder in PrusaLink. However. They are minified, so reading them is unreasonably hard. If you want to modify the page, you'll need to modify the source code, then build the static files again using setup.py build_static in Prusa-Link. The setup script expects the submodule Prusa-Link-Web populated with files. You will also need to comment out a line in setup. py, that contains words:extract, you might need to copy the config file named config.custom.json into Prusa-Link-Web
The build process uses docker, but it hopefully should not be too bad to install. I forgot the install steps to that, but you have to have its daemon running when building.
Finally, to turn off minification, modify the last line of this command
args = ('docker', 'run', '-t', '--rm', '-u', f"{os.getuid()}:{getgrnam('docker').gr_gid}", '-w', cwd, '-v', f"{cwd}:{cwd}", '-e', f'GIT_COMMIT_HASH={git_commit_hash}', 'node:latest', 'sh', '-c', 'npm run build:custom')
To look like this
'npm run build:custom -- --dev')
At least I think so, done this a while ago
Sorry about the crudeness of the info, hope it helps
RE: Custom plugin/add-on to pursalink?
Thank you! I saw the static and thought that might be where the files lived, thank you for the details on generating the files again - I was missing that information.
I will try it out and let you know how it goes! Also, let me know if there is anything I can contribute back to the community!
RE: Custom plugin/add-on to pursalink?
I have never done Opensource and we did not build in plugin support. If you get stuck, feel free to let me know. I did the build thing once. I do the python code on the other side of that API, but I can ask around for you if need be.