Newbie - REST issue - Environment Agency Real Time Rainfall

The issue is I’m new to HA, (and JSON and APIs)! Go Gentle

I want to display the following data (value and date/time of reading) on my dashboard:
https://environment.data.gov.uk/flood-monitoring/id/measures/070365-rainfall-tipping_bucket_raingauge-t-15_min-mm

Ideally I want to collect and graph data over time but I’ll take just displaying the value for now, I have set the following up but it tells me that value is not numeric and I’m not sure what I have got wrong.

# EA Rainfall Sensor at Keld Head
sensor:
  - platform: rest
    resource: https://environment.data.gov.uk/flood-monitoring/id/measures/070365-rainfall-tipping_bucket_raingauge-t-15_min-mm
    name: Keld Head Rainfall
    #Check every 15 mins
    scan_interval: 900
    force_update: true
    value_template: "{{ value_json['items'][0]['latestReading']['value'] }}"
    unit_of_measurement: mm

Any pointers appreciated
Dave

In the JSON returned by the link (posted above), items doesn’t contain a list so remove the reference to a list index.

value_template: "{{ value_json['items']['latestReading']['value'] }}"

Awesome thanks. Need to learn what I’m looking at with json. Definitely in blundering mode at moment.
Our local flood level station is a list of 1 (also from EA). Which is probably where I went wrong.

Thanks. All up and running.

1 Like

Is this still working for you @FootSore ?

I’m getting a 0.0 value from station E22322 when it has definitely rained!

Thanks