Statistic data not available

Hi all

I have been playing around with HA for a few weeks and getting to grips with it.

I’m trying to automate my electric heating to switch on based excess Solar power. I have been reading a few options and I’m just trying create a statistic to measure the excess solar over a period of time to avoid the constant switching on and off the heating.

The statistic below does not seem to be available for me to select anywhere. I have it in my sensor.yamal and have sensor: !include sensor.yaml in my config file.

I have read up on the stats page on HA but can not figure out why I can not see the value. Excess_Solar is working fine

Any suggestions? TIA

# Excess Power from Solar
- platform: template
  sensors:
    excess_solar:
      friendly_name: Excess_Solar
      unit_of_measurement: "W"
      value_template: '{{ (states("sensor.pv_power") | float - states("sensor.load_power") | float) }}'

#  Average excess power over 5 mins
- platform: statistics
  name: Excess_Power_Mean
  entity_id: sensor.Excess_Solar
  state_characteristic: mean
  max_age:
    minutes: 5

``````````````````````````````````````````````````````````

Did you restart home assistant after creating it?

Yeah. Quite a few times

Entity ids do not have capital letters in them.

That one seems to work but changes anyway and still no luck

Then you have a Home Assistant instal unlike everyone else.