Open hydrotekfarm opened 3 years ago
In GitLab by @embeddedcoders on Sep 1, 2021, 08:35
Hi, I am rewriting my understanding here.
ESP32: Setup MQTT and subscribe ":device_id/fertigation_ota_push" topic to get notification from mobile App.
ESP32: Check the existing firmware version from NVS and compare it with a published massage.
ESP32: REST API GET response to server and endpoint will be "fertigation-ota/:{version}".
ESP32: After completion of OTA, it will send a success or fail response on the ":device_id/fertigation_ota_result" topic.
MicroService: Send notification to ESP32 on ":device_id/fertigation_ota_push" topic to start OTA process with the given version.
MicroService: Download firmware from GCloud if require and store it in a local HTTP server.
MicroService: REST API response sends to ESP32 with the endpoint link.
MicroService: It subscribes to the ":device_id/fertigation_ota_result" topic to receive an OTA response from ESP32.
In GitLab by @AjayKrishna123 on Aug 25, 2021, 10:03
Push Notification is sent to all Ionic Apps regarding update
User will accept update for all their compatible systems
After user accepts, Retained message with following structure will be sent: topic: ":device_id/fertigation_ota_push" device_id is unique 5 digit ID assigned to each system. JSON Message as String: { version: "v1.0" }
Fertigation System will have subscribed to that topic and when it receives this message, it will check in NVS if version already exists.
If it is a different version, it will send a http request to microservice running on cloud with the version to download as a parameter
Example REST Endpoint: "fertigation-ota/:version" As mentioned in the URL, the "fertigation-ota" will always stay constant, whereas the version parameter will change depending on the version the esp32 wants to download.
Microservice will connect to google storage bucket and download the appropriate version number locally Here is an example url for the storage bucket: fertigation-ota/:version. This URL is similar to the REST Endpoint mentioned earlier.
If Microservice, does not find version number in storage bucket, it will return Not Found error, and esp32 will cancel the update process. - If not found error, or any other installation error occurs, esp32 will go back to original firmware version and send the following message: Topic: ":device_id/fertigation_ota_result" JSON Message as String: { version: "v1.0" result: "failure", error: "VERSION_NOT_FOUND" }
If esp32 receives the correct firmware version, it will download the new firmware. Upon booting, it will send the following message: Topic: ":device_id/fertigation_ota_result" JSON Message as String: { version: "v1.0" result: "success", error: null }