Push log to external DB ( code help )

@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();

Any reason why you can’t just pull the data using query?

http://docs.iotawatt.com/en/master/query.html

Pull won’t work as I will have a few devices on differening networks that are not mine.

OK, push it to an influxDB database or Emoncms and the pull it from there. IMO there are better solutions than creating your own firmware, but if that’s what you want to do, go for it. Personally, I think it’s reinventing the wheel, so have fun but I’m not going to get into looking at your code.

No probs but Nah not going influxdb or emoncms route. Can you suggest any other of the forum users I could chat too? Of course I will eventually come right but wanted to fast track this with some coders who know the device.

Thought this forum was a good place to ask, maybe I should also try openenergymonitor forum, your suggestion?

I’m trying a role call from the clever boys I could pick up on in previous posts :- @promy , @brettbeeson , @alexturner , @mfenniak , @LenSamuelson, @blitz1986 , @Bali , @michal , @franck102, your help please gents.

Can you post an example of a request to that API? Headers, parameters, body, etc. Perhaps a CURL? Your Dev will know.

Edit: Plus it would be helpful if your Dev can provide you the API request format to get date/time of last record. One of the most powerful and unique features of Iotawatt is that it can upload historic data in case of down internet.

@Bali - let me ask him and respond. tx