Repository navigation
Proposal for a Pi4j gRPC API #511
Replies: 10 comments 44 replies
|
I like this idea, and the approach to add it as a plugin makes total sense. How does this use the underlying plugin, like the new FFM, to do the actual interaction with the hardware? |
|
Great one! Couple of questions:
|
People will use the plugin for their projects and will not think about multi-user usage - that's our job to think ahead. Imagine you have a relay for air conditioning and multiple control panels to adjust temperature in different rooms. If you are wiring this simple example directly multi-user access is managed by the provider itself (e.g. with FFM through linux kernel/driver). But once you are in a network, someone should hold the highlevel state to make things work as expected during simultaneous temperature adjusting. That's certainly worth designing beforehand :)
You can create an openapi schema and create clients with tools like https://openapi-generator.tech/ But schema should be written carefully to complain with spec standards. |
Well, that's the thesis we can have an argument in a bar with some beers one day :)
Oh, I got it now, sorry for misinterpreting your post. If this is for developers, then it makes total sense. |
|
Tangential: I use JetBrains Gateway to develop remotely on Pi with IntelliJ and I find the zero-effort setup absolutely amazing |
|
Having been nerd-sniped about gRPC, my repository now contains a gRPC implementation of the plugin alongside the previous HTTP implementation. Having now spent time working on the gRPC implementation, I'm becoming of the opinion that this could be a better way forward. gRPC solves a major problem about API specs in that you're pretty much forced into defining the schema for the API before any code gets written. To this end, the repository now has a module dedicated to API specification, which should make reviewing and refinement simpler and I would like to propose this as either an addition or complement to the PI4J project. I would very much appreciate any feedback the team might have, particularly on the schema / API specs and would be happy for this to happen either on my own repo or in a PR to Pi4J. I understand the concerns around the original HTTP / Spring Boot server implementation. I think that maybe these are addressed somewhat by the more lightweight gRPC version. Happy for any suggestions as to next steps, even if just to polish the code in its current repository. The repo is still at: https://github.com/IAmNickNack/pi4j-plugin-http |
|
I'm thinking about a PR for the gRPC plugin and server and there are some practical considerations that need to be taken into account.
This has now turned into a proposal for a gRPC solution and I'm currently questioning how likely it is that anyone is going to want to generate their own server stubs and implementation. I think this is an unlikely scenario, I would be tempted to suggest that the plugin and server both exist in the same repository. Is the main project the place for both of these components to live and if so, where in the repository would we expect to find the plugin and server components?
If so, a few pointers or discussion on the above would be useful. There's work for me to do to get things into an acceptable format and I'd rather not do a whole load of work based on assumptions, only to have to rollback and change stuff later. |
|
This discussion has been quiet for a while. In the interim I have archived the repository containing the HTTP version in favour of a repository containing only the gRPC implementation: https://github.com/IAmNickNack/pi4j-plugin-grpc. I've added minimal CI to this, published snapshot artefacts to Github Packages and released a shaded executable jar. Github Packages adds some complication to adding a dependency as GH requires users be authenticated by PAT. There's a brief summary of how I have achieved this for my own purposes here. This includes links to the relevant GH documentation for Maven and Gradle builds. The repo is now in a state where it serves my purpose. It may not be 100% feature complete and there may be issues to identify and resolve, but I'm personally happy to address these over time, as they are discovered. I would still be more than happy for Pi4J to adopt this and think the best way forward would probably be to fork my repository with a view to maybe detaching it later. |
|
This went very quite :) Progress on the v4 APIs is obviously the current priority. I thought you might like to know that I've gone ahead and published the first snapshot build to Maven Central, so this is now publicly available to some extent. I've also updated the readme to reflect my earlier proposal for a blog post. I'd still be happy for Pi4j to own the repository and for me not to have sole responsibility for its maintenance, but at least for now it's out there. I'm pretty invested in v4, so hopefully it will be available soon so I can release a non-snapshot version of the plugin. |
|
Hi @IAmNickNack Did you fully delete the HTTP version, or do you still have it somewhere? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Unless I've misunderstood something, remote development using pigpiod is no longer possible on the pi5.
I have been working on a possible replacement which uses HTTP. Obviously, performance might be thought to be an issue, but given the potential use-cases GPIO access over a network, these are arguably mute.
I would like to offer a proposal for a replacement for the pigpiod plugin which uses exposes exiting Pi4j plugins via HTTP.
The current implementation provides:
Nothing as yet has been reviewed or used by anyone other than myself. However, build and run should both be good.
Any feedback would be much appreciated. I'm hoping that this might soon be useful to somebody other than myself:
https://github.com/IAmNickNack/pi4j-plugin-http/
All reactions