Skip to content

Commit

Permalink
Some changes for DLMS
Browse files Browse the repository at this point in the history
  • Loading branch information
gskjold committed Nov 16, 2023
1 parent 76d7684 commit 56b6a72
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 38 deletions.
2 changes: 2 additions & 0 deletions lib/AmsData/include/OBIScodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ struct OBIS_t {

const OBIS_code_t OBIS_NULL PROGMEM = { 0, 0, 0 };

const OBIS_code_t OBIS_FIRMWARE_VERSION PROGMEM = { 0, 2, 0 };

const OBIS_code_t OBIS_VERSION PROGMEM = { 0, 2, 129 };
const OBIS_code_t OBIS_METER_MODEL PROGMEM = { 96, 1, 1 };
const OBIS_code_t OBIS_METER_MODEL_2 PROGMEM = { 96, 1, 7 };
Expand Down
32 changes: 12 additions & 20 deletions lib/SvelteUi/app/dist/index.js

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions lib/SvelteUi/app/src/App.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/

<script>
import { Router, Route, navigate } from "svelte-navigator";
import { getSysinfo, sysinfoStore, dataStore } from './lib/DataStores.js';
Expand Down
19 changes: 11 additions & 8 deletions src/KamstrupPullCommunicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down Expand Up @@ -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 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 1: obis.code = OBIS_FIRMWARE_VERSION; break;
case 2: obis.code = OBIS_METER_MODEL; break;
case 3: obis.code = OBIS_METER_ID; 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;
}
Expand Down
8 changes: 4 additions & 4 deletions src/KamstrupPullCommunicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ class KamstrupPullCommunicator : public PassiveMeterCommunicator {
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);
Expand Down

0 comments on commit 56b6a72

Please sign in to comment.