I currently have a counter running on a Shelly 1PM power sensor, which works well. In order to calculate the costs a little more precisely, I would like to add a counter in parallel, which ONLY counts when the house battery is < 5%.
So I know that the kWh with battery / PV cost me around 8 cents and the other one cost 25 cents (from the grid). Can this be done with a helper or do I have to put a sensor with calculation in my configuration.yaml.
Ideal would be a second entity in the counter helper or a condition that can be set
I think there might be confusion with language translation. What you are using appears to be a utility meter helper. A counter helper is something different that increments a number and would need an automation to perform the incrementing.
Assuming you are asking if there is a way to make a utility meter behave conditionally: the answer is no not directly. You have to make the source sensor that the utility meter uses behave conditionally. You can do that two different ways:
Create an input_number helper, and then create an automation that updates that helper, and put your condition in that automation. You can’t feed an input number into a utility meter helper, so you then need to create a template sensor that simply reflects the state of your input helper. So the template would be "{{ states('input_number.my_input_helper') }}"
Create a trigger-based template sensor in YAML. This is essentially the same as the previous option but it does the automation and stores the value all in a single entity. And you won’t need an intermediate template sensor either, so it replaces 3 entities with one. The downside is that you can’t create this from the UI.