-
Notifications
You must be signed in to change notification settings - Fork 22
/
growatt.c
85 lines (78 loc) · 3.77 KB
/
growatt.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//***************************************************************************
// Automation Control
// File growatt.c
// This code is distributed under the terms and conditions of the
// GNU GENERAL PUBLIC LICENSE. See the file LICENSE for details.
// Date 04.11.2010 - 01.12.2023 Jörg Wendel
//***************************************************************************
#include "growatt.h"
//***************************************************************************
// Gro Watt
//***************************************************************************
std::map<std::string,GroWatt::Def> GroWatt::sensors =
{
{ "ACPowerToGrid", { 1, "W" } },
{ "ACPowerToGridTotal", { 2, "W" } },
{ "ACPowerToUser", { 3, "W" } },
{ "ACPowerToUserTotal", { 4, "W" } },
{ "BatteryState", { 5, "" } },
{ "BatteryTemperature", { 6, "°C" } },
{ "BatteryVoltage", { 7, "V" } },
{ "BoostTemperature", { 8, "°C" } },
{ "ChargeEnergyToday", { 9, "kWh" } },
{ "ChargeEnergyTotal", { 10, "kWh" } },
{ "ChargePower", { 11, "W" } },
{ "Cnt", { 12, "" } },
{ "DischargeEnergyToday", { 13, "kWh" } },
{ "DischargeEnergyTotal", { 14, "kWh" } },
{ "DischargePower", { 15, "W" } },
{ "EnergyToGridToday", { 16, "kWh" } },
{ "EnergyToGridTotal", { 17, "kWh" } },
{ "EnergyToUserToday", { 18, "kWh" } },
{ "EnergyToUserTotal", { 19, "kWh" } },
{ "GridFrequency", { 20, "Hz" } },
{ "INVPowerToLocalLoad", { 21, "W" } },
{ "INVPowerToLocalLoadTotal", { 22, "W" } },
{ "InputPower", { 23, "W" } },
{ "InverterStatus", { 24, "" } },
{ "InverterTemperature", { 25, "°C" } },
{ "L1ThreePhaseGridOutputCurrent", { 26, "A" } },
{ "L1ThreePhaseGridOutputPower", { 27, "W" } },
{ "L1ThreePhaseGridVoltage", { 28, "V" } },
{ "L2ThreePhaseGridOutputCurrent", { 29, "A" } },
{ "L2ThreePhaseGridOutputPower", { 30, "W" } },
{ "L2ThreePhaseGridVoltage", { 31, "V" } },
{ "L3ThreePhaseGridOutputCurrent", { 32, "A" } },
{ "L3ThreePhaseGridOutputPower", { 33, "W" } },
{ "L3ThreePhaseGridVoltage", { 34, "V" } },
{ "LocalLoadEnergyToday", { 35, "kWh" } },
{ "LocalLoadEnergyTotal", { 36, "kWh" } },
{ "Mac", { 37, "" } },
{ "OutputPower", { 38, "W" } },
{ "PV1EnergyToday", { 39, "kWh" } },
{ "PV1EnergyTotal", { 40, "kWh" } },
{ "PV1InputCurrent", { 41, "A" } },
{ "PV1InputPower", { 42, "W" } },
{ "PV1Voltage", { 43, "V" } },
{ "PV2EnergyToday", { 44, "kWh" } },
{ "PV2EnergyTotal", { 45, "kWh" } },
{ "PV2InputCurrent", { 46, "A" } },
{ "PV2InputPower", { 47, "W" } },
{ "PV2Voltage", { 48, "V" } },
{ "PVEnergyTotal", { 49, "kWh" } },
{ "SOC", { 50, "%" } },
{ "WorkTimeTotal", { 51, "s" } },
{ "TemperatureInsideIPM", { 52, "°C" } },
{ "TodayGenerateEnergy", { 53, "kWh" } },
{ "TotalGenerateEnergy", { 54, "kWh" } }
};
//***************************************************************************
// Get Address Of
//***************************************************************************
int GroWatt::getAddressOf(const char* key)
{
const auto it = sensors.find(key);
if (it == sensors.end())
return na;
return it->second.address;
}