supla-device
Toggle main menu visibility
Loading...
Searching...
No Matches
src
supla
pv
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
31
namespace
Supla {
32
namespace
PV {
33
class
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
static
bool
isDeviceTypeSupported(
int
deviceType);
42
void
readValuesFromDevice();
43
void
iterateAlways
();
44
bool
iterateConnected
();
45
46
protected
:
47
void
getSinglePhaseInverterValues(
char
* varName,
char
* varValue);
48
void
getThreePhaseInverterValues(
char
* varName,
char
* varValue);
49
void
getThreePhaseMeterValues(
char
* varName,
char
* varValue);
50
void
setSinglePhaseInverterValues(
bool
zeroValues);
51
void
setThreePhaseInverterValues(
bool
zeroValues);
52
void
setThreePhaseMeterValues(
bool
zeroValues);
53
void
getSinglePhaseInverterURL(
char
* buf,
char
* idBuf);
54
void
getThreePhaseInverterURL(
char
* buf,
char
* idBuf);
55
void
getThreePhaseMeterURL(
char
* buf,
char
* idBuf);
56
::Supla::Client
*client =
nullptr
;
57
IPAddress
ip;
58
int
port;
59
int
deviceType;
60
char
buf[80] = {};
61
unsigned
_supla_int64_t totalGeneratedEnergy = 0;
62
unsigned
_supla_int64_t fwdReactEnergy = 0;
63
unsigned
_supla_int64_t rvrReactEnergy = 0;
64
unsigned
_supla_int64_t fwdActEnergy = 0;
65
unsigned
_supla_int64_t rvrActEnergy = 0;
66
_supla_int_t currentActivePower[3] = {};
67
_supla_int_t currentApparentPower[3] = {};
68
_supla_int_t currentReactivePower[3] = {};
69
_supla_int_t currentPowerFactor[3] = {};
70
unsigned
_supla_int16_t currentCurrent[3] = {};
71
unsigned
_supla_int16_t currentFreq = 0;
72
unsigned
_supla_int16_t currentVoltage[3] = {};
73
int
bytesCounter = 0;
74
int
retryCounter = 0;
75
int
deviceId;
76
bool
startCharFound =
false
;
77
bool
dataIsReady =
false
;
78
bool
dataFetchInProgress =
false
;
79
uint64_t connectionTimeoutMs = 0;
80
char
variableToFetch[80] = {};
81
bool
fetch3p =
false
;
82
int
invDisabledCounter = 0;
83
};
84
};
// namespace PV
85
};
// namespace Supla
86
87
#endif
// SRC_SUPLA_PV_FRONIUS_H_
IPAddress
Definition
ip_address.h:30
Supla::Client
Definition
client.h:38
Supla::PV::Fronius::iterateAlways
void iterateAlways()
Method called on each SuplaDevice iteration.
Definition
fronius.cpp:304
Supla::PV::Fronius::iterateConnected
bool iterateConnected()
Method called on each SuplaDevice iteration when device is connected and registered to Supla server o...
Definition
fronius.cpp:437
Supla::Sensor::ElectricityMeter
Definition
electricity_meter.h:67
Generated by
1.17.0