Restful sensor and statistic graph

I added a new rest sensor. The configuration is:

/homeassistant/configuration.yaml:

sensor: !include_dir_merge_list sensor/
homeassistant:
  customize: !include customize.yaml

/homeassistant/sensor/aqicn.yaml:

- platform: rest
  resource: https://api.waqi.info/feed/A94354/?token=<myapikey>
  method: GET
  name: "PM25"
  scan_interval: 300
  value_template: "{{ value_json.data.iaqi.pm25.v | int}}"
  unique_id: externalSensorPM25

/homeassistant/customize.yaml:

sensor.PM25:
    state_class: measurement
    unit_of_measurement: "µg/m³"
    device_class: pm25

The configuration seems to work since I am able to show the current value in the entities card in the UI. Clicking in the entity card I can also see the historical values.

I also tried to add a statistic graph card. I can select the sensor, but the chart always says Loading statistics.... I have more than 1 day of data at this point, so not sure what is the problem.
Can someone help?

I answer to myself. The problem was that I added the unit_of_mesurement after some time. Going to developer-tools/statistics I found that there was a consistency problem on the data.
I clicked on FIX ISSUE and now it it working!

Entity ids do not use capital letters. This customization:

sensor.PM25:
    state_class: measurement
    unit_of_measurement: "µg/m³"
    device_class: pm25

Should be:

sensor.pm25:
    state_class: measurement
    unit_of_measurement: "µg/m³"
    device_class: pm25
1 Like