Fix SDM630 Energy Value to Domoticz

This commit is contained in:
Adrian Scillato 2019-07-03 19:01:12 -03:00 committed by GitHub
parent 4391aa07fe
commit 48fe21604e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -301,6 +301,16 @@ void SDM630Show(bool json)
char energy_total[33]; char energy_total[33];
dtostrfd(sdm630_energy_total, Settings.flag2.energy_resolution, energy_total); 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) { if (json) {
ResponseAppend_P(PSTR(",\"" D_RSLT_ENERGY "\":{\"" D_JSON_TOTAL "\":%s,\"" ResponseAppend_P(PSTR(",\"" D_RSLT_ENERGY "\":{\"" D_JSON_TOTAL "\":%s,\""
D_JSON_ACTIVE_POWERUSAGE "\":[%s,%s,%s],\"" D_JSON_REACTIVE_POWERUSAGE "\":[%s,%s,%s],\"" D_JSON_ACTIVE_POWERUSAGE "\":[%s,%s,%s],\"" D_JSON_REACTIVE_POWERUSAGE "\":[%s,%s,%s],\""