Maybe not for this topic, but the solution is to define a sensor for your sensor using template. In this you define that it is about a measurement. I got it working like this:
template:
- sensor:
- name: "Solarman Cumalative Production"
unit_of_measurement: "kWh"
state: >
{{ (states("sensor.cumulative_production_kwh") | float) | round(2) }}
device_class: energy
state_class: measurement
attributes:
last_reset: "1970-01-01T00:00:00+00:00"