@Bob and any suggested code helpers.
I need to get the data in 30-minute increments from my device into a server running MariaDB. I have a dev who has written the MariaDB script API to place the data - I just need to update firmware to send the data log. I am asking for your help ( any devs ) - willing to pay if i have to …
Some background - I am not a programmer. I have asked a dev of mine to try and help and he has written 2 files, which I tried to compile into the GitHub firmware and upon upload, the device doesn’t broadcast wifi - so not working… I have included the coding for the 2 files below .
Any input or help pleas is much appreciated.
file 1 :- call.cpp
#include <call.h>
// #include <JsonParse.h>
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <asyncHTTPrequest.h>
#include <Ticker.h>
asyncHTTPrequest request;
asyncHTTPrequest dayRequest;
Ticker hourTicker;
Ticker dayTicker;
void sendRequest()
{
if (request.readyState() == 0 || request.readyState() == 4)
{
request.open(“GET”, “http://iotmeterx.co.za/iot/Api/updateservices”);
request.send();
}
}
void sendDayRequest()
{
if (dayRequest.readyState() == 0 || dayRequest.readyState() == 4)
{
dayRequest.setDebug(true);
dayRequest.open(“GET”, “http://iotmeterx.co.za/iot/Api/getfulldaydata”);
dayRequest.send();
dayRequest.setDebug(false);
}
}
void requestCB(void *optParm, asyncHTTPrequest *request, int readyState)
{
if (readyState == 4)
{
Serial.println();
request->setDebug(true);
// parseJson(request->responseText());
Serial.println(request->responseText());
request->setDebug(false);
Serial.println();
}
}
void dayrequestCB(void *optParm, asyncHTTPrequest *request, int readyState)
{
if (readyState == 4)
{
Serial.println();
request->setDebug(true);
// parseJson(request->responseText());
Serial.println(request->responseText());
request->setDebug(false);
Serial.println();
}
}
void call()
{
// Serial.begin(115200);
// WiFi.setAutoConnect(true);
// WiFi.begin();
request.setTimeout(5);
dayRequest.setTimeout(20);
request.onReadyStateChange(requestCB);
dayRequest.onReadyStateChange(dayrequestCB);
hourTicker.attach(UPDATERATE, sendRequest);
dayTicker.attach(DAYRATE, sendDayRequest);
Serial.println("done");
}
File 2 : Call.h
#ifndef STASSID
#define STASSID “EBMACS”
#define STAPSK “ebmacs8485867”
#define UPDATERATE 1800 // in seconds
#define DAYRATE 86400 // in seconds
#endif
void call();