Actually a bit more complex than that.
The core.entity_registry
will help you find the config_entry_id
of the statistics sensor.
{"aliases":[],"area_id":null,"categories":{},"capabilities":{"state_class":"measurement"},"config_entry_id":"01JVSH8WASP16AXAT7YPD7H0FV","config_subentry_id":null,"created_at":"2025-05-21T13:42:05.402758+00:00","device_class":null,"device_id":null,"disabled_by":null,"entity_category":null,"entity_id":"sensor.home_temperature_average","hidden_by":null,"icon":null,"id":"7d4c14834a4c54756c800e470bf4e513","has_entity_name":false,"labels":[],"modified_at":"2025-05-21T13:42:05.407770+00:00","name":null,"options":{"conversation":{"should_expose":true}},"original_device_class":"temperature","original_icon":"mdi:calculator","original_name":"Home Temperature Average","platform":"statistics","supported_features":0,"translation_key":null,"unique_id":"01JVSH8WASP16AXAT7YPD7H0FV","previous_unique_id":null,"unit_of_measurement":null}
"config_entry_id":"01JVSH8WASP16AXAT7YPD7H0FV"
You then need to take that ID to core.config_entries
, find the matching entry_id, and get the sensor from the options:
{"created_at":"2025-05-21T13:42:05.401722+00:00","data":{},"disabled_by":null,"discovery_keys":{},"domain":"statistics","entry_id":"01JVSH8WASP16AXAT7YPD7H0FV","minor_version":1,"modified_at":"2025-05-21T13:42:05.401724+00:00","options":{"entity_id":"sensor.home_temperature","keep_last_sample":false,"name":"Home Temperature Average","percentile":50.0,"precision":2.0,"sampling_size":10.0,"state_characteristic":"average_linear"},"pref_disable_new_entities":false,"pref_disable_polling":false,"source":"user","subentries":[],"title":"Home Temperature Average","unique_id":null,"version":1}
"entity_id":"sensor.home_temperature"
Unfortunately I’ve had a PR to show this information in the UI waiting for like 9 months, but it’s just sitting not getting reviewed
