Add envoy support to solar logger

This commit is contained in:
2022-08-15 13:14:16 +02:00
parent 642170172a
commit 35e6ec08d7
16 changed files with 355 additions and 309 deletions

View File

@@ -3,22 +3,29 @@
#include <sqlite3.h>
#include <string>
struct Row
struct ZeverRow
{
time_t epochTime;
std::int32_t watt;
double kilowattPerHour;
};
struct EnvoyRow
{
time_t epochTime;
std::int32_t inverterCount;
std::int32_t currentWatt;
std::int64_t lifetimeWattHour;
std::int64_t inverterTime;
};
class Database {
private:
sqlite3 * connectionPtr;
std::string ToSqlInsertStatement(Row const & row) const;
std::string ToSqlUpsertStatement(Row const & row) const;
public:
bool Insert(Row & row);
bool Insert(ZeverRow & row);
bool Insert(EnvoyRow & row);
Database(std::string const & databasePath);
~Database();