Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT diagrams #6

Open
PBrunot opened this issue Apr 26, 2023 · 3 comments
Open

MQTT diagrams #6

PBrunot opened this issue Apr 26, 2023 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@PBrunot
Copy link
Contributor

PBrunot commented Apr 26, 2023

I took advantage of 25th April and implemented the following logic in Arduino. To exchange structured data between backend and board over MQTT I used JSON strings (code is not in the Pull Request yet but in pbrunot/rfid-arduino mqtt branch).
I tried to keep the spirit of the original fablab-bergamo/rfid-database implementation, but I did not really understand why a token is important (MQTT server can handle authentication with user/password or certificates). Also, I think it's the board job, not the backend job, to manage the machine "free/not free" status (because we need to work in offline scenarios and the board commands the machine power).

To try to be as clear as I possible I created diagrams of the main scenario. I can also provide schemas for maintenance logic, failed authentication, ... if desired. Sequencediagram.org is quite easy to use

  • Board init
    image

  • Online access
    image

  • Offline access
    image

Please comment if I am going in the right direction.

@valerionew
Copy link
Member

Also, I think it's the board job, not the backend job, to manage the machine "free/not free" status (because we need to work in offline scenarios and the board commands the machine power).

I second this. The only reason this is concerning the server is the work hours. But this is handled by the start use/stop use.

@PBrunot
Copy link
Contributor Author

PBrunot commented Jun 23, 2023

To solve the electrical safety problem the following device is being tested : https://lamiacasaelettrica.com/shelly-plus-1/
In this case the ESP32 will publish MQTT messages to power on or off the machine (or break/close the interlock chain) ; the shelly device has a MQTT client which seems to work well.

This device makes machine integration a lot simpler thanks to @olazzari
It also creates the problem that the board may not be in sync with the device status, unlike with a relay. My approach will be to check periodically the shelly device status and emit a command from ESP32 if it's different from expected.

@valerionew
Copy link
Member

So this solution would be to add a second device other than the controller, to power on and off the machine?

@PBrunot PBrunot added the documentation Improvements or additions to documentation label Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants