Rest sensor not selectable on staticis graph card

Created a custom sensor to pull the water level for a public lake form an API. Its working great, updating nightly and has been for a few days.

rest:
  - scan_interval: 3600
    resource: https://waterservices.usgs.gov/nwis/dv/?format=json&sites=02187010
    sensor:
      - name: "Lake Elevation"
        value_template: >
          {% set i = value_json['value']['timeSeries']
           |selectattr('variable.variableDescription','contains','Elevation')
           |selectattr('variable.options.option.0.value','==','Mean')
           |list|first %}
          {{ i['values'][0]['value'][0]['value'] }}
        unit_of_measurement: 'ft'

I can add it to a mini-graph card, but i can’t select the entity in the default statics graph card. Any ideas?

You can use the history graph card for state data.

If you want long term statistics to be generated for your sensor (so you can use the statistics card) you need to add a state class,

rest:
  - scan_interval: 3600
    resource: https://waterservices.usgs.gov/nwis/dv/?format=json&sites=02187010
    sensor:
      - name: "Lake Elevation"
        state_class: measurement  ### < ---- Add this
        value_template: >
          {% set i = value_json['value']['timeSeries']
           |selectattr('variable.variableDescription','contains','Elevation')
           |selectattr('variable.options.option.0.value','==','Mean')
           |list|first %}
          {{ i['values'][0]['value'][0]['value'] }}
        unit_of_measurement: 'ft'
1 Like