Energy directly used from solar

I am trying to make a sensor which gives my the number off directly consumed energy from my Envoy Solar panels. Having a Homewizard P1 meter gives me p1.meter.import and p1.meter.export. The Envoys give me production today and total production.
In the energy dashboard distribution image total usage is displayed and also what i am returning to the grid en consuming from the grid but not what i am consuming myself from he solar panels.
In the printscreen beneth the -name eigen verbruik zonnepanelen should give me that number but instead gives me a number which does not is the actual returned energy to the grid.

Is it correct to say when choosing a helper: nuts (i believe it is called utility) and then choose p1 meter.export (that shows the total export of energy) choose month and reset yes it must show me the energy consumed for this month?

template:
  - sensor:
      - name: "Eigen Verbruik Zonnepanelen"
        unique_id: "eigen_verbruik_zonnepanelen"
        unit_of_measurement: "kWh"
        state: >-
          {{
            (states('sensor.envoy_122132012200_energy_production_today')|float(0) -
            states('sensor.p1_meter_energie_export')|float(0)) | round(2)
          }}

Please format your post correctly, https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16

You will also need an availability template. See: Why an availability template is important for energy template sensors

i have corrected the format.
Afer some things to try to get the energy used from solarpanels and not from the grid. Have a template in configuration yaml which subtract the energy production lifetime from solarpanels and the p1 meter energy export, so this number must be what i have totaly get from the solarpanels and subtract what i have exported to the grid. THen made a helper on base off the sensor (made with template) for the period off a day, so my logical thinking would say that this helper gets the energy what i have directly consumed from the solarpanels. but the number does not cope with the number which i have from the ernergy app which is the right one. What is here the thinking error.
The status in developer mode is total_increasing so the helper does something but what i did not discover yet…

This is part off the configuration file that covers the template:

- name: "Eigen Verbruik Zonnepanelen"
        unique_id: "eigen_verbruik_zonnepanelen"
        unit_of_measurement: "kWh"
        availability: >-
          {{
            has_value('sensor.envoy_122132012200_lifetime_energy_production') and
            has_value('sensor.p1_meter_energie_export')
          }}
        state: >-
          {{
           ((states('sensor.envoy_122132012200_lifetime_energy_production')|float(0) * 1000) -
            states('sensor.p1_meter_energie_export')|float(0)) | round(2)
          }}

It is a small thing:
currently i have the status off:
energy used from grid
energy exported to grid

currently power used
currently power produced with solarpanels

but not enery used from solarpanels which is not exported to grid but consumed by us…
I know it is simple to calculate by substracting the number of solarpanels produced - exported to grid = what i have consumed but this number i want in the dashboard, preferably in the distibution grid