Change my program to the new structure #1
Replies: 5 comments 22 replies
-
Hello again, @Hieromon I think I'm going to change my request for the reason that if it works correctly,
I see that to add the variables from one EdgeDriver to another EdgeDriver just add xxxxx.h ? /*
EgeDriver handling MQTT as an example of combining to EdgeUnified.
MyGpio.cpp is an implementation of GPIO EdgeDriver. EdgeDriver basically
*/
#include <Arduino.h>
#if defined(ARDUINO_ARCH_ESP8266)
#include <ESP8266HTTPClient.h>
#elif defined(ARDUINO_ARCH_ESP32)
#include <HTTPClient.h>
#endif
#include <ArduinoJson.h>
#include <AutoConnect.h>
#include <PubSubClient.h>
#include "EdgeUnified.h"
#include "MyMqtt.h"
#include "MyGpio.h" // <----------------- so far everything is working fine |
Beta Was this translation helpful? Give feedback.
-
Hmmm, what was the response code for the POST request? |
Beta Was this translation helpful? Give feedback.
-
wow...i am very happy with your library and it has captured exactly what we needed. Every time I get deeper into programming with this ability to be able to use what I need or request many more things on demand, I like more this form of structure, although at first it costs a little more to adapt. I would like your opinion on this? // AutoConnectAux handler. Obtain AutoConnectElement values, copy to EdgeData
String auxMENUStart(AutoConnectAux& aux, PageArgument& args) {
const AutoConnectAux* requestAux = portal.aux(portal.where());
bool checked_Use_MySQL = ((AutoConnectAux&)(*requestAux))["Use_MySQL"].as<AutoConnectCheckbox>().checked;
menu.data.Use_MySQL = checked_Use_MySQL;
bool checked_Use_HOMEKIT = ((AutoConnectAux&)(*requestAux))["Use_HOMEKIT"].as<AutoConnectCheckbox>().checked;
menu.data.Use_HOMEKIT = checked_Use_HOMEKIT;
menu.data.hostName = aux["hostName"].as<AutoConnectText>().value;
menu.data.COMAND = aux["COMAND"].as<AutoConnectText>().value;
// You make EdgeData persistent when the value it has is changed.
menu.save();
menu.start();
return String();
} if (menu.data.Use_MySQL){
mysql.autoRestore(true);
mysql.serializer(mysqlSerialize, mysqlDeserialize, 512);
Edge.attach(mysql);
Edge.join(FPSTR(SETTINGS_MySQL), auxMySQLSetting);
Edge.join(FPSTR(START_MySQL), auxMySQLStart);
Edge.join(FPSTR(CLEAR_MySQL), auxMySQLClear);
Edge.join(FPSTR(STOP_MySQL), auxMySQLStop);
} although thanks to its API enable, I can think of infinite possibilities between EdgeDriver that with my previous structure would have been very complicated or impossible. void loop() {
mysql.enable(menu.data.Use_MySQL);
Edge.process(portal);
mDNSUpdate();
portal.handleClient();
} Everything is running smoothly as we go. please check this in your example in case it is necessary to define hostname for eps32, I see that in your original example you use hostname for the APID only and for the name I imagine in ThingSpeak but it doesn't change in MDNS. I don't know if he has it set like that for some reason? look: void onWiFiConnect(IPAddress& ip) {
String tcpName = "LH-" + menu.data.hostName;
const char* hostName = GET_HOSTNAME();
if (menu.data.hostName.length()) {
hostName = tcpName.c_str();
}
Serial.println("connected:" + WiFi.SSID());
Serial.println("IP:" + WiFi.localIP().toString());
Serial.printf("mDNS responder %s.local start", hostName);
if (MDNS.begin(hostName)) {
MDNS.addService("http", "tcp", 80);
Serial.println("ed");
}
else {
Serial.println(" failed");
}
}
|
Beta Was this translation helpful? Give feedback.
-
hello @Hieromon how are you How are you doing with this repository? any news or progress? |
Beta Was this translation helpful? Give feedback.
-
Hello @FRANAIRBUS, I remember it well. We have been on pause for a while to update Edge-Unified, but it may be a good time to get back into it. AutoConnect has become a bit too heavy, and with the update of the ESP32 Arduino core v.2.0.6, the core has increased in size and will no longer fit in the default partition. However, we still have homework to do. Continuation of this topic, right? |
Beta Was this translation helpful? Give feedback.
-
Hello @Hieromon
interesting library, seems to be very clean but I have to change many things including my mentality.
I have a problem here and I don't know why, it doesn't send me data to MySQL it returns error 1 I can't find what I'm missing
Beta Was this translation helpful? Give feedback.
All reactions