Energy Tab Data Exposed

Can you expose the Energy data in sensors

Example I would like to be able to get the in / out solar consumed ttls calculated by that dashboard for the day, week, month, year internal and external (or if you make some custom just internal and you would config what to expose external in config yaml.

I snapshot my in/out for each lane of power and do the match at midnight. Even thouigh its the same data feeding into Energy my math never matches. 8hra after midnight my solar is same .1 for both, but the in from grid is off by 1.1kwh, Not sure who is correct but I want me external diaply to at least macth

Here’s what I understand you’re asking:
When I have something configured on the Energy Dashboard, I’d like to be able to have sensors that show cumulative consumption/production by hour, day, week, month, and year. Rather than having to look at the dashboard itself.

If that’s what you want, look at the Utility Meter integration and set up the sensors yourself to do that:

You can use the same source sensors and just aggregate however you wish based on “reset” timing.

I do the following which is what @pickerin suggestes. I have a Tesla gateway 2 on my solar system. The values for in and out are not always positive so I made some sensors that were.

#--------------------------------------------------------------------------------------------------
# Power to Grid - Make Positive
#--------------------------------------------------------------------------------------------------
template:
  - sensor:
    - name: "Power to Grid"
      unique_id: "Power to Grid"
      state: >-
        {% if states('sensor.powerwall_site_now') | float(0) < -0.0001 %}
          {{ states('sensor.powerwall_site_now') | float(0) | abs}} 
        {% else %}
          0.000
        {% endif %}
      unit_of_measurement: "kW"

#--------------------------------------------------------------------------------------------------
# Power from Grid - Make Positive 
#--------------------------------------------------------------------------------------------------
  - sensor:
    - name: "Power from Grid"
      unique_id: "Power From Grid"
      state: >-
        {% if states('sensor.powerwall_site_now') | float(0) > 0.0001 %}
          {{ states('sensor.powerwall_site_now') }}
        {% else %}
          0.000
        {% endif %}
      unit_of_measurement: "kW"

I then create integration sensors to sum the power

sensor:
  - platform: integration
    source: sensor.power_to_grid
    name: Energy to Grid
    round: 3
    unit_time: h

  - platform: integration
    source: sensor.power_from_grid
    name: Energy from Grid
    round: 3
    unit_time: h

I then create the utility meters.

#  ------------------------------------------------------------------------------------
#  Energy to Grid
#  ------------------------------------------------------------------------------------
utility_meter:
  daily_energy_grid_to:
    source: "sensor.energy_to_grid"
    name: "Daily kWh to Grid"
    cycle: daily

  weekly_energy_grid_to:
    source: "sensor.energy_to_grid"
    name: "Weekly kWh to Grid"
    cycle: weekly

  monthly_energy_grid_to:
    source: "sensor.energy_to_grid"
    name: "Monthly kWh to Grid"
    cycle: monthly

  yearly_energy_grid_to:
    source: "sensor.energy_to_grid"
    name: "Yearly kWh to Grid"
    cycle: yearly

#  ------------------------------------------------------------------------------------
#  Energy from Grid
#  ------------------------------------------------------------------------------------
  daily_energy_grid_from:
    source: "sensor.energy_from_grid"
    name: "Daily kWh from Grid"
    cycle: daily

  weekly_energy_grid_from:
    source: "sensor.energy_from_grid"
    name: "Weekly kWh from Grid"
    cycle: weekly

  monthly_energy_grid_from:
    source: "sensor.energy_from_grid"
    name: "Monthly kWh from Grid"
    cycle: monthly

  yearly_energy_grid_from:
    source: "sensor.energy_from_grid"
    name: "Yearly kWh from Grid"
    cycle: yearly

I do this for all the input and output. I recommend that you split the files using !include in configuration.yaml. The coding has been shown assuming you put everything in configuration.yaml.

Hope this helps.

Edit - Create all sensors and utility meters at once before you restart to ensure that they all start from the same time. I did mine ad-hoc and have some minor discrepancies.

Here is a screenshot of the plotted data in the UI