Some changes for DLMS

This commit is contained in:
Gunnar Skjold
2023-11-16 20:43:47 +01:00
parent 76d76844a9
commit 56b6a720c9
5 changed files with 27 additions and 36 deletions

View File

@@ -263,7 +263,9 @@ AmsData* KamstrupPullCommunicator::getData(AmsData& meterState) {
}
if(hanBuffer[11] == DATA_TAG_RES) {
if(obisPosition == 1) { // Meter model string
if(obisPosition == 1) { // Version string
debugger->printf_P(PSTR("RECEIVED Firmware version\n"));
} else if(obisPosition == 1) { // Meter model string
debugger->printf_P(PSTR("RECEIVED Meter model\n"));
} else { // All other uint32
uint32_t value = ntohl(*((uint32_t*) (hanBuffer + 16)));
@@ -603,13 +605,14 @@ bool KamstrupPullCommunicator::requestData() {
OBIS_t obis = {1,1,OBIS_NULL,OBIS_RANGE_NA};
switch(obisPosition) {
case 1: obis.code = OBIS_METER_MODEL; break;
case 2: obis.code = OBIS_METER_ID; break;
case 1: obis.code = OBIS_FIRMWARE_VERSION; break;
case 2: obis.code = OBIS_METER_MODEL; break;
case 3: obis.code = OBIS_METER_ID; break;
case 3: obis.code = OBIS_ACTIVE_IMPORT; break;
case 4: obis.code = OBIS_REACTIVE_IMPORT; break;
case 5: obis.code = OBIS_ACTIVE_EXPORT; break;
case 6: obis.code = OBIS_REACTIVE_EXPORT; break;
case 4: obis.code = OBIS_ACTIVE_IMPORT; break;
case 5: obis.code = OBIS_REACTIVE_IMPORT; break;
case 6: obis.code = OBIS_ACTIVE_EXPORT; break;
case 7: obis.code = OBIS_REACTIVE_EXPORT; break;
default:
obisPosition = 0; return false;
}

View File

@@ -59,10 +59,10 @@ private:
uint8_t state = STATE_DISCONNECTED;
uint64_t lastLoop = 0;
uint64_t lastMessageTime = 0;
String passkey = "12345";
uint8_t clientSap = 0x25;
uint8_t serverSap = 0x21;
uint8_t obisPosition = 2;
String passkey = "";
uint8_t clientSap = 0x21;
uint8_t serverSap = 0x03;
uint8_t obisPosition = 0;
OBIS_code_t currentObis = OBIS_NULL;
void setupHanPort(uint32_t baud, uint8_t parityOrdinal, bool invert);