Add Shelly3EM Neutral Current information

This commit is contained in:
Theo Arends 2022-03-26 16:02:50 +01:00
parent 1108bc255c
commit fc8b4dcc71
29 changed files with 71 additions and 1 deletions

View File

@ -55,6 +55,7 @@
#define D_JSON_COUNT "Count"
#define D_JSON_COUNTER "Counter"
#define D_JSON_CURRENT "Current" // As in Voltage and Current
#define D_JSON_CURRENT_NEUTRAL "CurrentNeutral"
#define D_JSON_DARKNESS "Darkness"
#define D_JSON_DATA "Data"
#define D_JSON_DEWPOINT "DewPoint"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Opnemer"
#define D_CT_POWER "CT Power"
#define D_CURRENT "Stroom" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Data"
#define D_DARKLIGHT "Donker"
#define D_DEBUG "Ontfout"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Брояч"
#define D_CT_POWER "CT Power"
#define D_CURRENT "Ток" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Данни"
#define D_DARKLIGHT "Тъмна"
#define D_DEBUG "Дебъгване"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Počítadlo"
#define D_CT_POWER "CT Power"
#define D_CURRENT "Proud" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Data"
#define D_DARKLIGHT "Tmavý"
#define D_DEBUG "Debug"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Zähler"
#define D_CT_POWER "CT Power"
#define D_CURRENT "Strom" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Daten"
#define D_DARKLIGHT "dunkel"
#define D_DEBUG "debug"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Μετρητής"
#define D_CT_POWER "CT Power"
#define D_CURRENT "Ένταση" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Δεδομένα"
#define D_DARKLIGHT "Σκοτεινό"
#define D_DEBUG "Debug"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Counter"
#define D_CT_POWER "CT Power"
#define D_CURRENT "Current" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Data"
#define D_DARKLIGHT "Dark"
#define D_DEBUG "Debug"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Contador"
#define D_CT_POWER "CT Power"
#define D_CURRENT "Corriente" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Datos"
#define D_DARKLIGHT "Oscuro"
#define D_DEBUG "Debug"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Compteur"
#define D_CT_POWER "CT Power"
#define D_CURRENT "Courant" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Donnée"
#define D_DARKLIGHT "Sombre"
#define D_DEBUG "Debug"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Teller"
#define D_CT_POWER "CT Power"
#define D_CURRENT "Streame" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Data"
#define D_DARKLIGHT "Tsjuster"
#define D_DEBUG "Debugearje"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "מונה"
#define D_CT_POWER "CT Power"
#define D_CURRENT "נוכחי" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "נתונים"
#define D_DARKLIGHT "חושך"
#define D_DEBUG "באגים"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Számláló"
#define D_CT_POWER "CT erősség"
#define D_CURRENT "Áramerősség" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Adat"
#define D_DARKLIGHT "Min. fényerő"
#define D_DEBUG "Debug"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Contatore"
#define D_CT_POWER "Alimentazione CT"
#define D_CURRENT "Corrente" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Corrente Neutrale"
#define D_DATA "Dati"
#define D_DARKLIGHT "Scuro"
#define D_DEBUG "Debug"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Counter"
#define D_CT_POWER "CT Power"
#define D_CURRENT "전류" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Data"
#define D_DARKLIGHT "어둡게"
#define D_DEBUG "디버그"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Teller"
#define D_CT_POWER "CT Power"
#define D_CURRENT "Stroom" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Data"
#define D_DARKLIGHT "Donker"
#define D_DEBUG "Debug"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Licznik"
#define D_CT_POWER "Moc CT"
#define D_CURRENT "Prąd" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Data"
#define D_DARKLIGHT "Ciemny"
#define D_DEBUG "Debug"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Contador"
#define D_CT_POWER "Carga CT"
#define D_CURRENT "Corrente" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Dados"
#define D_DARKLIGHT "Luz escura"
#define D_DEBUG "Depurar"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Contador"
#define D_CT_POWER "CT Power"
#define D_CURRENT "Corrente" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Dados"
#define D_DARKLIGHT "Luz Escura"
#define D_DEBUG "Depurar"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Contor"
#define D_CT_POWER "Putere Transformată"
#define D_CURRENT "Curent" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Date"
#define D_DARKLIGHT "Întunecat"
#define D_DEBUG "Depanare"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Счетчик"
#define D_CT_POWER "CT Power"
#define D_CURRENT "Ток" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Данные"
#define D_DARKLIGHT "Темный"
#define D_DEBUG "Отладка"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Počítadlo"
#define D_CT_POWER "CT Power"
#define D_CURRENT "Prúd" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Dáta"
#define D_FLOW_RATE "Flow rate"
#define D_DARKLIGHT "Tmavý"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Räknare"
#define D_CT_POWER "CT Power"
#define D_CURRENT "Ström" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Data"
#define D_DARKLIGHT "Mörkt"
#define D_DEBUG "Debug"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Sayaç"
#define D_CT_POWER "CT Power"
#define D_CURRENT "Current" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Data"
#define D_DARKLIGHT "Karanlık"
#define D_DEBUG "Hata Ayıklama"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Лічильник"
#define D_CT_POWER "CT Power"
#define D_CURRENT "Струм" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Дані"
#define D_DARKLIGHT "Темний"
#define D_DEBUG "Налагодження"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Bộ đếm"
#define D_CT_POWER "CT Power"
#define D_CURRENT "Dòng điện" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "Dữ liệu"
#define D_DARKLIGHT "Tối"
#define D_DEBUG "Tìm lỗi"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "计数器"
#define D_CT_POWER "CT Power"
#define D_CURRENT "电流" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "数据:"
#define D_DARKLIGHT "暗"
#define D_DEBUG "调试"

View File

@ -77,6 +77,7 @@
#define D_COUNTER "Counter"
#define D_CT_POWER "CT Power"
#define D_CURRENT "電流" // As in Voltage and Current
#define D_CURRENT_NEUTRAL "Current Neutral"
#define D_DATA "數據:"
#define D_DARKLIGHT "暗光"
#define D_DEBUG "偵錯"

View File

@ -853,8 +853,8 @@ void CmndModuleAddress(void) {
void CmndEnergyConfig(void) {
Energy.command_code = CMND_ENERGYCONFIG;
ResponseClear();
if (XnrgCall(FUNC_COMMAND)) {
ResponseClear();
if (!ResponseLength()) {
ResponseCmndDone();
}

View File

@ -36,6 +36,8 @@
/*********************************************************************************************/
#define ADE7880_MORE_REGS // Add Neutral Current information
//#define ADE7880_DEBUG
//#define ADE7880_PROFILING
@ -252,6 +254,7 @@ enum Ade7880PowerQualityRegisters {
};
struct Ade7880 {
float neutral_current;
int32_t calib_current[4];
int32_t calib_voltage[3];
int32_t calib_acpower[3];
@ -483,6 +486,7 @@ void Ade7880Cycle(void) {
Ade7880.cycle_count--;
return; // Skip first cycles
}
Ade7880.neutral_current = (float)Ade7880ReadVerify(ADE7880_NIRMS) / 100000; // 0x43C6
for (uint32_t phase = 0; phase < 3; phase++) {
Energy.data_valid[phase] = 0;
Energy.voltage[phase] = (float)Ade7880ReadVerify(ADE7880_AVRMS + (phase * 2)) / 10000; // 0x43C1 - 0x0024CC94 = 241.1668 V
@ -681,6 +685,29 @@ bool Ade7880Command(void) {
return serviced;
}
/*********************************************************************************************\
* Show
\*********************************************************************************************/
#ifdef ADE7880_MORE_REGS
#ifdef USE_WEBSERVER
const char HTTP_ADE7880_CURRENT[] PROGMEM = "{s}" D_CURRENT_NEUTRAL "{m}%s " D_UNIT_AMPERE "{e}";
#endif // USE_WEBSERVER
void Ade7880Show(bool json) {
char value_chr[TOPSZ];
if (json) {
ResponseAppend_P(PSTR(",\"" D_JSON_CURRENT_NEUTRAL "\":%s"),
EnergyFormat(value_chr, &Ade7880.neutral_current, Settings->flag2.current_resolution, 1));
#ifdef USE_WEBSERVER
} else {
WSContentSend_PD(HTTP_ADE7880_CURRENT, WebEnergyFormat(value_chr, &Ade7880.neutral_current, Settings->flag2.current_resolution, 1));
#endif // USE_WEBSERVER
}
}
#endif // ADE7880_MORE_REGS
/*********************************************************************************************\
* Interface
\*********************************************************************************************/
@ -694,6 +721,22 @@ bool Xnrg23(uint8_t function) {
case FUNC_LOOP:
if (Ade7880.irq0_state) { Ade7880Service0(); }
break;
#ifdef ADE7880_MORE_REGS
case FUNC_JSON_APPEND:
Ade7880Show(1);
break;
#ifdef USE_WEBSERVER
#ifdef USE_ENERGY_COLUMN_GUI
case FUNC_WEB_COL_SENSOR:
Ade7880Show(0);
break;
#else // not USE_ENERGY_COLUMN_GUI
case FUNC_WEB_SENSOR:
Ade7880Show(0);
break;
#endif // USE_ENERGY_COLUMN_GUI
#endif // USE_WEBSERVER
#endif // ADE7880_MORE_REGS
case FUNC_COMMAND:
result = Ade7880Command();
break;