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 <supla/clock/clock.h>
26#include <supla/network/client.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 ~SolarEdge();
41 void readValuesFromDevice();
42 void iterateAlways();
43 bool iterateConnected();
45
46 protected:
47 ::Supla::Client *pvClient = nullptr;
48
49 char buf[1024];
50
51 double temperature;
52 unsigned _supla_int64_t totalGeneratedEnergy;
53 unsigned _supla_int_t currentCurrent[3];
54 unsigned _supla_int16_t currentVoltage[3];
55 unsigned _supla_int16_t currentFreq;
56 _supla_int_t currentApparentPower[3];
57 _supla_int_t currentActivePower[3];
58 _supla_int_t currentReactivePower[3];
59 // acCurrent setCurrent
60 // acVoltage
61 // acFreq
62 // apparentPower
63 // activePower
64 // ReactivePower
65 int bytesCounter;
66 int retryCounter;
67 bool dataIsReady;
68 bool dataFetchInProgress;
69 bool headerFound;
70 uint32_t connectionTimeoutMs;
71
72 char apiKey[APIKEY_MAX_LENGTH] = {};
73 char siteId[PARAMETER_MAX_LENGTH] = {};
74 char inverterSerialNumber[PARAMETER_MAX_LENGTH] = {};
75 Supla::Clock *clock = nullptr;
76 Supla::Channel temperatureChannel;
77};
78}; // namespace PV
79}; // namespace Supla
80
81#endif // ARDUINO_ARCH_AVR
82#endif // SRC_SUPLA_PV_SOLAREDGE_H_
Definition channel.h:33
Definition channel.h:33
Definition client.h:38
Definition clock.h:29
virtual const Channel * getSecondaryChannel() const
Returns pointer to secondary channel.
Definition element.cpp:199
void iterateAlways()
Method called on each SuplaDevice iteration.
Definition solaredge.cpp:122
bool iterateConnected()
Method called on each SuplaDevice iteration when device is connected and registered to Supla server o...
Definition solaredge.cpp:353
Definition electricity_meter.h:67