I have an OpenEnergyMonitor emonTX which gives me power value in Watts for Solar Power, Consumption Power (and Diverted Power but that is not important for the moment).
OpenEnergyMonitor have made a decision that +ve values of Consumption Power mean that I am importing from the Grid. -ve values of Consumption Power mean that I am exporting to the Grid.
When I am importing power, the amount of power imported from the Grid is the difference between my Solar Power and the Consumption Power values.
When I am exporting power, the amount of power exported is the negative number detected as Consumption Power.
In HA I am already using the Reimann Sum integration to get from the W values sent by emonTX to the kWh values.
So I have a Solar kWh and a Consumption kWh sensors.
I have no idea how things will work with -ve Consumption power values.
And how do I use these sensors in the Energy Dashboard.