From 4391aa07fed5222a8f42ecea14adf1b37f68d929 Mon Sep 17 00:00:00 2001 From: Adrian Scillato <35405447+ascillato@users.noreply.github.com> Date: Wed, 3 Jul 2019 18:56:06 -0300 Subject: [PATCH 1/2] Fix SDM120 Energy Value to Domoticz Fix SDM120 Energy Value to Domoticz (https://github.com/arendst/Sonoff-Tasmota/issues/6015) --- sonoff/xsns_23_sdm120.ino | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sonoff/xsns_23_sdm120.ino b/sonoff/xsns_23_sdm120.ino index 6684f6a15..b363ce16f 100644 --- a/sonoff/xsns_23_sdm120.ino +++ b/sonoff/xsns_23_sdm120.ino @@ -347,9 +347,11 @@ void SDM120Show(bool json) #endif // USE_SDM220 #ifdef USE_DOMOTICZ if (0 == tele_period) { + char energy_total_chr[33]; + dtostrfd(sdm120_energy_total * 1000, 1, energy_total_chr); DomoticzSensor(DZ_VOLTAGE, voltage); DomoticzSensor(DZ_CURRENT, current); - DomoticzSensorPowerEnergy((int)sdm120_active_power, energy_total); + DomoticzSensorPowerEnergy((int)sdm120_active_power, energy_total_chr); } #endif // USE_DOMOTICZ #ifdef USE_WEBSERVER From 48fe21604e583fb862862ac1608c35a21ccc4b5f Mon Sep 17 00:00:00 2001 From: Adrian Scillato <35405447+ascillato@users.noreply.github.com> Date: Wed, 3 Jul 2019 19:01:12 -0300 Subject: [PATCH 2/2] Fix SDM630 Energy Value to Domoticz --- sonoff/xsns_25_sdm630.ino | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sonoff/xsns_25_sdm630.ino b/sonoff/xsns_25_sdm630.ino index f1d2d16e6..1db715c88 100644 --- a/sonoff/xsns_25_sdm630.ino +++ b/sonoff/xsns_25_sdm630.ino @@ -301,6 +301,16 @@ void SDM630Show(bool json) char energy_total[33]; dtostrfd(sdm630_energy_total, Settings.flag2.energy_resolution, energy_total); +#ifdef USE_DOMOTICZ + if (0 == tele_period) { + char energy_total_chr[33]; + dtostrfd(sdm630_energy_total * 1000, 1, energy_total_chr); + DomoticzSensor(DZ_VOLTAGE, voltage); + DomoticzSensor(DZ_CURRENT, current); + DomoticzSensorPowerEnergy((int)sdm630_active_power, energy_total_chr); + } +#endif // USE_DOMOTICZ + if (json) { ResponseAppend_P(PSTR(",\"" D_RSLT_ENERGY "\":{\"" D_JSON_TOTAL "\":%s,\"" D_JSON_ACTIVE_POWERUSAGE "\":[%s,%s,%s],\"" D_JSON_REACTIVE_POWERUSAGE "\":[%s,%s,%s],\"" @@ -350,4 +360,4 @@ bool Xsns25(uint8_t function) return result; } -#endif \ No newline at end of file +#endif