Berry fix Energy mapping

This commit is contained in:
Stephan Hadinger 2021-09-28 20:03:24 +02:00
parent 2e06937b6f
commit 27dbe91a1c
2 changed files with 65 additions and 57 deletions

View File

@ -80,72 +80,76 @@ static const char * be_ctypes_instance_mappings[]; /* forward definition */
/********************************************************************/
const be_ctypes_structure_t be_energy_struct = {
146, /* size in bytes */
62, /* number of elements */
158, /* size in bytes */
66, /* number of elements */
be_ctypes_instance_mappings,
(const be_ctypes_structure_item_t[62]) {
(const be_ctypes_structure_item_t[66]) {
{ "active_power", 24, 0, 0, 5, 0 },
{ "active_power_2", 28, 0, 0, 5, 0 },
{ "active_power_3", 32, 0, 0, 5, 0 },
{ "command_code", 113, 0, 0, 1, 0 },
{ "apparent_power", 36, 0, 0, 5, 0 },
{ "apparent_power_2", 40, 0, 0, 5, 0 },
{ "apparent_power_3", 44, 0, 0, 5, 0 },
{ "command_code", 125, 0, 0, 1, 0 },
{ "current", 12, 0, 0, 5, 0 },
{ "current_2", 16, 0, 0, 5, 0 },
{ "current_3", 20, 0, 0, 5, 0 },
{ "current_available", 118, 5, 1, 0, 0 },
{ "daily", 88, 0, 0, 5, 0 },
{ "data_valid", 114, 0, 0, 1, 0 },
{ "data_valid_2", 115, 0, 0, 1, 0 },
{ "data_valid_3", 116, 0, 0, 1, 0 },
{ "export_active", 72, 0, 0, 5, 0 },
{ "export_active_2", 76, 0, 0, 5, 0 },
{ "export_active_3", 80, 0, 0, 5, 0 },
{ "fifth_second", 112, 0, 0, 1, 0 },
{ "frequency", 60, 0, 0, 5, 0 },
{ "frequency_2", 64, 0, 0, 5, 0 },
{ "frequency_3", 68, 0, 0, 5, 0 },
{ "frequency_common", 118, 1, 1, 0, 0 },
{ "max_current_flag", 138, 5, 1, 0, 0 },
{ "max_energy_state", 145, 0, 0, 1, 0 },
{ "max_power_flag", 138, 1, 1, 0, 0 },
{ "max_voltage_flag", 138, 3, 1, 0, 0 },
{ "min_current_flag", 138, 4, 1, 0, 0 },
{ "min_power_flag", 138, 0, 1, 0, 0 },
{ "min_voltage_flag", 138, 2, 1, 0, 0 },
{ "mplh_counter", 140, 0, 0, 2, 0 },
{ "mplr_counter", 144, 0, 0, 1, 0 },
{ "mplw_counter", 142, 0, 0, 2, 0 },
{ "period", 108, 0, 0, 4, 0 },
{ "phase_count", 117, 0, 0, 1, 0 },
{ "power_factor", 48, 0, 0, 5, 0 },
{ "power_factor_2", 52, 0, 0, 5, 0 },
{ "power_factor_3", 56, 0, 0, 5, 0 },
{ "power_history_0", 119, 0, 0, 2, 0 },
{ "power_history_0_2", 121, 0, 0, 2, 0 },
{ "power_history_0_3", 123, 0, 0, 2, 0 },
{ "power_history_1", 125, 0, 0, 2, 0 },
{ "power_history_1_2", 127, 0, 0, 2, 0 },
{ "power_history_1_3", 129, 0, 0, 2, 0 },
{ "power_history_2", 131, 0, 0, 2, 0 },
{ "power_history_2_2", 133, 0, 0, 2, 0 },
{ "power_history_2_3", 135, 0, 0, 2, 0 },
{ "power_on", 118, 7, 1, 0, 0 },
{ "power_steady_counter", 137, 0, 0, 1, 0 },
{ "reactive_power", 36, 0, 0, 5, 0 },
{ "reactive_power_2", 40, 0, 0, 5, 0 },
{ "reactive_power_3", 44, 0, 0, 5, 0 },
{ "start_energy", 84, 0, 0, 5, 0 },
{ "today_delta_kwh", 96, 0, 0, 4, 0 },
{ "today_kwh", 104, 0, 0, 4, 0 },
{ "today_offset_init_kwh", 118, 3, 1, 0, 0 },
{ "today_offset_kwh", 100, 0, 0, 4, 0 },
{ "total", 92, 0, 0, 5, 0 },
{ "type_dc", 118, 6, 1, 0, 0 },
{ "use_overtemp", 118, 2, 1, 0, 0 },
{ "current_available", 130, 5, 1, 0, 0 },
{ "daily", 100, 0, 0, 5, 0 },
{ "data_valid", 126, 0, 0, 1, 0 },
{ "data_valid_2", 127, 0, 0, 1, 0 },
{ "data_valid_3", 128, 0, 0, 1, 0 },
{ "export_active", 84, 0, 0, 5, 0 },
{ "export_active_2", 88, 0, 0, 5, 0 },
{ "export_active_3", 92, 0, 0, 5, 0 },
{ "fifth_second", 124, 0, 0, 1, 0 },
{ "frequency", 72, 0, 0, 5, 0 },
{ "frequency_2", 76, 0, 0, 5, 0 },
{ "frequency_3", 80, 0, 0, 5, 0 },
{ "frequency_common", 130, 1, 1, 0, 0 },
{ "max_current_flag", 150, 5, 1, 0, 0 },
{ "max_energy_state", 157, 0, 0, 1, 0 },
{ "max_power_flag", 150, 1, 1, 0, 0 },
{ "max_voltage_flag", 150, 3, 1, 0, 0 },
{ "min_current_flag", 150, 4, 1, 0, 0 },
{ "min_power_flag", 150, 0, 1, 0, 0 },
{ "min_voltage_flag", 150, 2, 1, 0, 0 },
{ "mplh_counter", 152, 0, 0, 2, 0 },
{ "mplr_counter", 156, 0, 0, 1, 0 },
{ "mplw_counter", 154, 0, 0, 2, 0 },
{ "period", 120, 0, 0, 4, 0 },
{ "phase_count", 129, 0, 0, 1, 0 },
{ "power_factor", 60, 0, 0, 5, 0 },
{ "power_factor_2", 64, 0, 0, 5, 0 },
{ "power_factor_3", 68, 0, 0, 5, 0 },
{ "power_history_0", 131, 0, 0, 2, 0 },
{ "power_history_0_2", 133, 0, 0, 2, 0 },
{ "power_history_0_3", 135, 0, 0, 2, 0 },
{ "power_history_1", 137, 0, 0, 2, 0 },
{ "power_history_1_2", 139, 0, 0, 2, 0 },
{ "power_history_1_3", 141, 0, 0, 2, 0 },
{ "power_history_2", 143, 0, 0, 2, 0 },
{ "power_history_2_2", 145, 0, 0, 2, 0 },
{ "power_history_2_3", 147, 0, 0, 2, 0 },
{ "power_on", 130, 7, 1, 0, 0 },
{ "power_steady_counter", 149, 0, 0, 1, 0 },
{ "reactive_power", 48, 0, 0, 5, 0 },
{ "reactive_power_2", 52, 0, 0, 5, 0 },
{ "reactive_power_3", 56, 0, 0, 5, 0 },
{ "start_energy", 96, 0, 0, 5, 0 },
{ "suff", 151, 0, 0, 1, 0 },
{ "today_delta_kwh", 108, 0, 0, 4, 0 },
{ "today_kwh", 116, 0, 0, 4, 0 },
{ "today_offset_init_kwh", 130, 3, 1, 0, 0 },
{ "today_offset_kwh", 112, 0, 0, 4, 0 },
{ "total", 104, 0, 0, 5, 0 },
{ "type_dc", 130, 6, 1, 0, 0 },
{ "use_overtemp", 130, 2, 1, 0, 0 },
{ "voltage", 0, 0, 0, 5, 0 },
{ "voltage_2", 4, 0, 0, 5, 0 },
{ "voltage_3", 8, 0, 0, 5, 0 },
{ "voltage_available", 118, 4, 1, 0, 0 },
{ "voltage_common", 118, 0, 1, 0, 0 },
{ "voltage_available", 130, 4, 1, 0, 0 },
{ "voltage_common", 130, 0, 1, 0, 0 },
}};
static const char * be_ctypes_instance_mappings[] = {

View File

@ -15,7 +15,7 @@ uint8 = ctypes.u8
uint16 = ctypes.u16
uint32 = ctypes.u32
int32 = ctypes.i32
bool = ctypes.bf_1
bool = ctypes.u8
energy_struct = [
[float, "voltage"],
@ -27,6 +27,9 @@ energy_struct = [
[float, "active_power"],
[float, "active_power_2"],
[float, "active_power_3"],
[float, "apparent_power"],
[float, "apparent_power_2"],
[float, "apparent_power_3"],
[float, "reactive_power"],
[float, "reactive_power_2"],
[float, "reactive_power_3"],
@ -88,6 +91,7 @@ energy_struct = [
[bool, "min_current_flag"],
[bool, "max_current_flag"],
[uint8, "stuff"],
# #ifdef USE_ENERGY_POWER_LIMIT
[uint16, "mplh_counter"],
[uint16, "mplw_counter"],