Issue with Energy Dashboard showing proper Utility power

I’m trying to figure out how to show the energy I get from my utility correctly. My solar system reports my solar production, but I can’t connect to my utility meter. I have an Emporia Vue meter connected to the mains feed in my panel, but since that shows all power (combo of utility & solar), I can’t seem to get a clear number from the utility side only.

I created this sensor, but it goes into the negative when I produce more solar power than I buy from the utility (selling back to the utility).

  - sensor:
      - name: "Real Grid Use"
        unit_of_measurement: "kWh"
        state: >
          {% set panel = states('sensor.home_123_1d') | float(0) %}
          {% set solar = states('sensor.solar_system_today_s_energy_production') | float(0) %}
          {{ (( panel - solar )) | round(2) }}
        device_class: "energy"
        state_class: "total_increasing"
        availability: >
          {{ states('sensor.home_123_1d') | float(0) != 0 and states('sensor.solar_system_today_s_energy_production') | float(0) != 0 }} 

Since the number goes negative, it reduces the amount tracked from my utility, so what is reported on the HA dashboard is not the same as what my utility shows. This is a problem as the utility shows on the bill the total I used from them, and it has a separate line item to show what they purchased from me.

I’ve been trying to come up with a way to show the actual utility purchased number without any sell back to the utility (negative), and then another sensor that only shows what I sell back to the utility so that I can use that inside the Energy Dashboard as well. No matter what I try, I can’t seem to figure this out

Since I’m a new poster to the forum I can only add one embed, so I’ll follow up with screenshots in separate comments.

Here’s my Energy Dashboard. At least the Solar production graphs are correct:

Energy Dashboard Settings: