Riemann sensor valueerror

Hi.
Have a self made integration for my StecaGrid solar power inverter.
I have then added a Riemann sensor for summarizing the energy it produces.
That went well for a period of time, but lately I get this error:

2024-03-11 16:22:13.606 ERROR (MainThread) [homeassistant.helpers.event] Error while dispatching event for sensor.stecagrid_power to <Job track state_changed event ['sensor.stecagrid_power'] HassJobType.Callback <function IntegrationSensor.async_added_to_hass.<locals>.calc_integration at 0x7f3acc2e5a80>>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 330, in _async_dispatch_entity_id_event
    hass.async_run_hass_job(job, event)
  File "/usr/src/homeassistant/homeassistant/core.py", line 727, in async_run_hass_job
    hassjob.target(*args)
  File "/usr/src/homeassistant/homeassistant/components/integration/sensor.py", line 325, in calc_integration
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 992, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1113, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1050, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 681, in state
    raise ValueError(
ValueError: Sensor sensor.stecagrid_power_total has device class 'energy', state class 'total' unit 'kWh' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-finite value: 'NaN'

In my energy dashboard I don’t get any date for my solar panel because of that.
I just can’t get my head around what suddently is wrong :thinking:

This sensor sent some non numeric data. You may be able to fix it by going to Developer Tools → Statistics and pressing the FIX ISSUE button beside the entity.

Also it would be less confusing if you did not name your energy sensors with “power” in the entity id. Power and energy are different things.

Hi
Now it is the same issue again (has been a couple of times since)…
I don’t get what is wrong:

It seems like a HA update did this unintentional.
billede

It looks correct to me:

The ‘Stecagrid’ integration was made by me - so there might something wrong there, but i see the correct value so i think it is ok.

What related errors do you see in Settings → System → Logs?