Add SDM630 three phase ImportActive Energy display

Add SDM630 three phase ImportActive Energy display when ``#define SDM630_IMPORT`` is enabled by Janusz Kostorz (#9124)
This commit is contained in:
Theo Arends 2020-10-03 12:46:58 +02:00
parent d0028eb2e4
commit ad3cfa6cbb
5 changed files with 14 additions and 12 deletions

View File

@ -69,3 +69,4 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
- Change pulsetime to allow use for all relays with 8 interleaved so ``Pulsetime1`` is valid for Relay1, Relay9, Relay17 etc. (#9279) - Change pulsetime to allow use for all relays with 8 interleaved so ``Pulsetime1`` is valid for Relay1, Relay9, Relay17 etc. (#9279)
- Add optional support for Mitsubishi Electric HVAC by David Gwynne (#9237) - Add optional support for Mitsubishi Electric HVAC by David Gwynne (#9237)
- Add optional support for Orno WE517-Modbus energy meter by Maxime Vincent (#9353) - Add optional support for Orno WE517-Modbus energy meter by Maxime Vincent (#9353)
- Add SDM630 three phase ImportActive Energy display when ``#define SDM630_IMPORT`` is enabled by Janusz Kostorz (#9124)

View File

@ -10,6 +10,7 @@
- Change pulsetime to allow use for all relays with 8 interleaved so ``Pulsetime1`` is valid for Relay1, Relay9, Relay17 etc. (#9279) - Change pulsetime to allow use for all relays with 8 interleaved so ``Pulsetime1`` is valid for Relay1, Relay9, Relay17 etc. (#9279)
- Add optional support for Mitsubishi Electric HVAC by David Gwynne (#9237) - Add optional support for Mitsubishi Electric HVAC by David Gwynne (#9237)
- Add optional support for Orno WE517-Modbus energy meter by Maxime Vincent (#9353) - Add optional support for Orno WE517-Modbus energy meter by Maxime Vincent (#9353)
- Add SDM630 three phase ImportActive Energy display when ``#define SDM630_IMPORT`` is enabled by Janusz Kostorz (#9124)
## Released ## Released

View File

@ -652,7 +652,7 @@
#define SDM120_SPEED 2400 // SDM120-Modbus RS485 serial speed (default: 2400 baud) #define SDM120_SPEED 2400 // SDM120-Modbus RS485 serial speed (default: 2400 baud)
//#define USE_SDM630 // Add support for Eastron SDM630-Modbus energy monitor (+0k6 code) //#define USE_SDM630 // Add support for Eastron SDM630-Modbus energy monitor (+0k6 code)
#define SDM630_SPEED 9600 // SDM630-Modbus RS485 serial speed (default: 9600 baud) #define SDM630_SPEED 9600 // SDM630-Modbus RS485 serial speed (default: 9600 baud)
//#define SDM630_IMPORT // Show import active energy in MQTT and Web (+0k3 code) // #define SDM630_IMPORT // Show import active energy in MQTT and Web (+0k3 code)
//#define USE_DDS2382 // Add support for Hiking DDS2382 Modbus energy monitor (+0k6 code) //#define USE_DDS2382 // Add support for Hiking DDS2382 Modbus energy monitor (+0k6 code)
#define DDS2382_SPEED 9600 // Hiking DDS2382 Modbus RS485 serial speed (default: 9600 baud) #define DDS2382_SPEED 9600 // Hiking DDS2382 Modbus RS485 serial speed (default: 9600 baud)
//#define USE_DDSU666 // Add support for Chint DDSU666 Modbus energy monitor (+0k6 code) //#define USE_DDSU666 // Add support for Chint DDSU666 Modbus energy monitor (+0k6 code)

View File

@ -80,9 +80,9 @@ struct ENERGY {
float power_factor[3] = { NAN, NAN, NAN }; // 0.12 float power_factor[3] = { NAN, NAN, NAN }; // 0.12
float frequency[3] = { NAN, NAN, NAN }; // 123.1 Hz float frequency[3] = { NAN, NAN, NAN }; // 123.1 Hz
#ifdef SDM630_IMPORT #ifdef SDM630_IMPORT
float import_active[3] = { NAN, NAN, NAN }; // 123.123 kWh float import_active[3] = { NAN, NAN, NAN }; // 123.123 kWh
#endif #endif // SDM630_IMPORT
float export_active[3] = { NAN, NAN, NAN }; // 123.123 kWh float export_active[3] = { NAN, NAN, NAN }; // 123.123 kWh
float start_energy = 0; // 12345.12345 kWh total previous float start_energy = 0; // 12345.12345 kWh total previous
@ -994,7 +994,7 @@ void EnergyShow(bool json)
char active_power_chr[Energy.phase_count][FLOATSZ]; char active_power_chr[Energy.phase_count][FLOATSZ];
#ifdef SDM630_IMPORT #ifdef SDM630_IMPORT
char import_active_chr[Energy.phase_count][FLOATSZ]; char import_active_chr[Energy.phase_count][FLOATSZ];
#endif #endif // SDM630_IMPORT
char export_active_chr[Energy.phase_count][FLOATSZ]; char export_active_chr[Energy.phase_count][FLOATSZ];
for (uint32_t i = 0; i < Energy.phase_count; i++) { for (uint32_t i = 0; i < Energy.phase_count; i++) {
dtostrfd(Energy.voltage[i], Settings.flag2.voltage_resolution, voltage_chr[i]); dtostrfd(Energy.voltage[i], Settings.flag2.voltage_resolution, voltage_chr[i]);
@ -1002,7 +1002,7 @@ void EnergyShow(bool json)
dtostrfd(Energy.active_power[i], Settings.flag2.wattage_resolution, active_power_chr[i]); dtostrfd(Energy.active_power[i], Settings.flag2.wattage_resolution, active_power_chr[i]);
#ifdef SDM630_IMPORT #ifdef SDM630_IMPORT
dtostrfd(Energy.import_active[i], Settings.flag2.energy_resolution, import_active_chr[i]); dtostrfd(Energy.import_active[i], Settings.flag2.energy_resolution, import_active_chr[i]);
#endif #endif // SDM630_IMPORT
dtostrfd(Energy.export_active[i], Settings.flag2.energy_resolution, export_active_chr[i]); dtostrfd(Energy.export_active[i], Settings.flag2.energy_resolution, export_active_chr[i]);
} }
@ -1054,7 +1054,7 @@ void EnergyShow(bool json)
EnergyFormatIndex(value_chr, energy_return_chr[0], json, 2)); EnergyFormatIndex(value_chr, energy_return_chr[0], json, 2));
} }
} }
#endif #endif // SDM630_IMPORT
if (!isnan(Energy.export_active[0])) { if (!isnan(Energy.export_active[0])) {
ResponseAppend_P(PSTR(",\"" D_JSON_EXPORT_ACTIVE "\":%s"), ResponseAppend_P(PSTR(",\"" D_JSON_EXPORT_ACTIVE "\":%s"),
@ -1160,11 +1160,11 @@ void EnergyShow(bool json)
if (!isnan(Energy.export_active[0])) { if (!isnan(Energy.export_active[0])) {
WSContentSend_PD(HTTP_ENERGY_SNS3, EnergyFormat(value_chr, export_active_chr[0], json)); WSContentSend_PD(HTTP_ENERGY_SNS3, EnergyFormat(value_chr, export_active_chr[0], json));
} }
#ifdef SDM630_IMPORT #ifdef SDM630_IMPORT
if (!isnan(Energy.import_active[0])) { if (!isnan(Energy.import_active[0])) {
WSContentSend_PD(HTTP_ENERGY_SNS4, EnergyFormat(value_chr, import_active_chr[0], json)); WSContentSend_PD(HTTP_ENERGY_SNS4, EnergyFormat(value_chr, import_active_chr[0], json));
} }
#endif #endif // SDM630_IMPORT
XnrgCall(FUNC_WEB_SENSOR); XnrgCall(FUNC_WEB_SENSOR);
#endif // USE_WEBSERVER #endif // USE_WEBSERVER

View File

@ -60,11 +60,11 @@ const uint16_t sdm630_start_addresses[] {
0x0160, // + + + kWh Phase 1 export active energy 0x0160, // + + + kWh Phase 1 export active energy
0x0162, // + + + kWh Phase 2 export active energy 0x0162, // + + + kWh Phase 2 export active energy
0x0164, // + + + kWh Phase 3 export active energy 0x0164, // + + + kWh Phase 3 export active energy
#ifdef SDM630_IMPORT #ifdef SDM630_IMPORT
0x015A, // + + + kWh Phase 1 import active energy 0x015A, // + + + kWh Phase 1 import active energy
0x015C, // + + + kWh Phase 2 import active energy 0x015C, // + + + kWh Phase 2 import active energy
0x015E, // + + + kWh Phase 3 import active energy 0x015E, // + + + kWh Phase 3 import active energy
#endif #endif // SDM630_IMPORT
0x0156 // + + + kWh Total active energy 0x0156 // + + + kWh Total active energy
}; };
@ -179,7 +179,7 @@ void SDM630Every250ms(void)
break; break;
case 19: case 19:
#ifdef SDM630_IMPORT #ifdef SDM630_IMPORT
Energy.import_active[0] = value; Energy.import_active[0] = value;
break; break;
@ -192,7 +192,7 @@ void SDM630Every250ms(void)
break; break;
case 22: case 22:
#endif #endif // SDM630_IMPORT
EnergyUpdateTotal(value, true); EnergyUpdateTotal(value, true);
break; break;
} }