diff --git a/code/espurna/emon.ino b/code/espurna/emon.ino index 7b9eabf0..20d40a28 100644 --- a/code/espurna/emon.ino +++ b/code/espurna/emon.ino @@ -158,8 +158,8 @@ void powerMonitorLoop() { snprintf(power, 6, "%d", _power); double energy_inc = (double) _power * EMON_INTERVAL * EMON_MEASUREMENTS / 1000.0 / 3600.0; - char energy_buf[10]; - dtostrf(energy_inc, 9, 2, energy_buf); + char energy_buf[11]; + dtostrf(energy_inc, 11, 3, energy_buf); char *e = energy_buf; while ((unsigned char) *e == ' ') ++e; @@ -171,6 +171,12 @@ void powerMonitorLoop() { char buffer[20]; snprintf(buffer, 20, "%s;%s", power, e); domoticzSend("dczPowIdx", 0, buffer); + snprintf(buffer, 20, "%s", e); + domoticzSend("dczEnergyIdx", 0, buffer); + snprintf(buffer, 20, "%d", voltage); + domoticzSend("dczVoltIdx", 0, buffer); + snprintf(buffer, 20, "%s", String(current).c_str()); + domoticzSend("dczCurrentIdx", 0, buffer); } #endif diff --git a/code/espurna/pow.ino b/code/espurna/pow.ino index 955352d8..450dcecb 100644 --- a/code/espurna/pow.ino +++ b/code/espurna/pow.ino @@ -219,8 +219,8 @@ void powLoop() { if (factor > 100) factor = 100; double energy_inc = (double) power * POW_REPORT_EVERY * POW_UPDATE_INTERVAL / 1000.0 / 3600.0; - char energy_buf[10]; - dtostrf(energy_inc, 9, 2, energy_buf); + char energy_buf[11]; + dtostrf(energy_inc, 11, 3, energy_buf); char *e = energy_buf; while ((unsigned char) *e == ' ') ++e; @@ -237,8 +237,12 @@ void powLoop() { char buffer[20]; snprintf(buffer, 20, "%d;%s", power, e); domoticzSend("dczPowIdx", 0, buffer); + snprintf(buffer, 20, "%s", e); + domoticzSend("dczEnergyIdx", 0, buffer); snprintf(buffer, 20, "%d", voltage); domoticzSend("dczVoltIdx", 0, buffer); + snprintf(buffer, 20, "%s", String(current).c_str()); + domoticzSend("dczCurrentIdx", 0, buffer); } #endif diff --git a/code/espurna/web.ino b/code/espurna/web.ino index 398da69b..3dafb0b1 100644 --- a/code/espurna/web.ino +++ b/code/espurna/web.ino @@ -350,11 +350,16 @@ void _wsStart(uint32_t client_id) { #if ENABLE_EMON root["dczPowIdx"] = getSetting("dczPowIdx").toInt(); + root["dczEnergyIdx"] = getSetting("dczEnergyIdx").toInt(); + root["dczVoltIdx"] = getSetting("dczVoltIdx").toInt(); + root["dczCurrentIdx"] = getSetting("dczCurrentIdx").toInt(); #endif #if ENABLE_POW root["dczPowIdx"] = getSetting("dczPowIdx").toInt(); + root["dczEnergyIdx"] = getSetting("dczEnergyIdx").toInt(); root["dczVoltIdx"] = getSetting("dczVoltIdx").toInt(); + root["dczCurrentIdx"] = getSetting("dczCurrentIdx").toInt(); #endif #endif diff --git a/code/html/index.html b/code/html/index.html index 116a6df7..a83d3436 100644 --- a/code/html/index.html +++ b/code/html/index.html @@ -409,9 +409,21 @@
Set to 0 to disable notifications.
-
+
+ +
+
Set to 0 to disable notifications.
+
+ +
-
+
+
Set to 0 to disable notifications.
+
+ +
+ +
Set to 0 to disable notifications.
diff --git a/code/platformio.ini b/code/platformio.ini index 26c803ae..0a9f665e 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -109,6 +109,18 @@ lib_ignore = ${common.lib_ignore} extra_script = pio_hooks.py build_flags = -g -Wl,-Tesp8266.flash.1m128.ld -DDEBUG_PORT=Serial -DSONOFF -DENABLE_DS18B20=1 +[env:sonoff-ds18b20-debug-ota] +platform = espressif8266 +framework = arduino +board = esp01_1m +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +extra_script = pio_hooks.py +build_flags = -g -Wl,-Tesp8266.flash.1m128.ld -DDEBUG_PORT=Serial -DSONOFF -DENABLE_DS18B20=1 +upload_speed = 115200 +upload_port = "192.168.4.1" +upload_flags = --auth=Algernon1 --port 8266 + [env:sonoff-pow-debug] platform = espressif8266 framework = arduino