|
|
@ -15,13 +15,6 @@
|
|
|
|
#include "ESP32SSDP.h"
|
|
|
|
#include "ESP32SSDP.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum : uint8_t
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ESP_NOW,
|
|
|
|
|
|
|
|
ESP_NOW_WIFI,
|
|
|
|
|
|
|
|
ESP_NOW_LAN
|
|
|
|
|
|
|
|
} work_mode_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void onEspnowMessage(const char *data, const uint8_t *sender);
|
|
|
|
void onEspnowMessage(const char *data, const uint8_t *sender);
|
|
|
|
|
|
|
|
|
|
|
|
void onMqttMessage(char *topic, byte *payload, unsigned int length);
|
|
|
|
void onMqttMessage(char *topic, byte *payload, unsigned int length);
|
|
|
@ -42,7 +35,14 @@ void checkMqttAvailability(void);
|
|
|
|
|
|
|
|
|
|
|
|
void mqttPublish(const char *topic, const char *payload, bool retained);
|
|
|
|
void mqttPublish(const char *topic, const char *payload, bool retained);
|
|
|
|
|
|
|
|
|
|
|
|
const String firmware{"1.42"};
|
|
|
|
typedef enum : uint8_t
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ESP_NOW,
|
|
|
|
|
|
|
|
ESP_NOW_WIFI,
|
|
|
|
|
|
|
|
ESP_NOW_LAN
|
|
|
|
|
|
|
|
} work_mode_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const String firmware{"1.5"};
|
|
|
|
|
|
|
|
|
|
|
|
String espnowNetName{"DEFAULT"};
|
|
|
|
String espnowNetName{"DEFAULT"};
|
|
|
|
|
|
|
|
|
|
|
@ -193,12 +193,12 @@ void setup()
|
|
|
|
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (mqttAvailabilityCheckTimerSemaphore)
|
|
|
|
|
|
|
|
checkMqttAvailability();
|
|
|
|
if (keepAliveMessageTimerSemaphore)
|
|
|
|
if (keepAliveMessageTimerSemaphore)
|
|
|
|
sendKeepAliveMessage();
|
|
|
|
sendKeepAliveMessage();
|
|
|
|
if (attributesMessageTimerSemaphore)
|
|
|
|
if (attributesMessageTimerSemaphore)
|
|
|
|
sendAttributesMessage();
|
|
|
|
sendAttributesMessage();
|
|
|
|
if (mqttAvailabilityCheckTimerSemaphore)
|
|
|
|
|
|
|
|
checkMqttAvailability();
|
|
|
|
|
|
|
|
if (workMode == ESP_NOW_WIFI)
|
|
|
|
if (workMode == ESP_NOW_WIFI)
|
|
|
|
mqttWifiClient.loop();
|
|
|
|
mqttWifiClient.loop();
|
|
|
|
if (workMode == ESP_NOW_LAN)
|
|
|
|
if (workMode == ESP_NOW_LAN)
|
|
|
@ -227,24 +227,26 @@ void onEspnowMessage(const char *data, const uint8_t *sender)
|
|
|
|
memcpy(&configData.message, &incomingData.message, sizeof(esp_now_payload_data_t::message));
|
|
|
|
memcpy(&configData.message, &incomingData.message, sizeof(esp_now_payload_data_t::message));
|
|
|
|
StaticJsonDocument<sizeof(esp_now_payload_data_t::message)> json;
|
|
|
|
StaticJsonDocument<sizeof(esp_now_payload_data_t::message)> json;
|
|
|
|
deserializeJson(json, configData.message);
|
|
|
|
deserializeJson(json, configData.message);
|
|
|
|
uint8_t unit = json["unit"].as<uint8_t>();
|
|
|
|
uint8_t unit = json[MCMT_DEVICE_UNIT].as<uint8_t>();
|
|
|
|
StaticJsonDocument<2048> jsonConfig;
|
|
|
|
StaticJsonDocument<2048> jsonConfig;
|
|
|
|
jsonConfig["platform"] = "mqtt";
|
|
|
|
jsonConfig["platform"] = "mqtt";
|
|
|
|
jsonConfig["name"] = json["name"];
|
|
|
|
jsonConfig["name"] = json[MCMT_DEVICE_NAME];
|
|
|
|
jsonConfig["unique_id"] = myNet.macToString(sender) + "-" + unit;
|
|
|
|
jsonConfig["unique_id"] = myNet.macToString(sender) + "-" + unit;
|
|
|
|
jsonConfig["device_class"] = getValueName(json["class"].as<ha_switch_device_class_t>());
|
|
|
|
jsonConfig["device_class"] = getValueName(json[MCMT_DEVICE_CLASS].as<ha_switch_device_class_t>());
|
|
|
|
jsonConfig["state_topic"] = topicPrefix + "/" + getValueName(incomingData.deviceType) + "/" + myNet.macToString(sender) + "/state";
|
|
|
|
jsonConfig["state_topic"] = topicPrefix + "/" + getValueName(incomingData.deviceType) + "/" + myNet.macToString(sender) + "/state";
|
|
|
|
jsonConfig["value_template"] = "{{ value_json." + json["template"].as<String>() + " }}";
|
|
|
|
jsonConfig["value_template"] = "{{ value_json." + json[MCMT_VALUE_TEMPLATE].as<String>() + " }}";
|
|
|
|
jsonConfig["command_topic"] = topicPrefix + "/" + getValueName(incomingData.deviceType) + "/" + myNet.macToString(sender) + "/set";
|
|
|
|
jsonConfig["command_topic"] = topicPrefix + "/" + getValueName(incomingData.deviceType) + "/" + myNet.macToString(sender) + "/set";
|
|
|
|
jsonConfig["json_attributes_topic"] = topicPrefix + "/" + getValueName(incomingData.deviceType) + "/" + myNet.macToString(sender) + "/attributes";
|
|
|
|
jsonConfig["json_attributes_topic"] = topicPrefix + "/" + getValueName(incomingData.deviceType) + "/" + myNet.macToString(sender) + "/attributes";
|
|
|
|
jsonConfig["availability_topic"] = topicPrefix + "/" + getValueName(incomingData.deviceType) + "/" + myNet.macToString(sender) + "/status";
|
|
|
|
jsonConfig["availability_topic"] = topicPrefix + "/" + getValueName(incomingData.deviceType) + "/" + myNet.macToString(sender) + "/status";
|
|
|
|
jsonConfig["payload_on"] = json["payload_on"];
|
|
|
|
if (json[MCMT_PAYLOAD_ON])
|
|
|
|
jsonConfig["payload_off"] = json["payload_off"];
|
|
|
|
jsonConfig["payload_on"] = json[MCMT_PAYLOAD_ON];
|
|
|
|
|
|
|
|
if (json[MCMT_PAYLOAD_OFF])
|
|
|
|
|
|
|
|
jsonConfig["payload_off"] = json[MCMT_PAYLOAD_OFF];
|
|
|
|
jsonConfig["optimistic"] = "false";
|
|
|
|
jsonConfig["optimistic"] = "false";
|
|
|
|
jsonConfig["retain"] = "true";
|
|
|
|
jsonConfig["retain"] = "true";
|
|
|
|
char buffer[2048]{0};
|
|
|
|
char buffer[2048]{0};
|
|
|
|
serializeJsonPretty(jsonConfig, buffer);
|
|
|
|
serializeJsonPretty(jsonConfig, buffer);
|
|
|
|
mqttPublish((topicPrefix + "/" + getValueName(json["type"].as<ha_component_type_t>()) + "/" + myNet.macToString(sender) + "-" + unit + "/config").c_str(), buffer, true);
|
|
|
|
mqttPublish((topicPrefix + "/" + getValueName(json[MCMT_COMPONENT_TYPE].as<ha_component_type_t>()) + "/" + myNet.macToString(sender) + "-" + unit + "/config").c_str(), buffer, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (incomingData.deviceType == ENDT_LED)
|
|
|
|
if (incomingData.deviceType == ENDT_LED)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -252,11 +254,11 @@ void onEspnowMessage(const char *data, const uint8_t *sender)
|
|
|
|
memcpy(&configData.message, &incomingData.message, sizeof(esp_now_payload_data_t::message));
|
|
|
|
memcpy(&configData.message, &incomingData.message, sizeof(esp_now_payload_data_t::message));
|
|
|
|
StaticJsonDocument<sizeof(esp_now_payload_data_t::message)> json;
|
|
|
|
StaticJsonDocument<sizeof(esp_now_payload_data_t::message)> json;
|
|
|
|
deserializeJson(json, configData.message);
|
|
|
|
deserializeJson(json, configData.message);
|
|
|
|
uint8_t unit = json["unit"].as<uint8_t>();
|
|
|
|
uint8_t unit = json[MCMT_DEVICE_UNIT].as<uint8_t>();
|
|
|
|
esp_now_led_type_t ledClass = json["class"];
|
|
|
|
esp_now_led_type_t ledClass = json[MCMT_DEVICE_CLASS];
|
|
|
|
StaticJsonDocument<2048> jsonConfig;
|
|
|
|
StaticJsonDocument<2048> jsonConfig;
|
|
|
|
jsonConfig["platform"] = "mqtt";
|
|
|
|
jsonConfig["platform"] = "mqtt";
|
|
|
|
jsonConfig["name"] = json["name"];
|
|
|
|
jsonConfig["name"] = json[MCMT_DEVICE_NAME];
|
|
|
|
jsonConfig["unique_id"] = myNet.macToString(sender) + "-" + unit;
|
|
|
|
jsonConfig["unique_id"] = myNet.macToString(sender) + "-" + unit;
|
|
|
|
jsonConfig["state_topic"] = topicPrefix + "/" + getValueName(incomingData.deviceType) + "/" + myNet.macToString(sender) + "/state";
|
|
|
|
jsonConfig["state_topic"] = topicPrefix + "/" + getValueName(incomingData.deviceType) + "/" + myNet.macToString(sender) + "/state";
|
|
|
|
jsonConfig["state_value_template"] = "{{ value_json.state }}";
|
|
|
|
jsonConfig["state_value_template"] = "{{ value_json.state }}";
|
|
|
@ -278,13 +280,15 @@ void onEspnowMessage(const char *data, const uint8_t *sender)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
jsonConfig["json_attributes_topic"] = topicPrefix + "/" + getValueName(incomingData.deviceType) + "/" + myNet.macToString(sender) + "/attributes";
|
|
|
|
jsonConfig["json_attributes_topic"] = topicPrefix + "/" + getValueName(incomingData.deviceType) + "/" + myNet.macToString(sender) + "/attributes";
|
|
|
|
jsonConfig["availability_topic"] = topicPrefix + "/" + getValueName(incomingData.deviceType) + "/" + myNet.macToString(sender) + "/status";
|
|
|
|
jsonConfig["availability_topic"] = topicPrefix + "/" + getValueName(incomingData.deviceType) + "/" + myNet.macToString(sender) + "/status";
|
|
|
|
jsonConfig["payload_on"] = json["payload_on"];
|
|
|
|
if (json[MCMT_PAYLOAD_ON])
|
|
|
|
jsonConfig["payload_off"] = json["payload_off"];
|
|
|
|
jsonConfig["payload_on"] = json[MCMT_PAYLOAD_ON];
|
|
|
|
|
|
|
|
if (json[MCMT_PAYLOAD_OFF])
|
|
|
|
|
|
|
|
jsonConfig["payload_off"] = json[MCMT_PAYLOAD_OFF];
|
|
|
|
jsonConfig["optimistic"] = "false";
|
|
|
|
jsonConfig["optimistic"] = "false";
|
|
|
|
jsonConfig["retain"] = "true";
|
|
|
|
jsonConfig["retain"] = "true";
|
|
|
|
char buffer[2048]{0};
|
|
|
|
char buffer[2048]{0};
|
|
|
|
serializeJsonPretty(jsonConfig, buffer);
|
|
|
|
serializeJsonPretty(jsonConfig, buffer);
|
|
|
|
mqttPublish((topicPrefix + "/" + getValueName(json["type"].as<ha_component_type_t>()) + "/" + myNet.macToString(sender) + "-" + unit + "/config").c_str(), buffer, true);
|
|
|
|
mqttPublish((topicPrefix + "/" + getValueName(json[MCMT_COMPONENT_TYPE].as<ha_component_type_t>()) + "/" + myNet.macToString(sender) + "-" + unit + "/config").c_str(), buffer, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (incomingData.deviceType == ENDT_SENSOR)
|
|
|
|
if (incomingData.deviceType == ENDT_SENSOR)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -292,29 +296,32 @@ void onEspnowMessage(const char *data, const uint8_t *sender)
|
|
|
|
memcpy(&configData.message, &incomingData.message, sizeof(esp_now_payload_data_t::message));
|
|
|
|
memcpy(&configData.message, &incomingData.message, sizeof(esp_now_payload_data_t::message));
|
|
|
|
StaticJsonDocument<sizeof(esp_now_payload_data_t::message)> json;
|
|
|
|
StaticJsonDocument<sizeof(esp_now_payload_data_t::message)> json;
|
|
|
|
deserializeJson(json, configData.message);
|
|
|
|
deserializeJson(json, configData.message);
|
|
|
|
uint8_t unit = json["unit"].as<uint8_t>();
|
|
|
|
uint8_t unit = json[MCMT_DEVICE_UNIT].as<uint8_t>();
|
|
|
|
ha_component_type_t type = json["type"].as<ha_component_type_t>();
|
|
|
|
ha_component_type_t type = json[MCMT_COMPONENT_TYPE].as<ha_component_type_t>();
|
|
|
|
StaticJsonDocument<2048> jsonConfig;
|
|
|
|
StaticJsonDocument<2048> jsonConfig;
|
|
|
|
jsonConfig["platform"] = "mqtt";
|
|
|
|
jsonConfig["platform"] = "mqtt";
|
|
|
|
jsonConfig["name"] = json["name"];
|
|
|
|
jsonConfig["name"] = json[MCMT_DEVICE_NAME];
|
|
|
|
jsonConfig["unique_id"] = myNet.macToString(sender) + "-" + unit;
|
|
|
|
jsonConfig["unique_id"] = myNet.macToString(sender) + "-" + unit;
|
|
|
|
jsonConfig["state_topic"] = topicPrefix + "/" + getValueName(incomingData.deviceType) + "/" + myNet.macToString(sender) + "/state";
|
|
|
|
jsonConfig["state_topic"] = topicPrefix + "/" + getValueName(incomingData.deviceType) + "/" + myNet.macToString(sender) + "/state";
|
|
|
|
jsonConfig["value_template"] = "{{ value_json." + json["template"].as<String>() + " }}";
|
|
|
|
jsonConfig["value_template"] = "{{ value_json." + json[MCMT_VALUE_TEMPLATE].as<String>() + " }}";
|
|
|
|
jsonConfig["json_attributes_topic"] = topicPrefix + "/" + getValueName(incomingData.deviceType) + "/" + myNet.macToString(sender) + "/attributes";
|
|
|
|
jsonConfig["json_attributes_topic"] = topicPrefix + "/" + getValueName(incomingData.deviceType) + "/" + myNet.macToString(sender) + "/attributes";
|
|
|
|
jsonConfig["force_update"] = "true";
|
|
|
|
jsonConfig["force_update"] = "true";
|
|
|
|
jsonConfig["retain"] = "true";
|
|
|
|
jsonConfig["retain"] = "true";
|
|
|
|
if (type == HACT_SENSOR)
|
|
|
|
if (type == HACT_SENSOR)
|
|
|
|
jsonConfig["device_class"] = getValueName(json["class"].as<ha_sensor_device_class_t>());
|
|
|
|
|
|
|
|
if (type == HACT_BINARY_SENSOR)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ha_binary_sensor_device_class_t deviceClass = json["class"].as<ha_binary_sensor_device_class_t>();
|
|
|
|
jsonConfig["device_class"] = getValueName(json[MCMT_DEVICE_CLASS].as<ha_sensor_device_class_t>());
|
|
|
|
if (deviceClass == HABSDC_BATTERY || deviceClass == HABSDC_WINDOW || deviceClass == HABSDC_DOOR)
|
|
|
|
jsonConfig["unit_of_measurement"] = json[MCMT_UNIT_OF_MEASUREMENT];
|
|
|
|
jsonConfig["payload_off"] = json["payload_off"];
|
|
|
|
|
|
|
|
if (deviceClass == HABSDC_CONNECTIVITY)
|
|
|
|
|
|
|
|
jsonConfig["expire_after"] = json["expire_after"];
|
|
|
|
|
|
|
|
jsonConfig["device_class"] = getValueName(deviceClass);
|
|
|
|
|
|
|
|
jsonConfig["payload_on"] = json["payload_on"];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type == HACT_BINARY_SENSOR)
|
|
|
|
|
|
|
|
jsonConfig["device_class"] = getValueName(json[MCMT_DEVICE_CLASS].as<ha_binary_sensor_device_class_t>());
|
|
|
|
|
|
|
|
if (json[MCMT_EXPIRE_AFTER])
|
|
|
|
|
|
|
|
jsonConfig["expire_after"] = json[MCMT_EXPIRE_AFTER];
|
|
|
|
|
|
|
|
if (json[MCMT_OFF_DELAY])
|
|
|
|
|
|
|
|
jsonConfig["off_delay"] = json[MCMT_OFF_DELAY];
|
|
|
|
|
|
|
|
if (json[MCMT_PAYLOAD_ON])
|
|
|
|
|
|
|
|
jsonConfig["payload_on"] = json[MCMT_PAYLOAD_ON];
|
|
|
|
|
|
|
|
if (json[MCMT_PAYLOAD_OFF])
|
|
|
|
|
|
|
|
jsonConfig["payload_off"] = json[MCMT_PAYLOAD_OFF];
|
|
|
|
char buffer[2048]{0};
|
|
|
|
char buffer[2048]{0};
|
|
|
|
serializeJsonPretty(jsonConfig, buffer);
|
|
|
|
serializeJsonPretty(jsonConfig, buffer);
|
|
|
|
mqttPublish((topicPrefix + "/" + getValueName(type) + "/" + myNet.macToString(sender) + "-" + unit + "/config").c_str(), buffer, true);
|
|
|
|
mqttPublish((topicPrefix + "/" + getValueName(type) + "/" + myNet.macToString(sender) + "-" + unit + "/config").c_str(), buffer, true);
|
|
|
@ -402,6 +409,7 @@ void onMqttMessage(char *topic, byte *payload, unsigned int length)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
esp_now_payload_data_t outgoingData;
|
|
|
|
esp_now_payload_data_t outgoingData;
|
|
|
|
outgoingData.deviceType = ENDT_GATEWAY;
|
|
|
|
outgoingData.deviceType = ENDT_GATEWAY;
|
|
|
|
|
|
|
|
outgoingData.payloadsType = ENPT_SET;
|
|
|
|
StaticJsonDocument<sizeof(esp_now_payload_data_t::message)> json;
|
|
|
|
StaticJsonDocument<sizeof(esp_now_payload_data_t::message)> json;
|
|
|
|
if (message == "update" || message == "restart")
|
|
|
|
if (message == "update" || message == "restart")
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -433,8 +441,8 @@ void onMqttMessage(char *topic, byte *payload, unsigned int length)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (message == "restart")
|
|
|
|
if (message == "restart")
|
|
|
|
outgoingData.payloadsType = ENPT_RESTART;
|
|
|
|
outgoingData.payloadsType = ENPT_RESTART;
|
|
|
|
else
|
|
|
|
if (message == "update")
|
|
|
|
outgoingData.payloadsType = message == "update" ? ENPT_UPDATE : ENPT_SET;
|
|
|
|
outgoingData.payloadsType = ENPT_UPDATE;
|
|
|
|
serializeJsonPretty(json, outgoingData.message);
|
|
|
|
serializeJsonPretty(json, outgoingData.message);
|
|
|
|
char temp[sizeof(esp_now_payload_data_t)]{0};
|
|
|
|
char temp[sizeof(esp_now_payload_data_t)]{0};
|
|
|
|
memcpy(&temp, &outgoingData, sizeof(esp_now_payload_data_t));
|
|
|
|
memcpy(&temp, &outgoingData, sizeof(esp_now_payload_data_t));
|
|
|
@ -455,7 +463,7 @@ void sendKeepAliveMessage()
|
|
|
|
StaticJsonDocument<sizeof(esp_now_payload_data_t::message)> json;
|
|
|
|
StaticJsonDocument<sizeof(esp_now_payload_data_t::message)> json;
|
|
|
|
json["MQTT"] = isMqttAvailable ? "online" : "offline";
|
|
|
|
json["MQTT"] = isMqttAvailable ? "online" : "offline";
|
|
|
|
json["frequency"] = 10; // For compatibility with the previous version. Will be removed in future releases.
|
|
|
|
json["frequency"] = 10; // For compatibility with the previous version. Will be removed in future releases.
|
|
|
|
if (workMode == ESP_NOW_WIFI)
|
|
|
|
if (workMode == ESP_NOW_WIFI && WiFi.isConnected())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ntpWiFiClient.update();
|
|
|
|
ntpWiFiClient.update();
|
|
|
|
uint64_t epochTime = ntpWiFiClient.getEpochTime();
|
|
|
|
uint64_t epochTime = ntpWiFiClient.getEpochTime();
|
|
|
@ -463,7 +471,7 @@ void sendKeepAliveMessage()
|
|
|
|
json["time"] = ntpWiFiClient.getFormattedTime();
|
|
|
|
json["time"] = ntpWiFiClient.getFormattedTime();
|
|
|
|
json["date"] = String(time->tm_mday) + "." + String(time->tm_mon + 1) + "." + String(time->tm_year + 1900);
|
|
|
|
json["date"] = String(time->tm_mday) + "." + String(time->tm_mon + 1) + "." + String(time->tm_year + 1900);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (workMode == ESP_NOW_LAN)
|
|
|
|
if (workMode == ESP_NOW_LAN && Ethernet.linkStatus() == LinkON)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ntpEthClient.update();
|
|
|
|
ntpEthClient.update();
|
|
|
|
uint64_t epochTime = ntpEthClient.getEpochTime();
|
|
|
|
uint64_t epochTime = ntpEthClient.getEpochTime();
|
|
|
@ -628,16 +636,16 @@ void setupWebServer()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ssid = request->getParam("ssid")->value();
|
|
|
|
ssid = request->getParam("ssid")->value();
|
|
|
|
password = request->getParam("password")->value();
|
|
|
|
password = request->getParam("password")->value();
|
|
|
|
mqttHostName = request->getParam("host")->value();
|
|
|
|
mqttHostName = request->getParam("mqttHostName")->value();
|
|
|
|
mqttHostPort = request->getParam("port")->value().toInt();
|
|
|
|
mqttHostPort = request->getParam("mqttHostPor")->value().toInt();
|
|
|
|
mqttUserLogin = request->getParam("login")->value();
|
|
|
|
mqttUserLogin = request->getParam("mqttUserLogin")->value();
|
|
|
|
mqttUserPassword = request->getParam("pass")->value();
|
|
|
|
mqttUserPassword = request->getParam("mqttUserPassword")->value();
|
|
|
|
topicPrefix = request->getParam("prefix")->value();
|
|
|
|
topicPrefix = request->getParam("topicPrefix")->value();
|
|
|
|
deviceName = request->getParam("name")->value();
|
|
|
|
deviceName = request->getParam("deviceName")->value();
|
|
|
|
espnowNetName = request->getParam("net")->value();
|
|
|
|
espnowNetName = request->getParam("espnowNetName")->value();
|
|
|
|
workMode = request->getParam("mode")->value().toInt();
|
|
|
|
workMode = request->getParam("workMode")->value().toInt();
|
|
|
|
ntpHostName = request->getParam("ntp")->value();
|
|
|
|
ntpHostName = request->getParam("ntpHostName")->value();
|
|
|
|
gmtOffset = request->getParam("zone")->value().toInt();
|
|
|
|
gmtOffset = request->getParam("gmtOffset")->value().toInt();
|
|
|
|
request->send(200);
|
|
|
|
request->send(200);
|
|
|
|
saveConfig(); });
|
|
|
|
saveConfig(); });
|
|
|
|
|
|
|
|
|
|
|
|