supla-device
Loading...
Searching...
No Matches
solaredge.h
1/*
2 Copyright (C) AC SOFTWARE SP. Z O.O.
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17*/
18
19#ifndef SRC_SUPLA_PV_SOLAREDGE_H_
20#define SRC_SUPLA_PV_SOLAREDGE_H_
21
22#ifndef ARDUINO_ARCH_AVR
23// Arduino Mega can't establish https connection, so it can't be supported
24
25#include <WiFiClientSecure.h>
26#include <supla/clock/clock.h>
27#include <supla/sensor/electricity_meter.h>
28
29#define APIKEY_MAX_LENGTH 100
30#define PARAMETER_MAX_LENGTH 20
31
32namespace Supla {
33namespace PV {
34class SolarEdge : public Supla::Sensor::ElectricityMeter {
35 public:
36 SolarEdge(const char *apiKeyValue,
37 const char *siteIdValue,
38 const char *inverterSerialNumberValue,
39 Supla::Clock *clock);
40 void readValuesFromDevice();
41 void iterateAlways();
42 bool iterateConnected();
43 Channel *getSecondaryChannel();
44
45 protected:
46 WiFiClientSecure pvClient;
47
48 char buf[1024];
49
50 double temperature;
51 unsigned _supla_int64_t totalGeneratedEnergy;
52 unsigned _supla_int_t currentCurrent[3];
53 unsigned _supla_int16_t currentVoltage[3];
54 unsigned _supla_int16_t currentFreq;
55 _supla_int_t currentApparentPower[3];
56 _supla_int_t currentActivePower[3];
57 _supla_int_t currentReactivePower[3];
58 // acCurrent setCurrent
59 // acVoltage
60 // acFreq
61 // apparentPower
62 // activePower
63 // ReactivePower
64 int bytesCounter;
65 int retryCounter;
66 bool dataIsReady;
67 bool dataFetchInProgress;
68 bool headerFound;
69 uint32_t connectionTimeoutMs;
70
71 char apiKey[APIKEY_MAX_LENGTH] = {};
72 char siteId[PARAMETER_MAX_LENGTH] = {};
73 char inverterSerialNumber[PARAMETER_MAX_LENGTH] = {};
74 Supla::Clock *clock = nullptr;
75 Supla::Channel temperatureChannel;
76};
77}; // namespace PV
78}; // namespace Supla
79
80#endif // ARDUINO_ARCH_AVR
81#endif // SRC_SUPLA_PV_SOLAREDGE_H_
Definition channel.h:33
Definition clock.h:29
bool iterateConnected()
Method called on each SuplaDevice iteration when device is connected and registered to Supla server o...
Definition solaredge.cpp:302
void iterateAlways()
Method called on each SuplaDevice iteration.
Definition solaredge.cpp:72
Definition electricity_meter.h:67