mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-25 20:26:41 +00:00
Add ota
This commit is contained in:
parent
737aef167b
commit
594c31f1db
@ -6,7 +6,7 @@
|
|||||||
#include "hasp_debug.h"
|
#include "hasp_debug.h"
|
||||||
#include "hasp_dispatch.h"
|
#include "hasp_dispatch.h"
|
||||||
#include "hasp_ota.h"
|
#include "hasp_ota.h"
|
||||||
#include "hasp.h"
|
#include "hasp_mqtt.h"
|
||||||
|
|
||||||
#define F_OTA_URL F("otaurl")
|
#define F_OTA_URL F("otaurl")
|
||||||
|
|
||||||
@ -22,16 +22,16 @@ void otaSetup(JsonObject settings)
|
|||||||
debugPrintln(buffer);
|
debugPrintln(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArduinoOTA.setHostname(String(haspGetNodename()).c_str());
|
ArduinoOTA.setHostname(String(mqttGetNodename()).c_str());
|
||||||
// ArduinoOTA.setPassword(configPassword);
|
// ArduinoOTA.setPassword(configPassword);
|
||||||
|
|
||||||
ArduinoOTA.onStart([]() {
|
ArduinoOTA.onStart([]() {
|
||||||
debugPrintln(F("OTA: update start"));
|
debugPrintln(F("OTA: update start"));
|
||||||
haspSendCmd("page 0");
|
dispatchCommand("page 0");
|
||||||
// haspSetAttr("p[0].b[1].txt", "\"ESP OTA Update\"");
|
// haspSetAttr("p[0].b[1].txt", "\"ESP OTA Update\"");
|
||||||
});
|
});
|
||||||
ArduinoOTA.onEnd([]() {
|
ArduinoOTA.onEnd([]() {
|
||||||
haspSendCmd("page 0");
|
dispatchCommand("page 0");
|
||||||
debugPrintln(F("OTA: update complete"));
|
debugPrintln(F("OTA: update complete"));
|
||||||
// haspSetAttr("p[0].b[1].txt", "\"ESP OTA Update\\rComplete!\"");
|
// haspSetAttr("p[0].b[1].txt", "\"ESP OTA Update\\rComplete!\"");
|
||||||
dispatchCommand(F("reboot"));
|
dispatchCommand(F("reboot"));
|
||||||
@ -59,7 +59,7 @@ void otaSetup(JsonObject settings)
|
|||||||
debugPrintln(F("OTA: Over the Air firmware update ready"));
|
debugPrintln(F("OTA: Over the Air firmware update ready"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void otaLoop()
|
void otaLoop(bool wifiIsConnected)
|
||||||
{
|
{
|
||||||
ArduinoOTA.handle(); // Arduino OTA loop
|
ArduinoOTA.handle(); // Arduino OTA loop
|
||||||
}
|
}
|
@ -4,6 +4,6 @@
|
|||||||
#include "ArduinoJson.h"
|
#include "ArduinoJson.h"
|
||||||
|
|
||||||
void otaSetup(JsonObject settings);
|
void otaSetup(JsonObject settings);
|
||||||
void otaLoop(void);
|
void otaLoop(bool wifiIsConnected);
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
x
Reference in New Issue
Block a user