REST sensor does not return attributes

I'm trying to make a sensor to retrieve tide data from the Australian Bureau of Meteorology, need some help getting it to work.

The data comes from here: https://www.bom.gov.au/australia/tides/scripts/getNextTides.php?aac=SA_TP002&offset=false&tz=Australia%2FAdelaide

which returns this

{ "results": { "current_time": 1781604826, "next_high": { "time": 1781640240, "height": 1.43 }, "next_low": { "time": 1781619840, "height": 0.48 } } }

My configuration.yaml has this

rest:
  - resource: https://www.bom.gov.au/australia/tides/scripts/getNextTides.php?aac=SA_TP002&offset=false&tz=Australia%2FAdelaide
    scan_interval: 3600
    sensor:
      - name: port_giles_tides
        value_template: "OK"
        json_attributes_path: "$.results.next_high"
        json_attributes:
          - "time"
          - "height"

All I'm getting is a status of OK and no attributes. I'm sure it's something simple I'm missing, trying the same syntax on a sample json site with the same levels of nesting works fine.

Kevin

what about just making them separate sensors?

rest:
  - resource: https://www.bom.gov.au/australia/tides/scripts/getNextTides.php?aac=SA_TP002&offset=false&tz=Australia%2FAdelaide
    scan_interval: 3600
    sensor:
      - name: Next High Tide
        value_template: "{{ value_json.results.next_high.time | as_datetime | as_local }}"
        device_class: timestamp
        unique_id: next_high_tide

      - name: Next High Tide Height
        value_template: "{{ value_json.results.next_high.height }}"
        device_class: distance
        unit_of_measurement: m
        unique_id: next_high_tide_height

Thanks Petro. Tried this, and I get a status returned of 'unknown'.

Is there a way to check that HA is getting the same JSON from the web link as my browser?

Yes, turn on debugging for that integration and watch the logs

If you set it up as a Rest command the response variable shows:

Try adding a user agent so it looks like a web browser.

rest:
  - resource: https://www.bom.gov.au/Etc...
    headers:
      User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
      Content-Type: application/json

Thanks all, this was the problem.