supla-device
Loading...
Searching...
No Matches
fronius.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/*
20 Library tested on:
21 Fronius Symo 6.0-3 M with DataManager 2.0 and Smart Meter 63A-3
22*/
23
24#ifndef SRC_SUPLA_PV_FRONIUS_H_
25#define SRC_SUPLA_PV_FRONIUS_H_
26
27#include <IPAddress.h>
28#include <supla/sensor/electricity_meter.h>
29#include <supla/network/client.h>
30
31namespace Supla {
32namespace PV {
33class Fronius : public Supla::Sensor::ElectricityMeter {
34 public:
35 explicit Fronius(
36 IPAddress ip,
37 int port = 80,
38 int deviceId = 1,
39 int deviceType = 0);
40 ~Fronius();
41 void readValuesFromDevice();
42 void iterateAlways();
43 bool iterateConnected();
44
45 protected:
46 void getSinglePhaseInverterValues(char* varName, char* varValue);
47 void getThreePhaseInverterValues(char* varName, char* varValue);
48 void getThreePhaseMeterValues(char* varName, char* varValue);
49 void setSinglePhaseInverterValues(bool zeroValues);
50 void setThreePhaseInverterValues(bool zeroValues);
51 void setThreePhaseMeterValues(bool zeroValues);
52 void getSinglePhaseInverterURL(char* buf, char* idBuf);
53 void getThreePhaseInverterURL(char* buf, char* idBuf);
54 void getThreePhaseMeterURL(char* buf, char* idBuf);
55 ::Supla::Client *client = nullptr;
56 IPAddress ip;
57 int port;
58 int deviceType;
59 char buf[80] = {};
60 unsigned _supla_int64_t totalGeneratedEnergy = 0;
61 unsigned _supla_int64_t fwdReactEnergy = 0;
62 unsigned _supla_int64_t rvrReactEnergy = 0;
63 unsigned _supla_int64_t fwdActEnergy = 0;
64 unsigned _supla_int64_t rvrActEnergy = 0;
65 _supla_int_t currentActivePower[3] = {};
66 _supla_int_t currentApparentPower[3] = {};
67 _supla_int_t currentReactivePower[3] = {};
68 _supla_int_t currentPowerFactor[3] = {};
69 unsigned _supla_int16_t currentCurrent[3] = {};
70 unsigned _supla_int16_t currentFreq = 0;
71 unsigned _supla_int16_t currentVoltage[3] = {};
72 int bytesCounter = 0;
73 int retryCounter = 0;
74 int deviceId;
75 bool startCharFound = false;
76 bool dataIsReady = false;
77 bool dataFetchInProgress = false;
78 uint64_t connectionTimeoutMs = 0;
79 char variableToFetch[80] = {};
80 bool fetch3p = false;
81 int invDisabledCounter = 0;
82};
83}; // namespace PV
84}; // namespace Supla
85
86#endif // SRC_SUPLA_PV_FRONIUS_H_
Definition ip_address.h:30
Definition client.h:31
void iterateAlways()
Method called on each SuplaDevice iteration.
Definition fronius.cpp:322
bool iterateConnected()
Method called on each SuplaDevice iteration when device is connected and registered to Supla server o...
Definition fronius.cpp:468
Definition electricity_meter.h:67