I have 10 Enphase inverters and each of them shows the power produced in Watts.
I want to sum those values to get me the total value.
I tried using the Helper Combine sum option. This works but the sum value is not updated when each individual inverter changes it’s power output.
My question is, how can I get the sum produced? I am not a expert in templates or scripts, so I hope you can lead me how to do.
Create a template that sums the value of all inverter power output sensors.
I’m not a template guru but I think you could add some check on availability of the source sensors to avoid that the sums became unavailable if a single inverter doesn’t report the output value
A very simple way to sum these is to use a group helper with a sum value.
If you are using an Enphase IQ Gateway, then be aware the summed value is available as a value. The Enphase Envoy core integration and most custom integration have that entity.
If you want to implement as a template consider something like:
I tried the group helper and it basically calculates the sum but the data update interval is slow and not real-time when output power of the inverters changes. A calculation interval of 10 seconds is acceptable for me but I see no option to tweak this timing.
Have no idea a template produce a real-time summed rresult.
When using a template, is the code stored in the template.yaml file?
On the topic of real time updates, typically an individual Enphase inverter updates once every 5 minutes to the Envoy. And often not all inverters at the same moment in that 5 minutes. If you inspect the data of an inverter, that’s probably what you will find.
Then there’s the data collection interval, depending on your integration and settings. Can only speak for the core integration, by default it collects once a minute, so that’s the moment the data comes in and may trigger the group.
Your setting and configuration may be different of course, just describing the default setup and some items to consider.
The template can be in configuration.yaml or in a separate file like templates.yaml. I have the latter with
template: !include templates.yaml
in configuration.yaml and above example in the templates.yaml file.
If you want frequent calculations you can use a trigger with time_pattern template. The above example to trigger every 10 seconds would look like