Fix SDM120 wrong values

Fix SDM120 reporting wrong negative values to Domoticz (#3521)
This commit is contained in:
Theo Arends 2018-08-19 13:00:27 +02:00
parent 0e2e28790f
commit 6d1ce5bd69
4 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,6 @@
/* 6.1.1.7
* Add initial display support for Lcd, Oled, Matrix, Tft and e-paper - Need more docs
* Fix SDM120 reporting wrong negative values to Domoticz (#3521)
*
* 6.1.1.6
* Add modulo option to rules like rule1 on Time#Minute|5 do backlog power on;delay 200;power off endon (#3466)

View File

@ -1156,7 +1156,7 @@ void EnergyShow(boolean json)
#ifdef USE_DOMOTICZ
if (show_energy_period) { // Only send if telemetry
dtostrfd(energy_total * 1000, 1, energy_total_chr);
DomoticzSensorPowerEnergy((uint16_t)energy_power, energy_total_chr); // PowerUsage, EnergyToday
DomoticzSensorPowerEnergy((int)energy_power, energy_total_chr); // PowerUsage, EnergyToday
DomoticzSensor(DZ_VOLTAGE, energy_voltage_chr); // Voltage
DomoticzSensor(DZ_CURRENT, energy_current_chr); // Current
}

View File

@ -346,7 +346,7 @@ void DomoticzTempHumPressureSensor(char *temp, char *hum, char *baro)
DomoticzSensor(DZ_TEMP_HUM_BARO, data);
}
void DomoticzSensorPowerEnergy(uint16_t power, char *energy)
void DomoticzSensorPowerEnergy(int power, char *energy)
{
char data[16];
snprintf_P(data, sizeof(data), PSTR("%d;%s"), power, energy);

View File

@ -256,7 +256,7 @@ void SDM120Show(boolean json)
if (0 == tele_period) {
DomoticzSensor(DZ_VOLTAGE, voltage);
DomoticzSensor(DZ_CURRENT, current);
DomoticzSensorPowerEnergy((uint16_t)sdm120_active_power, energy_total);
DomoticzSensorPowerEnergy((int)sdm120_active_power, energy_total);
}
#endif // USE_DOMOTICZ
#ifdef USE_WEBSERVER