supla-device
Loading...
Searching...
No Matches
solaredge.h
1// SPDX-FileCopyrightText: AC SOFTWARE SP. Z O.O.
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#ifndef SRC_SUPLA_PV_SOLAREDGE_H_
5#define SRC_SUPLA_PV_SOLAREDGE_H_
6
7#ifndef ARDUINO_ARCH_AVR
8// Arduino Mega can't establish https connection, so it can't be supported
9
10#include <supla/clock/clock.h>
11#include <supla/network/client.h>
12#include <supla/sensor/electricity_meter.h>
13
14#define APIKEY_MAX_LENGTH 100
15#define PARAMETER_MAX_LENGTH 20
16
17namespace Supla {
18namespace PV {
20 public:
21 SolarEdge(const char *apiKeyValue,
22 const char *siteIdValue,
23 const char *inverterSerialNumberValue,
24 Supla::Clock *clock);
25 ~SolarEdge();
26 void readValuesFromDevice();
27 void iterateAlways();
28 bool iterateConnected();
29 Channel *getSecondaryChannel();
30
31 protected:
32 ::Supla::Client *pvClient = nullptr;
33
34 char buf[1024];
35
36 double temperature;
37 unsigned _supla_int64_t totalGeneratedEnergy;
38 unsigned _supla_int_t currentCurrent[3];
39 unsigned _supla_int16_t currentVoltage[3];
40 unsigned _supla_int16_t currentFreq;
41 _supla_int_t currentApparentPower[3];
42 _supla_int_t currentActivePower[3];
43 _supla_int_t currentReactivePower[3];
44 // acCurrent setCurrent
45 // acVoltage
46 // acFreq
47 // apparentPower
48 // activePower
49 // ReactivePower
50 int bytesCounter;
51 int retryCounter;
52 bool dataIsReady;
53 bool dataFetchInProgress;
54 bool headerFound;
55 uint32_t connectionTimeoutMs;
56
57 char apiKey[APIKEY_MAX_LENGTH] = {};
58 char siteId[PARAMETER_MAX_LENGTH] = {};
59 char inverterSerialNumber[PARAMETER_MAX_LENGTH] = {};
60 Supla::Clock *clock = nullptr;
61 Supla::Channel temperatureChannel;
62};
63}; // namespace PV
64}; // namespace Supla
65
66#endif // ARDUINO_ARCH_AVR
67#endif // SRC_SUPLA_PV_SOLAREDGE_H_
Definition channel.h:26
Definition client.h:24
Definition clock.h:16
Definition solaredge.h:19
void iterateAlways()
Method called on each SuplaDevice iteration.
Definition solaredge.cpp:107
bool iterateConnected()
Method called on each SuplaDevice iteration when device is connected and registered to Supla server o...
Definition solaredge.cpp:338
Definition electricity_meter.h:52