How to use Statistic Card or why are my custom sensors are not visible?

Hi,

I’m a “long-term” developer of a custom component (MBAPI2020, Mercedes Car Integration) and now I’m struggeling to get the simple things right. I spend hours now in the HA source code, Websocket Messages between backend and frontend.

Problem:

  • I have a sensor “Liquid Consumption since start”, Unit of measurement is “L/100Km” (or same like this depended on country of usage), Device_class is None (as this unit is unknown in HA), State_class is “SensorStateClass.MEASUREMENT”
  • I see the statistics records in the database
  • When I add a statistics graph card, I see my units in the frontend, but I can’t select the sensor in the dropdown (Screenshot 1+2)
  • When I take look on the websocket communication, I can see that my statistics are in the response. (Screenshot 3)

Question: Why is my sensor not selectable in the frontend? Looks like that only sensors with a device/unit class are selectable…

And… Yes, I can add my sensor in the code editor, the chart looks good from a meta data perspective, but no line is drawn.

Does anyone can help me here?
Thx
Rene

Screenshot 1:

Screenshot 2:
Screencast from 2023-02-11 18-30-28

Screenshot 3:

After the pulling the latest DEV its working again. Looks like I checked this in the middle of a set of changes. (The recorder/statistic(s)_during_period websocket API now require the statistic_id(s) field by bdraco · Pull Request #87937 · home-assistant/core · GitHub, Fix stats data being fetched for all entities when there are no energy/water stat ids by bdraco · Pull Request #15428 · home-assistant/frontend · GitHub)