mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-04-17 17:12:32 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38eb2d8c19 | ||
|
|
d95137adbc | ||
|
|
cde3f80fca | ||
|
|
cdc012743f |
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -9,7 +9,7 @@ on:
|
|||||||
- web/**
|
- web/**
|
||||||
- platformio.ini
|
- platformio.ini
|
||||||
branches:
|
branches:
|
||||||
- master
|
- '*'
|
||||||
tags:
|
tags:
|
||||||
- '*'
|
- '*'
|
||||||
- '!v*.*.*'
|
- '!v*.*.*'
|
||||||
|
|||||||
@@ -5,10 +5,12 @@
|
|||||||
|
|
||||||
enum class Kamstrup
|
enum class Kamstrup
|
||||||
{
|
{
|
||||||
|
List1PhaseShort = 0x11,
|
||||||
|
List1PhaseLong = 0x1B,
|
||||||
List3PhaseShort = 0x19,
|
List3PhaseShort = 0x19,
|
||||||
List3PhaseLong = 0x23,
|
List3PhaseLong = 0x23,
|
||||||
List1PhaseShort = 0x11,
|
List3PhaseITShort = 0x17,
|
||||||
List1PhaseLong = 0x1B
|
List3PhaseITLong = 0x21
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class Kamstrup_List3Phase
|
enum class Kamstrup_List3Phase
|
||||||
@@ -83,5 +85,43 @@ enum class Kamstrup_List1Phase
|
|||||||
CumulativeReactiveExportEnergy
|
CumulativeReactiveExportEnergy
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class Kamstrup_List3PhaseIT
|
||||||
|
{
|
||||||
|
ListSize,
|
||||||
|
ListVersionIdentifier,
|
||||||
|
MeterID_OBIS,
|
||||||
|
MeterID,
|
||||||
|
MeterType_OBIS,
|
||||||
|
MeterType,
|
||||||
|
ActiveImportPower_OBIS,
|
||||||
|
ActiveImportPower,
|
||||||
|
ActiveExportPower_OBIS,
|
||||||
|
ActiveExportPower,
|
||||||
|
ReactiveImportPower_OBIS,
|
||||||
|
ReactiveImportPower,
|
||||||
|
ReactiveExportPower_OBIS,
|
||||||
|
ReactiveExportPower,
|
||||||
|
CurrentL1_OBIS,
|
||||||
|
CurrentL1,
|
||||||
|
CurrentL3_OBIS,
|
||||||
|
CurrentL3,
|
||||||
|
VoltageL1_OBIS,
|
||||||
|
VoltageL1,
|
||||||
|
VoltageL2_OBIS,
|
||||||
|
VoltageL2,
|
||||||
|
VoltageL3_OBIS,
|
||||||
|
VoltageL3,
|
||||||
|
MeterClock_OBIS,
|
||||||
|
MeterClock,
|
||||||
|
CumulativeActiveImportEnergy_OBIS,
|
||||||
|
CumulativeActiveImportEnergy,
|
||||||
|
CumulativeActiveExportEnergy_OBIS,
|
||||||
|
CumulativeActiveExportEnergy,
|
||||||
|
CumulativeReactiveImportEnergy_OBIS,
|
||||||
|
CumulativeReactiveImportEnergy,
|
||||||
|
CumulativeReactiveExportEnergy_OBIS,
|
||||||
|
CumulativeReactiveExportEnergy
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ framework = arduino
|
|||||||
lib_deps = HanReader@1.0.1, ArduinoJson@6.14.1, MQTT@2.4.7, DallasTemperature@3.8.1, EspSoftwareSerial@6.7.1, Base64@1.0.0, RemoteDebug@3.0.5, Time@1.6
|
lib_deps = HanReader@1.0.1, ArduinoJson@6.14.1, MQTT@2.4.7, DallasTemperature@3.8.1, EspSoftwareSerial@6.7.1, Base64@1.0.0, RemoteDebug@3.0.5, Time@1.6
|
||||||
|
|
||||||
[env:hw1esp12e]
|
[env:hw1esp12e]
|
||||||
platform = espressif8266@2.3.3
|
platform = espressif8266@2.5.1
|
||||||
board = esp12e
|
board = esp12e
|
||||||
framework = ${common.framework}
|
framework = ${common.framework}
|
||||||
lib_deps = ${common.lib_deps}
|
lib_deps = ${common.lib_deps}
|
||||||
@@ -18,7 +18,7 @@ extra_scripts =
|
|||||||
scripts/makeweb.py
|
scripts/makeweb.py
|
||||||
|
|
||||||
[env:esp12e]
|
[env:esp12e]
|
||||||
platform = espressif8266@2.3.3
|
platform = espressif8266@2.5.1
|
||||||
board = esp12e
|
board = esp12e
|
||||||
framework = ${common.framework}
|
framework = ${common.framework}
|
||||||
lib_deps = ${common.lib_deps}
|
lib_deps = ${common.lib_deps}
|
||||||
@@ -27,7 +27,7 @@ extra_scripts =
|
|||||||
scripts/makeweb.py
|
scripts/makeweb.py
|
||||||
|
|
||||||
[env:d1mini]
|
[env:d1mini]
|
||||||
platform = espressif8266@2.3.3
|
platform = espressif8266@2.5.1
|
||||||
board = d1_mini
|
board = d1_mini
|
||||||
framework = ${common.framework}
|
framework = ${common.framework}
|
||||||
lib_deps = ${common.lib_deps}
|
lib_deps = ${common.lib_deps}
|
||||||
@@ -36,7 +36,7 @@ extra_scripts =
|
|||||||
scripts/makeweb.py
|
scripts/makeweb.py
|
||||||
|
|
||||||
[env:esp32]
|
[env:esp32]
|
||||||
platform = espressif32@1.11.2
|
platform = espressif32@1.12.1
|
||||||
board = esp32dev
|
board = esp32dev
|
||||||
framework = ${common.framework}
|
framework = ${common.framework}
|
||||||
lib_deps = ${common.lib_deps}
|
lib_deps = ${common.lib_deps}
|
||||||
@@ -45,7 +45,7 @@ extra_scripts =
|
|||||||
scripts/makeweb.py
|
scripts/makeweb.py
|
||||||
|
|
||||||
[env:lolind32]
|
[env:lolind32]
|
||||||
platform = espressif32@1.11.2
|
platform = espressif32@1.12.1
|
||||||
board = lolin_d32
|
board = lolin_d32
|
||||||
framework = ${common.framework}
|
framework = ${common.framework}
|
||||||
lib_deps = ${common.lib_deps}
|
lib_deps = ${common.lib_deps}
|
||||||
@@ -54,7 +54,7 @@ extra_scripts =
|
|||||||
scripts/makeweb.py
|
scripts/makeweb.py
|
||||||
|
|
||||||
[env:featheresp32]
|
[env:featheresp32]
|
||||||
platform = espressif32@1.11.2
|
platform = espressif32@1.12.1
|
||||||
board = featheresp32
|
board = featheresp32
|
||||||
framework = ${common.framework}
|
framework = ${common.framework}
|
||||||
lib_deps = ${common.lib_deps}
|
lib_deps = ${common.lib_deps}
|
||||||
@@ -63,7 +63,7 @@ extra_scripts =
|
|||||||
scripts/makeweb.py
|
scripts/makeweb.py
|
||||||
|
|
||||||
[env:az-delivery-devkit-v4]
|
[env:az-delivery-devkit-v4]
|
||||||
platform = espressif32@1.11.2
|
platform = espressif32@1.12.1
|
||||||
board = az-delivery-devkit-v4
|
board = az-delivery-devkit-v4
|
||||||
framework = ${common.framework}
|
framework = ${common.framework}
|
||||||
lib_deps = ${common.lib_deps}
|
lib_deps = ${common.lib_deps}
|
||||||
@@ -72,7 +72,7 @@ extra_scripts =
|
|||||||
scripts/makeweb.py
|
scripts/makeweb.py
|
||||||
|
|
||||||
[env:esp32doit-devkit-v1]
|
[env:esp32doit-devkit-v1]
|
||||||
platform = espressif32@1.11.2
|
platform = espressif32@1.12.1
|
||||||
board = esp32doit-devkit-v1
|
board = esp32doit-devkit-v1
|
||||||
framework = ${common.framework}
|
framework = ${common.framework}
|
||||||
lib_deps = ${common.lib_deps}
|
lib_deps = ${common.lib_deps}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ AmsData::AmsData(int meterType, bool substituteMissing, HanReader& hanReader) {
|
|||||||
extractFromAidon(hanReader, listSize, substituteMissing);
|
extractFromAidon(hanReader, listSize, substituteMissing);
|
||||||
break;
|
break;
|
||||||
case METER_TYPE_KAMSTRUP:
|
case METER_TYPE_KAMSTRUP:
|
||||||
extractFromKamstrup(hanReader, listSize);
|
extractFromKamstrup(hanReader, listSize, substituteMissing);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -176,13 +176,15 @@ void AmsData::extractFromAidon(HanReader& hanReader, int listSize, bool substitu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmsData::extractFromKamstrup(HanReader& hanReader, int listSize) {
|
void AmsData::extractFromKamstrup(HanReader& hanReader, int listSize, bool substituteMissing) {
|
||||||
switch(listSize) {
|
switch(listSize) {
|
||||||
|
case (int)Kamstrup::List3PhaseITShort:
|
||||||
case (int)Kamstrup::List3PhaseShort:
|
case (int)Kamstrup::List3PhaseShort:
|
||||||
threePhase = true;
|
threePhase = true;
|
||||||
case (int)Kamstrup::List1PhaseShort:
|
case (int)Kamstrup::List1PhaseShort:
|
||||||
listType = 2;
|
listType = 2;
|
||||||
break;
|
break;
|
||||||
|
case (int)Kamstrup::List3PhaseITLong:
|
||||||
case (int)Kamstrup::List3PhaseLong:
|
case (int)Kamstrup::List3PhaseLong:
|
||||||
threePhase = true;
|
threePhase = true;
|
||||||
case (int)Kamstrup::List1PhaseLong:
|
case (int)Kamstrup::List1PhaseLong:
|
||||||
@@ -191,6 +193,23 @@ void AmsData::extractFromKamstrup(HanReader& hanReader, int listSize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch(listSize) {
|
switch(listSize) {
|
||||||
|
case (int)Kamstrup::List1PhaseLong:
|
||||||
|
meterTimestamp = hanReader.getTime( (int)Kamstrup_List1Phase::MeterClock);
|
||||||
|
activeImportCounter = ((double) hanReader.getInt((int)Kamstrup_List1Phase::CumulativeActiveImportEnergy)) / 100;
|
||||||
|
activeExportCounter = ((double) hanReader.getInt((int)Kamstrup_List1Phase::CumulativeActiveExportEnergy)) / 100;
|
||||||
|
reactiveImportCounter = ((double) hanReader.getInt((int)Kamstrup_List1Phase::CumulativeReactiveImportEnergy)) / 100;
|
||||||
|
reactiveExportCounter = ((double) hanReader.getInt((int)Kamstrup_List1Phase::CumulativeReactiveExportEnergy)) / 100;
|
||||||
|
case (int)Kamstrup::List1PhaseShort:
|
||||||
|
listId = hanReader.getString( (int)Kamstrup_List1Phase::ListVersionIdentifier);
|
||||||
|
meterId = hanReader.getString( (int)Kamstrup_List1Phase::MeterID);
|
||||||
|
meterType = hanReader.getString( (int)Kamstrup_List1Phase::MeterType);
|
||||||
|
activeImportPower = hanReader.getInt( (int)Kamstrup_List1Phase::ActiveImportPower);
|
||||||
|
reactiveImportPower = hanReader.getInt( (int)Kamstrup_List1Phase::ReactiveImportPower);
|
||||||
|
activeExportPower = hanReader.getInt( (int)Kamstrup_List1Phase::ActiveExportPower);
|
||||||
|
reactiveExportPower = hanReader.getInt( (int)Kamstrup_List1Phase::ReactiveExportPower);
|
||||||
|
l1current = ((double) hanReader.getInt((int)Kamstrup_List1Phase::CurrentL1)) / 100;
|
||||||
|
l1voltage = hanReader.getInt( (int)Kamstrup_List1Phase::VoltageL1);
|
||||||
|
break;
|
||||||
case (int)Kamstrup::List3PhaseLong:
|
case (int)Kamstrup::List3PhaseLong:
|
||||||
meterTimestamp = hanReader.getTime( (int)Kamstrup_List3Phase::MeterClock);
|
meterTimestamp = hanReader.getTime( (int)Kamstrup_List3Phase::MeterClock);
|
||||||
activeImportCounter = ((double) hanReader.getInt((int)Kamstrup_List3Phase::CumulativeActiveImportEnergy)) / 100;
|
activeImportCounter = ((double) hanReader.getInt((int)Kamstrup_List3Phase::CumulativeActiveImportEnergy)) / 100;
|
||||||
@@ -212,22 +231,29 @@ void AmsData::extractFromKamstrup(HanReader& hanReader, int listSize) {
|
|||||||
l2voltage = hanReader.getInt( (int)Kamstrup_List3Phase::VoltageL2);
|
l2voltage = hanReader.getInt( (int)Kamstrup_List3Phase::VoltageL2);
|
||||||
l3voltage = hanReader.getInt( (int)Kamstrup_List3Phase::VoltageL3);
|
l3voltage = hanReader.getInt( (int)Kamstrup_List3Phase::VoltageL3);
|
||||||
break;
|
break;
|
||||||
case (int)Kamstrup::List1PhaseLong:
|
case (int)Kamstrup::List3PhaseITLong:
|
||||||
meterTimestamp = hanReader.getTime( (int)Kamstrup_List1Phase::MeterClock);
|
meterTimestamp = hanReader.getTime( (int)Kamstrup_List3Phase::MeterClock);
|
||||||
activeImportCounter = ((double) hanReader.getInt((int)Kamstrup_List1Phase::CumulativeActiveImportEnergy)) / 100;
|
activeImportCounter = ((double) hanReader.getInt((int)Kamstrup_List3Phase::CumulativeActiveImportEnergy)) / 100;
|
||||||
activeExportCounter = ((double) hanReader.getInt((int)Kamstrup_List1Phase::CumulativeActiveExportEnergy)) / 100;
|
activeExportCounter = ((double) hanReader.getInt((int)Kamstrup_List3Phase::CumulativeActiveExportEnergy)) / 100;
|
||||||
reactiveImportCounter = ((double) hanReader.getInt((int)Kamstrup_List1Phase::CumulativeReactiveImportEnergy)) / 100;
|
reactiveImportCounter = ((double) hanReader.getInt((int)Kamstrup_List3Phase::CumulativeReactiveImportEnergy)) / 100;
|
||||||
reactiveExportCounter = ((double) hanReader.getInt((int)Kamstrup_List1Phase::CumulativeReactiveExportEnergy)) / 100;
|
reactiveExportCounter = ((double) hanReader.getInt((int)Kamstrup_List3Phase::CumulativeReactiveExportEnergy)) / 100;
|
||||||
case (int)Kamstrup::List1PhaseShort:
|
case (int)Kamstrup::List3PhaseITShort:
|
||||||
listId = hanReader.getString( (int)Kamstrup_List1Phase::ListVersionIdentifier);
|
listId = hanReader.getString( (int)Kamstrup_List3Phase::ListVersionIdentifier);
|
||||||
meterId = hanReader.getString( (int)Kamstrup_List1Phase::MeterID);
|
meterId = hanReader.getString( (int)Kamstrup_List3Phase::MeterID);
|
||||||
meterType = hanReader.getString( (int)Kamstrup_List1Phase::MeterType);
|
meterType = hanReader.getString( (int)Kamstrup_List3Phase::MeterType);
|
||||||
activeImportPower = hanReader.getInt( (int)Kamstrup_List1Phase::ActiveImportPower);
|
activeImportPower = hanReader.getInt( (int)Kamstrup_List3Phase::ActiveImportPower);
|
||||||
reactiveImportPower = hanReader.getInt( (int)Kamstrup_List1Phase::ReactiveImportPower);
|
reactiveImportPower = hanReader.getInt( (int)Kamstrup_List3Phase::ReactiveImportPower);
|
||||||
activeExportPower = hanReader.getInt( (int)Kamstrup_List1Phase::ActiveExportPower);
|
activeExportPower = hanReader.getInt( (int)Kamstrup_List3Phase::ActiveExportPower);
|
||||||
reactiveExportPower = hanReader.getInt( (int)Kamstrup_List1Phase::ReactiveExportPower);
|
reactiveExportPower = hanReader.getInt( (int)Kamstrup_List3Phase::ReactiveExportPower);
|
||||||
l1current = ((double) hanReader.getInt((int)Kamstrup_List1Phase::CurrentL1)) / 100;
|
l1current = ((double) hanReader.getInt((int)Kamstrup_List3Phase::CurrentL1)) / 100;
|
||||||
l1voltage = hanReader.getInt( (int)Kamstrup_List1Phase::VoltageL1);
|
l2current = 0;
|
||||||
|
l3current = ((double) hanReader.getInt((int)Kamstrup_List3Phase::CurrentL3)) / 100;
|
||||||
|
l1voltage = hanReader.getInt( (int)Kamstrup_List3Phase::VoltageL1);
|
||||||
|
l2voltage = hanReader.getInt( (int)Kamstrup_List3Phase::VoltageL2);
|
||||||
|
l3voltage = hanReader.getInt( (int)Kamstrup_List3Phase::VoltageL3);
|
||||||
|
if(substituteMissing) {
|
||||||
|
l2current = ((activeImportPower * sqrt(3)) - (l1voltage * l1current) - (l3voltage * l3current)) / l2voltage;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ private:
|
|||||||
|
|
||||||
void extractFromKaifa(HanReader& hanReader, int listSize);
|
void extractFromKaifa(HanReader& hanReader, int listSize);
|
||||||
void extractFromAidon(HanReader& hanReader, int listSize, bool substituteMissing);
|
void extractFromAidon(HanReader& hanReader, int listSize, bool substituteMissing);
|
||||||
void extractFromKamstrup(HanReader& hanReader, int listSize);
|
void extractFromKamstrup(HanReader& hanReader, int listSize, bool substituteMissing);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -557,6 +557,14 @@ void AmsWebServer::handleSetup() {
|
|||||||
server.sendHeader("Location", String("/"), true);
|
server.sendHeader("Location", String("/"), true);
|
||||||
server.send (302, "text/plain", "");
|
server.send (302, "text/plain", "");
|
||||||
} else {
|
} else {
|
||||||
|
config->setLedPin(0xFF);
|
||||||
|
config->setLedPinRed(0xFF);
|
||||||
|
config->setLedPinGreen(0xFF);
|
||||||
|
config->setLedPinBlue(0xFF);
|
||||||
|
config->setApPin(0xFF);
|
||||||
|
config->setTempSensorPin(0xFF);
|
||||||
|
config->setVccPin(0xFF);
|
||||||
|
|
||||||
config->setBoardType(server.arg("board").toInt());
|
config->setBoardType(server.arg("board").toInt());
|
||||||
config->setVccMultiplier(1.0);
|
config->setVccMultiplier(1.0);
|
||||||
config->setVccBootLimit(0);
|
config->setVccBootLimit(0);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ $(function() {
|
|||||||
// For config-meter
|
// For config-meter
|
||||||
$('.subtitute-dependent').on('change', function() {
|
$('.subtitute-dependent').on('change', function() {
|
||||||
console.log("test");
|
console.log("test");
|
||||||
if($('#meterType').val() == 2 && $('#distributionSystem').val() == 1) {
|
if(($('#meterType').val() == 2 || $('#meterType').val() == 3) && $('#distributionSystem').val() == 1) {
|
||||||
$('#substitute').show();
|
$('#substitute').show();
|
||||||
} else {
|
} else {
|
||||||
$('#substitute').hide();
|
$('#substitute').hide();
|
||||||
|
|||||||
Reference in New Issue
Block a user