Getting correct energy data

I’ve been trying to work this out for days and I can’t, so I’m hoping someone else can make sense of what I have - or point me the right direction. My main goals are to actually get useful information for the energy dashboard, and setup up an alert when I am returning energy to the grid - I think it could be used to know the best times to run the washing machine or water heater

My house has solar panels as well as a standard feed from the national grid. The solar panels return any excess power back into the grid.

So I am trying to get three bits of information:

  1. Power being taken from the grid
  2. Power being being generated by the solar panels
  3. Power being returned to the grid

The problem is just now all I have is power meters that watch the LEDs on both solar and electric meters, and I’ve just realized that my electric meters LED flashes when power is being fed back into the grid. Meaning getting the value for item 2 is just a case of reading off the LED sensor, but items 1 and 3 are mixed up, making the second LED sensor useless?

Can anyone see a way of getting the information I want from the what I already have, or is there a better way of doing this?