Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Berry energy module support for 8 phases and move to pseudo-arrays #21887

Merged

Conversation

s-hadinger
Copy link
Collaborator

Description:

Breaking change

Accessors for phase 2/3 are removed in favor of the array. Ex: energy.active_power_2 and energy.active_power_3 are no longer supported.

New support for up to 8 phases

Support for up to 8 phases in module energy:

  • phase 0 is directly accessible read/write via a simple accessor, ex: energy.active_power
  • all phases are available read/write via pseudo-arrays with suffix _phases, ex: energy.active_power_phases[0] to energy.active_power_phases[7]. energy.active_power_phases is a pseudo-array; it accepts read/writes but is not an actual array.
  • It is advised to store pseudo-arrays in local variables. Accessing a pseudo-array creates a new object instance. Ex: var ap = energy.active_power_phases
  • energy.tomap() returns a complete map of all attributes

Example:

import energy

var ap = energy.active_power_phases
print(ap[0], ap[1], ap[2])

Example of tomap():

import energy
print(energy.tomap())

{'data_valid': 0, 'today_delta_kwh': 0, 'frequency_common': 0, 'import_active_phases': [0,0,0,0,0,0,0,0], 'data_valid_phases': [0,0,0,0,0,0,0,0], 'today_offset_init_kwh': 0, 'type_dc': 0, 'reactive_power': nan, 'energy_active_export': 0, 'start_energy': 0, 'power_history_2_phases': [0,0,0,0,0,0,0,0], 'command_code': 0, 'total_sum': 0, 'total_phases': [0,0,0,0,0,0,0,0], 'total': 0, 'daily': 0, 'today_kwh': 0, 'frequency': nan, 'import_active': 0, 'period': 0, 'voltage': 0, 'power_history_1_phases': [0,0,0,0,0,0,0,0], 'today_kwh_phases': [0,0,0,0,0,0,0,0], 'power_history_1': 0, 'current_available': 1, 'export_active_phases': [nan,nan,nan,nan,nan,nan,nan,nan], 'max_energy_state': 0, 'voltage_phases': [0,0,0,0,0,0,0,0], 'daily_sum_import_balanced': 0, 'power_factor': nan, 'start_energy_phases': [0,0,0,0,0,0,0,0], 'daily_phases': [0,0,0,0,0,0,0,0], 'reactive_power_phases': [nan,nan,nan,nan,nan,nan,nan,nan], 'power_history_0': 0, 'min_voltage_flag': 0, 'mpl_retry_counter': 0, 'yesterday_sum': 0, 'power_factor_phases': [nan,nan,nan,nan,nan,nan,nan,nan], 'voltage_available': 1, 'current': 0, 'use_overtemp': 0, 'period_phases': [0,0,0,0,0,0,0,0], 'export_active': nan, 'today_delta_kwh_phases': [0,0,0,0,0,0,0,0], 'min_current_flag': 0, 'active_power': 0, 'phase_count': 1, 'power_history_0_phases': [0,0,0,0,0,0,0,0], 'frequency_phases': [nan,nan,nan,nan,nan,nan,nan,nan], 'current_phases': [0,0,0,0,0,0,0,0], 'max_power_flag': 0, 'voltage_common': 0, 'power_history_2': 0, 'max_voltage_flag': 0, 'active_power_phases': [0,0,0,0,0,0,0,0], 'apparent_power_phases': [nan,nan,nan,nan,nan,nan,nan,nan], 'min_power_flag': 0, 'today_offset_kwh': 0, 'power_on': 1, 'power_steady_counter': 0, 'mpl_window_counter': 0, 'mpl_hold_counter': 0, 'apparent_power': nan, 'fifth_second': 0, 'daily_sum_export_balanced': 0, 'today_offset_kwh_phases': [0,0,0,0,0,0,0,0], 'max_current_flag': 0, 'daily_sum': 0}

Related issue (if applicable): fixes #21871

Checklist:

  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.2.7.7
  • [x plus The code change is tested and works with Tasmota core ESP32 V.3.0.2
  • I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

@s-hadinger s-hadinger merged commit 010ca34 into arendst:development Aug 1, 2024
59 checks passed
s-hadinger added a commit to s-hadinger/Tasmota that referenced this pull request Aug 29, 2024
hawa-lc4 pushed a commit to hawa-lc4/Tasmota-dev that referenced this pull request Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant