feat: implement OTA updates over HTTP(S), initiated over MQTT

This commit is contained in:
2026-05-17 00:24:43 +02:00
parent 8992e311ba
commit b9195a0dda
10 changed files with 221 additions and 8 deletions
@@ -13,6 +13,7 @@
#define MQTT_DESELECTED_BIT BIT4
#define MQTT_FACTORY_RESET_BIT BIT5
#define MQTT_RECONFIGURE_SETTINGS_BIT BIT6
#define MQTT_OTA_BIT BIT7
/* Populated by handle_cmd() before MQTT_RECONFIGURE_SETTINGS_BIT is set.
* All fields are optional — empty string means "not provided, leave unchanged". */
@@ -27,6 +28,18 @@ typedef struct {
* MQTT_RECONFIGURE_SETTINGS_BIT fires; must be read before the next MQTT event. */
const mqtt_reconfigure_data_t *mqtt_publisher_get_reconfigure_data(void);
typedef struct {
char url[256];
char version[32];
} mqtt_ota_data_t;
/** Returns a pointer to the last parsed OTA payload. Valid only after
* MQTT_OTA_BIT fires; must be read before the next MQTT event. */
const mqtt_ota_data_t *mqtt_publisher_get_ota_data(void);
/** Publish OTA status to localiser/sensor/{id}/ota. Non-blocking (QoS 1). */
void mqtt_publisher_send_ota_status(const char *status, const char *version);
/**
* Initialise and connect the MQTT client.
*