Sensors missing from Energy Dashboard config (Riemann Sum Integral)

I have a Tesla Powerwall and am trying to use the grid, solar and battery entities in my energy dashboard config. These are provided by the Tesla custom integration.

For grid and battery, a single entity is provided for each, with a positive or negative figure depending on whether consuming from or exporting to the grid, for example.

So the first thing I needed to do was split them into separate sensors that provide a positive value, like this:

template:
  - sensor:
    - name: "Current Grid Consumption"
      unique_id: current_grid_consumption
      device_class: power
      state_class: measurement
      unit_of_measurement: "W"
      state: >
        {% if states('sensor.mr_a_williams_grid_power')|float >= 0 %}
          {{ states('sensor.mr_a_williams_grid_power') | float }}
        {% else %}
          0
        {% endif %}
    - name: "Current Grid Export"
      unique_id: current_grid_export
      device_class: power
      state_class: measurement
      unit_of_measurement: "W"
      state: >
        {% if states('sensor.mr_a_williams_grid_power')|float < 0 %}
          {{ -1 * states('sensor.mr_a_williams_grid_power')|float }}
        {% else %}
          0
        {% endif %}
    - name: "Current Battery Out"
      unique_id: current_battery_out
      device_class: power
      state_class: measurement
      unit_of_measurement: "W"
      state: >
        {% if states('sensor.mr_a_williams_battery_power')|float >= 0 %}
          {{ states('sensor.mr_a_williams_battery_power') | float }}
        {% else %}
          0
        {% endif %}
    - name: "Current Battery In"
      unique_id: current_battery_in
      device_class: power
      state_class: measurement
      unit_of_measurement: "W"
      state: >
        {% if states('sensor.mr_a_williams_battery_power')|float < 0 %}
          {{ -1 * states('sensor.mr_a_williams_battery_power')|float }}
        {% else %}
          0
        {% endif %}

I then created Riemann Sum Integral helpers for each of them (using the “Left” method), to convert them to kWh:

The problem: Only the “solar production” and “battery in” sensors are available to select in the energy dashboard config.

They were all created the same way, valid non-zero values are showing in Developer Tools and it’s been 2 days since I created them, so I have no idea why they aren’t showing!

Has anyone else experienced this or have any ideas?

Finally figured this out and sharing the solution in case anyone else comes across anything similar.

I evidently made a typo in my source template sensors (the ones that split the Powerwall import/export sensors into separate values).

This prevented the system from collecting statistics for those sensors, which is necessary for them to appear in the Energy Dashboard.

I had to go to Developer Tools > Statistics and fix the issues (simply click the fix button). Now they appear in the Energy Dashboard: