Skip to content

Commit

Permalink
v1.1.3 SM_HAS_NO_FASE_INFO is nu een setting
Browse files Browse the repository at this point in the history
  • Loading branch information
mrWheel committed Mar 31, 2020
1 parent 2d39ab3 commit 59e27b9
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 112 deletions.
3 changes: 2 additions & 1 deletion DSMRloggerAPI.h
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : DSMRloggerAPI.h - definitions for DSMRloggerAPI
** Version : v1.1.2
** Version : v1.1.3
**
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down Expand Up @@ -227,6 +227,7 @@ IPAddress ipDNS, ipGateWay, ipSubnet;
float settingEDT1, settingEDT2, settingERT1, settingERT2, settingGDT;
float settingENBK, settingGNBK;
uint8_t settingTelegramInterval;
uint8_t settingSmHasFaseInfo = 1;
char settingHostname[30];
char settingIndexPage[50];
char settingMQTTbroker[101], settingMQTTuser[40], settingMQTTpasswd[30], settingMQTTtopTopic[21];
Expand Down
7 changes: 3 additions & 4 deletions DSMRloggerAPI.ino
Expand Up @@ -2,7 +2,7 @@
***************************************************************************
** Program : DSMRloggerAPI (restAPI)
*/
#define _FW_VERSION "v1.1.2 (29-03-2020)"
#define _FW_VERSION "v1.1.3 (30-03-2020)"
/*
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down Expand Up @@ -36,12 +36,11 @@
/******************** compiler options ********************************************/
#define USE_REQUEST_PIN // define if it's a esp8266 with GPIO 12 connected to SM DTR pin
#define USE_UPDATE_SERVER // define if there is enough memory and updateServer to be used
#define HAS_OLED_SSD1306 // define if a 0.96" OLED display is present
// #define HAS_OLED_SH1106 // define if a 1.3" OLED display is present
//#define HAS_OLED_SSD1306 // define if a 0.96" OLED display is present
#define HAS_OLED_SH1106 // define if a 1.3" OLED display is present
// #define USE_BELGIUM_PROTOCOL // define if Slimme Meter is a Belgium Smart Meter
// #define USE_PRE40_PROTOCOL // define if Slimme Meter is pre DSMR 4.0 (2.2 .. 3.0)
// #define USE_NTP_TIME // define to generate Timestamp from NTP (Only Winter Time for now)
// #define SM_HAS_NO_FASE_INFO // if your SM does not give fase info use total delivered/returned
// #define HAS_NO_SLIMMEMETER // define for testing only!
#define USE_MQTT // define if you want to use MQTT (configure through webinterface)
#define USE_MINDERGAS // define if you want to update mindergas (configure through webinterface)
Expand Down
87 changes: 53 additions & 34 deletions data/DSMRindex.js
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : DSMRindex.js, part of DSMRfirmwareAPI
** Version : v1.1.2
** Version : v1.1.3
**
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down Expand Up @@ -37,7 +37,7 @@

var data = [];

var longFieldsMain = [ "identification","p1_version","timestamp","equipment_id"
var longFields = [ "identification","p1_version","timestamp","equipment_id"
,"energy_delivered_tariff1","energy_delivered_tariff2"
,"energy_returned_tariff1","energy_returned_tariff2","electricity_tariff"
,"power_delivered","power_returned"
Expand All @@ -57,10 +57,23 @@
,"water_valve_position","water_delivered"
,"slave_device_type","slave_equipment_id"
,"slave_valve_position","slave_delivered"
,"ed_tariff1","ed_tariff2"
,"er_tariff1","er_tariff2"
,"gd_tariff","electr_netw_costs"
,"gas_netw_costs"
,"smhasfaseinfo", "sm_has_fase_info"
,"oled_flip_screen"
,"tlgrm_interval","telegraminterval"
,"index_page"
,"oled_screen_time"
,"mqttbroker","mqttbrokerport"
,"mqttuser","mqttpasswd","mqtttoptopic"
,"mqttinterval","mqttbroker_connected"
,"mindergas_token"
,"\0"
];
var humanFieldsMain = [ "Slimme Meter ID","P1 Versie","timestamp","Equipment ID"
];

var humanFields = [ "Slimme Meter ID","P1 Versie","timestamp","Equipment ID"
,"Energie Gebruikt tarief 1","Energie Gebruikt tarief 2"
,"Energie Opgewekt tarief 1","Energie Opgewekt tarief 2","Electriciteit tarief"
,"Vermogen Gebruikt","Vermogen Opgewekt"
Expand All @@ -80,16 +93,35 @@
,"water_valve_position","water_delivered"
,"slave_device_type","slave_equipment_id"
,"slave_valve_position","slave_delivered"
,"Energy Verbruik Tarief-1/kWh","Energy Verbruik Tarief-2/kWh"
,"Energy Opgewekt Tarief-1/kWh","Energy Opgewekt Tarief-2/kWh"
,"Gas Verbruik Tarief/m3","Netwerkkosten Energie/maand"
,"Netwerkkosten Gas/maand"
,"SM Has Fase Info (0=No, 1=Yes)","SM Has Fase Info (0=No, 1=Yes)"
,"Flip OLED scherm (0=No, 1=Yes)"
,"Telegram Lees Interval (Sec.)"
,"Telegram Lees Interval (Sec.)"
,"Te Gebruiken index.html Pagina"
,"Oled Screen Time (Min., 0=infinite)"
,"MQTT Broker IP/URL","MQTT Broker Poort"
,"MQTT Gebruiker","Password MQTT Gebruiker"
,"MQTT Top Topic"
,"Verzend MQTT Berichten (Sec.)"
,"MQTT broker connected"
,"Mindergas Token"
,"\0"
];
];

let monthType = "ED";
let settingBgColor = 'deepskyblue';
let settingFontColor = 'white'

var longFieldsSettings = [ "ed_tariff1","ed_tariff2"
,"er_tariff1","er_tariff2"
,"gd_tariff","electr_netw_costs"
,"gas_netw_costs","tlgrm_interval","index_page"
,"gas_netw_costs","smhasfaseinfo"
,"tlgrm_interval"
,"index_page"
,"oled_screen_time"
,"mqtt_broker","mqtt_broker_port"
,"mqtt_user","mqtt_passwd","mqtt_toptopic"
Expand All @@ -100,7 +132,8 @@
var humanFieldsSettings = [ "Energy Verbruik Tarief-1/kWh","Energy Verbruik Tarief-2/kWh"
,"Energy Opgewekt Tarief-1/kWh","Energy Opgewekt Tarief-2/kWh"
,"Gas Verbruik Tarief/m3","Netwerkkosten Energie/maand"
,"Netwerkkosten Gas/maand","Telegram Lees Interval (Sec.)"
,"Netwerkkosten Gas/maand","SM Has Fase Info (1=Yes, 0=No)"
,"Telegram Lees Interval (Sec.)"
,"Te Gebruiken index.html Pagina"
,"Oled Screen Time (Min., 0=infinite)"
,"MQTT Broker IP/URL","MQTT Broker Poort"
Expand Down Expand Up @@ -338,7 +371,8 @@
for( let i in data )
{
var tableRef = document.getElementById('devInfoTable').getElementsByTagName('tbody')[0];

data[i].shortName = longToHuman(data[i].name);

if( ( document.getElementById("devInfoTable_"+data[i].name)) == null )
{
//console.log("data["+i+"] => name["+data[i].name+"]");
Expand All @@ -354,7 +388,8 @@
newCell.appendChild(newText);
}
tableCells = document.getElementById("devInfoTable_"+data[i].name).cells;
tableCells[0].innerHTML = data[i].name;
//tableCells[0].innerHTML = data[i].name;
tableCells[0].innerHTML = data[i].shortName;
tableCells[1].innerHTML = data[i].value;
if (data[i].hasOwnProperty('unit'))
{
Expand Down Expand Up @@ -467,7 +502,7 @@
data = json.fields;
for (var i in data)
{
data[i].shortName = smToHuman(data[i].name);
data[i].shortName = longToHuman(data[i].name);
var tableRef = document.getElementById('fieldsTable').getElementsByTagName('tbody')[0];
if( ( document.getElementById("fieldsTable_"+data[i].name)) == null )
{
Expand Down Expand Up @@ -704,7 +739,7 @@

for (var i in data)
{
data[i].shortName = smToHuman(data[i].name);
data[i].shortName = longToHuman(data[i].name);
var tableRef = document.getElementById('actualTable').getElementsByTagName('tbody')[0];
if( ( document.getElementById("actualTable_"+data[i].name)) == null )
{
Expand Down Expand Up @@ -1256,7 +1291,7 @@ http://DSMR-API.local/api/v1/dev/settings</pre>", false);
fldDiv.setAttribute("style", "margin-right: 10px;");
fldDiv.style.width = "250px";
fldDiv.style.float = 'left';
fldDiv.textContent = smToHuman(data[i].name);
fldDiv.textContent = longToHuman(data[i].name);
rowDiv.appendChild(fldDiv);
//--- input ---
var inputDiv = document.createElement("div");
Expand Down Expand Up @@ -1914,33 +1949,17 @@ http://DSMR-API.local/api/v1/dev/settings</pre>", false);


//============================================================================
function smToHuman(longName) {
//console.log("smToHuman("+longName+") for ["+longFieldsSettings.length+"] elements");
for(var index = 0; index < (longFieldsSettings.length -1); index++)
{
if (longFieldsSettings[index] == longName)
{
return humanFieldsSettings[index];
}
};
return longName;

} // smToHuman()


//============================================================================
function smToHuman(longName) {
//console.log("smToHuman("+longName+") for ["+longFieldsMain.length+"] elements");
for(var index = 0; index < (longFieldsMain.length -1); index++)
function longToHuman(longName) {
for(var index = 0; index < (longFields.length -1); index++)
{
if (longFieldsMain[index] == longName)
if (longFields[index] == longName)
{
return humanFieldsMain[index];
return humanFields[index];
}
};
return longName;

} // smToHuman()
} // longToHuman()


//============================================================================
Expand Down
87 changes: 53 additions & 34 deletions edge/DSMRindex.js
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : DSMRindex.js, part of DSMRfirmwareAPI
** Version : v1.1.2
** Version : v1.1.3
**
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down Expand Up @@ -37,7 +37,7 @@

var data = [];

var longFieldsMain = [ "identification","p1_version","timestamp","equipment_id"
var longFields = [ "identification","p1_version","timestamp","equipment_id"
,"energy_delivered_tariff1","energy_delivered_tariff2"
,"energy_returned_tariff1","energy_returned_tariff2","electricity_tariff"
,"power_delivered","power_returned"
Expand All @@ -57,10 +57,23 @@
,"water_valve_position","water_delivered"
,"slave_device_type","slave_equipment_id"
,"slave_valve_position","slave_delivered"
,"ed_tariff1","ed_tariff2"
,"er_tariff1","er_tariff2"
,"gd_tariff","electr_netw_costs"
,"gas_netw_costs"
,"smhasfaseinfo", "sm_has_fase_info"
,"oled_flip_screen"
,"tlgrm_interval","telegraminterval"
,"index_page"
,"oled_screen_time"
,"mqttbroker","mqttbrokerport"
,"mqttuser","mqttpasswd","mqtttoptopic"
,"mqttinterval","mqttbroker_connected"
,"mindergas_token"
,"\0"
];
var humanFieldsMain = [ "Slimme Meter ID","P1 Versie","timestamp","Equipment ID"
];

var humanFields = [ "Slimme Meter ID","P1 Versie","timestamp","Equipment ID"
,"Energie Gebruikt tarief 1","Energie Gebruikt tarief 2"
,"Energie Opgewekt tarief 1","Energie Opgewekt tarief 2","Electriciteit tarief"
,"Vermogen Gebruikt","Vermogen Opgewekt"
Expand All @@ -80,16 +93,35 @@
,"water_valve_position","water_delivered"
,"slave_device_type","slave_equipment_id"
,"slave_valve_position","slave_delivered"
,"Energy Verbruik Tarief-1/kWh","Energy Verbruik Tarief-2/kWh"
,"Energy Opgewekt Tarief-1/kWh","Energy Opgewekt Tarief-2/kWh"
,"Gas Verbruik Tarief/m3","Netwerkkosten Energie/maand"
,"Netwerkkosten Gas/maand"
,"SM Has Fase Info (0=No, 1=Yes)","SM Has Fase Info (0=No, 1=Yes)"
,"Flip OLED scherm (0=No, 1=Yes)"
,"Telegram Lees Interval (Sec.)"
,"Telegram Lees Interval (Sec.)"
,"Te Gebruiken index.html Pagina"
,"Oled Screen Time (Min., 0=infinite)"
,"MQTT Broker IP/URL","MQTT Broker Poort"
,"MQTT Gebruiker","Password MQTT Gebruiker"
,"MQTT Top Topic"
,"Verzend MQTT Berichten (Sec.)"
,"MQTT broker connected"
,"Mindergas Token"
,"\0"
];
];

let monthType = "ED";
let settingBgColor = 'deepskyblue';
let settingFontColor = 'white'

var longFieldsSettings = [ "ed_tariff1","ed_tariff2"
,"er_tariff1","er_tariff2"
,"gd_tariff","electr_netw_costs"
,"gas_netw_costs","tlgrm_interval","index_page"
,"gas_netw_costs","smhasfaseinfo"
,"tlgrm_interval"
,"index_page"
,"oled_screen_time"
,"mqtt_broker","mqtt_broker_port"
,"mqtt_user","mqtt_passwd","mqtt_toptopic"
Expand All @@ -100,7 +132,8 @@
var humanFieldsSettings = [ "Energy Verbruik Tarief-1/kWh","Energy Verbruik Tarief-2/kWh"
,"Energy Opgewekt Tarief-1/kWh","Energy Opgewekt Tarief-2/kWh"
,"Gas Verbruik Tarief/m3","Netwerkkosten Energie/maand"
,"Netwerkkosten Gas/maand","Telegram Lees Interval (Sec.)"
,"Netwerkkosten Gas/maand","SM Has Fase Info (1=Yes, 0=No)"
,"Telegram Lees Interval (Sec.)"
,"Te Gebruiken index.html Pagina"
,"Oled Screen Time (Min., 0=infinite)"
,"MQTT Broker IP/URL","MQTT Broker Poort"
Expand Down Expand Up @@ -338,7 +371,8 @@
for( let i in data )
{
var tableRef = document.getElementById('devInfoTable').getElementsByTagName('tbody')[0];

data[i].shortName = longToHuman(data[i].name);

if( ( document.getElementById("devInfoTable_"+data[i].name)) == null )
{
//console.log("data["+i+"] => name["+data[i].name+"]");
Expand All @@ -354,7 +388,8 @@
newCell.appendChild(newText);
}
tableCells = document.getElementById("devInfoTable_"+data[i].name).cells;
tableCells[0].innerHTML = data[i].name;
//tableCells[0].innerHTML = data[i].name;
tableCells[0].innerHTML = data[i].shortName;
tableCells[1].innerHTML = data[i].value;
if (data[i].hasOwnProperty('unit'))
{
Expand Down Expand Up @@ -467,7 +502,7 @@
data = json.fields;
for (var i in data)
{
data[i].shortName = smToHuman(data[i].name);
data[i].shortName = longToHuman(data[i].name);
var tableRef = document.getElementById('fieldsTable').getElementsByTagName('tbody')[0];
if( ( document.getElementById("fieldsTable_"+data[i].name)) == null )
{
Expand Down Expand Up @@ -704,7 +739,7 @@

for (var i in data)
{
data[i].shortName = smToHuman(data[i].name);
data[i].shortName = longToHuman(data[i].name);
var tableRef = document.getElementById('actualTable').getElementsByTagName('tbody')[0];
if( ( document.getElementById("actualTable_"+data[i].name)) == null )
{
Expand Down Expand Up @@ -1256,7 +1291,7 @@ http://DSMR-API.local/api/v1/dev/settings</pre>", false);
fldDiv.setAttribute("style", "margin-right: 10px;");
fldDiv.style.width = "250px";
fldDiv.style.float = 'left';
fldDiv.textContent = smToHuman(data[i].name);
fldDiv.textContent = longToHuman(data[i].name);
rowDiv.appendChild(fldDiv);
//--- input ---
var inputDiv = document.createElement("div");
Expand Down Expand Up @@ -1914,33 +1949,17 @@ http://DSMR-API.local/api/v1/dev/settings</pre>", false);


//============================================================================
function smToHuman(longName) {
//console.log("smToHuman("+longName+") for ["+longFieldsSettings.length+"] elements");
for(var index = 0; index < (longFieldsSettings.length -1); index++)
{
if (longFieldsSettings[index] == longName)
{
return humanFieldsSettings[index];
}
};
return longName;

} // smToHuman()


//============================================================================
function smToHuman(longName) {
//console.log("smToHuman("+longName+") for ["+longFieldsMain.length+"] elements");
for(var index = 0; index < (longFieldsMain.length -1); index++)
function longToHuman(longName) {
for(var index = 0; index < (longFields.length -1); index++)
{
if (longFieldsMain[index] == longName)
if (longFields[index] == longName)
{
return humanFieldsMain[index];
return humanFields[index];
}
};
return longName;

} // smToHuman()
} // longToHuman()


//============================================================================
Expand Down

0 comments on commit 59e27b9

Please sign in to comment.