Can ConsumptionActivePower be negative?

This is true, the Energy channels should continuously rise. This is an example from our InfluxDB/Grafana:

As Consumption is the sum of the other energy channels, the problem needs to be with one of them.

Calculation of Sum Consumption energy:

This is how it looks here. It became obvious the two Grid Energy metrics are swapped which seems to be the reason. It looked into the code and found this:

This is inverse to my personal logic. My personal logic is that any excess energy I have in my system and send into the grid is something that I sell to the grid (I get money compensation for that). The logic built into OpenEMS seems to look from the grid point of view where ‘selling’ is attributed to energy entering my system FROM the grid side. To me that is very much counterintuitive, but - hey - it is what is. Maybe this definition of Production and Consumption should be in the docs somewhere (or it is and I missed it). Not everybody will look at the code and there might be more people fooled by that.

I will make changes to the meter code to swap the logic behind consumption and production and create a new PR.

Code changed, issue fixed