From 603e39cc6501228355d9d28728af0bbb488ed30c Mon Sep 17 00:00:00 2001 From: Elzbieta Kotulska Date: Thu, 1 Aug 2024 12:37:22 +0200 Subject: [PATCH] Change consumer power formula to set 0 if meter is not sending data Previously if any meter stopped working, we didn't get any power from formula. We need to keep application working even if meter is not responding. This field should be configurable in the future. Another feature might be to fallback to successor components. Signed-off-by: Elzbieta Kotulska --- RELEASE_NOTES.md | 1 + .../_formula_generators/_consumer_power_formula.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index a5d1f3a7f..fec97aa02 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -3,3 +3,4 @@ ## Bug Fixes - Fix PV power distribution excluding inverters that haven't sent any data since the application started. +- Change consumer power formula to use 0 instead of None if any component is not sending data. Now power is sum of power in all working components. diff --git a/src/frequenz/sdk/timeseries/formula_engine/_formula_generators/_consumer_power_formula.py b/src/frequenz/sdk/timeseries/formula_engine/_formula_generators/_consumer_power_formula.py index 87c65689b..d64a12771 100644 --- a/src/frequenz/sdk/timeseries/formula_engine/_formula_generators/_consumer_power_formula.py +++ b/src/frequenz/sdk/timeseries/formula_engine/_formula_generators/_consumer_power_formula.py @@ -181,7 +181,7 @@ def consumer_component(component: Component) -> bool: builder.push_component_metric( component.component_id, - nones_are_zeros=component.category != ComponentCategory.METER, + nones_are_zeros=True, ) return builder.build()