InventoCasa / ha-advanced-blueprints

Advanced Blueprints combined with pyscript for extra useful automations
139 stars 33 forks source link

Request clarification for the calculation of export_pwr and excess_pwr #78

Open bravepasta opened 2 weeks ago

bravepasta commented 2 weeks ago

I would like to ask some clarification on the calculation of export_pwr and excess_pwr in the function _update_pv_history() in the pyscript python code when using the import_export_power mode (using one meter to get the data for import and export).

The current code is as follow: export_pwr = abs(min(0, import_export)) excess_pwr = -import_export

My understanding is that export_pwr is calculated correctly, as it gives either 0 or a positive number for the exported power (which is initially negative). Unfortunately I do not understand the calculation for the excess_pwr.

Could somebody shine some light on this please?