Energy Dashboard: No entities / sensors could be selected

Good morning,

since some days, I’m struggling to add energy sensors to my energy dashboard.
I’ve read a lot of posts from the forum, but none of the advices helped.
The funny thing is: Sensors had been selectable in the past. But as I planned to add new ones, I’ve noticed, the no matter how I configure the sensor, it can’t be selected.
Here ist my configuration:

template:
  - sensor:
    - name: "Solaranlage Energie"
      unique_id: solaranlage_energie
      state: "{{ '{:.3f}'.format (( (states('sensor.rct_power_storage_generator_a_energy_production_day') |float(0) + states('sensor.rct_power_storage_generator_b_energy_production_day') |float(0)) |multiply(0.001) |round(3) )) }}"
      unit_of_measurement: kWh
      device_class: energy
      state_class: total       

And the status in developer tools is listed like this:

I’ve tried to several things, including changing state_class to measurement, … nothing helped.

Also a reset of energy dashboard did not improve the situation.

Could anybody give some advice?

Greetings,
Heiko

I would like to add information, that the Energy Dashboard worked fine for a year with my energy sensor definitions, but suddenly (but I don’t know from when on) the sensor could not be added.

Maybe it is influenced by something beside the sensor or the dashboard itself?
Recorder or database? Could anybody explain how to check this?

Found this in the logs:

Logger: homeassistant.components.websocket_api.http.connection
Source: core.py:1500 
Integration: Home Assistant WebSocket API (documentation, issues) 
First occurred: 07:11:47 (15 occurrences) 
Last logged: 08:06:22

[139826959212224] Error handling message: Unknown error (unknown_error) Heiko from 88.153.88.137 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Safari/605.1.15)
[139829017173952] Error handling message: Unknown error (unknown_error) Heiko from 88.153.88.137 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Safari/605.1.15)
[139824562596288] Error handling message: Unknown error (unknown_error) Heiko from 88.153.88.137 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Safari/605.1.15)
[139824565521088] Error handling message: Unknown error (unknown_error) Heiko from 88.153.88.137 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Safari/605.1.15)
[139828623677120] Error handling message: Unknown error (unknown_error) Heiko from 88.153.88.137 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Safari/605.1.15)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/recorder/websocket_api.py", line 334, in ws_get_statistics_metadata
    metadata = await async_list_statistic_ids(hass, statistic_ids_set_or_none)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/recorder/statistics.py", line 701, in async_list_statistic_ids
    return await instance.async_add_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/recorder/statistics.py", line 769, in list_statistic_ids
    result = _statistic_by_id_from_metadata(hass, metadata)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/recorder/statistics.py", line 714, in _statistic_by_id_from_metadata
    return {
           ^
  File "/usr/src/homeassistant/homeassistant/components/recorder/statistics.py", line 716, in <dictcomp>
    "display_unit_of_measurement": get_display_unit(
                                   ^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/recorder/statistics.py", line 185, in get_display_unit
    if state := hass.states.get(statistic_id):
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 1500, in get
    return self._states.get(entity_id.lower())
                            ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'lower'

Best regards
Heiko