supla-device
Loading...
Searching...
No Matches
fronius.h
1// SPDX-FileCopyrightText: AC SOFTWARE SP. Z O.O.
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4/*
5 Library tested on:
6 Fronius Symo 6.0-3 M with DataManager 2.0 and Smart Meter 63A-3
7*/
8
9#ifndef SRC_SUPLA_PV_FRONIUS_H_
10#define SRC_SUPLA_PV_FRONIUS_H_
11
12#include <IPAddress.h>
13#include <supla/sensor/electricity_meter.h>
14#include <supla/network/client.h>
15
16namespace Supla {
17namespace PV {
19 public:
20 explicit Fronius(
21 IPAddress ip,
22 int port = 80,
23 int deviceId = 1,
24 int deviceType = 0);
25 ~Fronius();
26 static bool isDeviceTypeSupported(int deviceType);
27 void readValuesFromDevice();
28 void iterateAlways();
29 bool iterateConnected();
30
31 protected:
32 void getSinglePhaseInverterValues(char* varName, char* varValue);
33 void getThreePhaseInverterValues(char* varName, char* varValue);
34 void getThreePhaseMeterValues(char* varName, char* varValue);
35 void setSinglePhaseInverterValues(bool zeroValues);
36 void setThreePhaseInverterValues(bool zeroValues);
37 void setThreePhaseMeterValues(bool zeroValues);
38 void getSinglePhaseInverterURL(char* buf, char* idBuf);
39 void getThreePhaseInverterURL(char* buf, char* idBuf);
40 void getThreePhaseMeterURL(char* buf, char* idBuf);
41 ::Supla::Client *client = nullptr;
42 IPAddress ip;
43 int port;
44 int deviceType;
45 char buf[80] = {};
46 unsigned _supla_int64_t totalGeneratedEnergy = 0;
47 unsigned _supla_int64_t fwdReactEnergy = 0;
48 unsigned _supla_int64_t rvrReactEnergy = 0;
49 unsigned _supla_int64_t fwdActEnergy = 0;
50 unsigned _supla_int64_t rvrActEnergy = 0;
51 _supla_int_t currentActivePower[3] = {};
52 _supla_int_t currentApparentPower[3] = {};
53 _supla_int_t currentReactivePower[3] = {};
54 _supla_int_t currentPowerFactor[3] = {};
55 unsigned _supla_int16_t currentCurrent[3] = {};
56 unsigned _supla_int16_t currentFreq = 0;
57 unsigned _supla_int16_t currentVoltage[3] = {};
58 int bytesCounter = 0;
59 int retryCounter = 0;
60 int deviceId;
61 bool startCharFound = false;
62 bool dataIsReady = false;
63 bool dataFetchInProgress = false;
64 uint64_t connectionTimeoutMs = 0;
65 char variableToFetch[80] = {};
66 bool fetch3p = false;
67 int invDisabledCounter = 0;
68};
69}; // namespace PV
70}; // namespace Supla
71
72#endif // SRC_SUPLA_PV_FRONIUS_H_
Definition ip_address.h:15
Definition client.h:24
Definition fronius.h:18
void iterateAlways()
Method called on each SuplaDevice iteration.
Definition fronius.cpp:289
bool iterateConnected()
Method called on each SuplaDevice iteration when device is connected and registered to Supla server o...
Definition fronius.cpp:422
Definition electricity_meter.h:52