WIP
This commit is contained in:
@ -510,6 +510,12 @@ void zh_mqtt_event_handler(void *arg, esp_event_base_t event_base, int32_t event
|
|||||||
}
|
}
|
||||||
else if (strncmp(incoming_payload, "restart", strlen(incoming_payload) + 1) == 0)
|
else if (strncmp(incoming_payload, "restart", strlen(incoming_payload) + 1) == 0)
|
||||||
{
|
{
|
||||||
|
zh_espnow_data_t data = {0};
|
||||||
|
data.device_type = ZHDT_GATEWAY;
|
||||||
|
data.payload_type = ZHPT_KEEP_ALIVE;
|
||||||
|
data.payload_data.keep_alive_message.online_status = ZH_OFFLINE;
|
||||||
|
zh_send_message(NULL, (uint8_t *)&data, sizeof(zh_espnow_data_t));
|
||||||
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
esp_restart();
|
esp_restart();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -882,6 +888,11 @@ void zh_self_ota_update_task(void *pvParameter)
|
|||||||
esp_http_client_cleanup(https_client);
|
esp_http_client_cleanup(https_client);
|
||||||
esp_mqtt_client_publish(gateway_config->mqtt_client, topic, "update_success", 0, 2, true);
|
esp_mqtt_client_publish(gateway_config->mqtt_client, topic, "update_success", 0, 2, true);
|
||||||
heap_caps_free(topic);
|
heap_caps_free(topic);
|
||||||
|
zh_espnow_data_t data = {0};
|
||||||
|
data.device_type = ZHDT_GATEWAY;
|
||||||
|
data.payload_type = ZHPT_KEEP_ALIVE;
|
||||||
|
data.payload_data.keep_alive_message.online_status = ZH_OFFLINE;
|
||||||
|
zh_send_message(NULL, (uint8_t *)&data, sizeof(zh_espnow_data_t));
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
esp_restart();
|
esp_restart();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user