Fixed names of Kamstrup items, added List2

This commit is contained in:
Roar Fredriksen
2017-10-25 22:25:11 +02:00
parent d26e53badf
commit 9585645416
5 changed files with 80 additions and 39 deletions

View File

@@ -6,38 +6,77 @@
enum class Kamstrup
{
List1 = 0x19
List1 = 0x19,
List2 = 0x23
};
enum class Kamstrup_List1
{
Kamstrup_List1_Time,
Kamstrup_List1_ListID,
Kamstrup_List1_ListVersionIdentifier,
Kamstrup_List1_MeterID_OBIS,
Kamstrup_List1_MeterID,
Kamstrup_List1_MeterType_OBIS,
Kamstrup_List1_MeterType,
Kamstrup_List1_ActivePowerPos_OBIS,
Kamstrup_List1_ActivePowerPos,
Kamstrup_List1_ActivePowerNeg_OBIS,
Kamstrup_List1_ActivePowerNeg,
Kamstrup_List1_ReactivePowerPos_OBIS,
Kamstrup_List1_ReactivePowerPos,
Kamstrup_List1_ReactivePowerNeg_OBIS,
Kamstrup_List1_ReactivePowerNeg,
Kamstrup_List1_CurrentL1_OBIS,
Kamstrup_List1_CurrentL1,
Kamstrup_List1_CurrentL2_OBIS,
Kamstrup_List1_CurrentL2,
Kamstrup_List1_CurrentL3_OBIS,
Kamstrup_List1_CurrentL3,
Kamstrup_List1_VoltageL1_OBIS,
Kamstrup_List1_VoltageL1,
Kamstrup_List1_VoltageL2_OBIS,
Kamstrup_List1_VoltageL2,
Kamstrup_List1_VoltageL3_OBIS,
Kamstrup_List1_VoltageL3
Time,
ListID,
ListVersionIdentifier,
MeterID_OBIS,
MeterID,
MeterType_OBIS,
MeterType,
ActiveImportPower_OBIS,
ActiveImportPower,
ActiveExportPower_OBIS,
ActiveExportPower,
ReactiveImportPower_OBIS,
ReactiveImportPower,
ReactiveExportPower_OBIS,
ReactiveExportPower,
CurrentL1_OBIS,
CurrentL1,
CurrentL2_OBIS,
CurrentL2,
CurrentL3_OBIS,
CurrentL3,
VoltageL1_OBIS,
VoltageL1,
VoltageL2_OBIS,
VoltageL2,
VoltageL3_OBIS,
VoltageL3
};
enum class Kamstrup_List2
{
Time,
ListID,
ListVersionIdentifier,
MeterID_OBIS,
MeterID,
MeterType_OBIS,
MeterType,
ActiveImportPower_OBIS,
ActiveImportPower,
ActiveExportPower_OBIS,
ActiveExportPower,
ReactiveImportPower_OBIS,
ReactiveImportPower,
ReactiveExportPower_OBIS,
ReactiveExportPower,
CurrentL1_OBIS,
CurrentL1,
CurrentL2_OBIS,
CurrentL2,
CurrentL3_OBIS,
CurrentL3,
VoltageL1_OBIS,
VoltageL1,
VoltageL2_OBIS,
VoltageL2,
VoltageL3_OBIS,
VoltageL3,
MeterClock,
CumulativeActiveImportEnergy,
CumulativeActiveExportEnergy,
CumulativeReactiveImportEnergy,
CumulativeReactiveExportEnergy
};

View File

@@ -65,27 +65,27 @@ void loop() {
// Only care for the ACtive Power Imported, which is found in the first list
if (list == (int)Kamstrup::List1)
{
String id = hanReader.getString((int)Kamstrup_List1::Kamstrup_List1_ListVersionIdentifier);
String id = hanReader.getString((int)Kamstrup_List1::ListVersionIdentifier);
Serial.println(id);
time_t time = hanReader.getPackageTime();
Serial.print("Time of the package is: ");
Serial.println(time);
int power = hanReader.getInt((int)Kamstrup_List1::Kamstrup_List1_ActivePowerPos);
int power = hanReader.getInt((int)Kamstrup_List1::ActiveImportPower);
Serial.print("Power consumtion is right now: ");
Serial.print(power);
Serial.println(" W");
float current[3];
current[0] = (float)hanReader.getInt((int)Kamstrup_List1::Kamstrup_List1_CurrentL1) / 100.0;
current[1] = (float)hanReader.getInt((int)Kamstrup_List1::Kamstrup_List1_CurrentL2) / 100.0;
current[2] = (float)hanReader.getInt((int)Kamstrup_List1::Kamstrup_List1_CurrentL3) / 100.0;
current[0] = (float)hanReader.getInt((int)Kamstrup_List1::CurrentL1) / 100.0;
current[1] = (float)hanReader.getInt((int)Kamstrup_List1::CurrentL2) / 100.0;
current[2] = (float)hanReader.getInt((int)Kamstrup_List1::CurrentL3) / 100.0;
int voltage[3];
voltage[0] = hanReader.getInt((int)Kamstrup_List1::Kamstrup_List1_VoltageL1);
voltage[1] = hanReader.getInt((int)Kamstrup_List1::Kamstrup_List1_VoltageL2);
voltage[2] = hanReader.getInt((int)Kamstrup_List1::Kamstrup_List1_VoltageL3);
voltage[0] = hanReader.getInt((int)Kamstrup_List1::VoltageL1);
voltage[1] = hanReader.getInt((int)Kamstrup_List1::VoltageL2);
voltage[2] = hanReader.getInt((int)Kamstrup_List1::VoltageL3);
for (int i = 0; i < 3; i++)
{

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long