Open PBrunot opened 1 year ago
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.
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.
So this solution would be to add a second device other than the controller, to power on and off the machine?
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
Online access
Offline access
Please comment if I am going in the right direction.