RESTful sensor json help - Australian tide predictions (BOM)

Hi all - good you have been able to resolve the issue.

I just used the user agent from my work pc (windows 11 using chrome)

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36

Anyone having issues accessing this now?

I’ve been accessing this data using command_line: with success until recently. Before I move over to rest, I just want to check that it’s still working for others.

update - got it working with rest:

Adding my thanks to those who’ve alredy worked this through in the thread. My minor variation on a theme is to switch to timestamps as device class to get the automatic rendering as follows:

rest:
  # BOM Tides
  - resource: "https://www.bom.gov.au/australia/tides/scripts/getNextTides.php?aac=TAS_TP003&offset=false&tz=Australia%2FHobart"
    scan_interval: 21600  # 6 hours
    method: GET
    headers:
      User-Agent: Mozilla/5.0
      Accept: application/json
    sensor:
      - name: Tide Sensor Last updated
        value_template: "{{ value_json.results.current_time | timestamp_local }}"
        device_class: timestamp
      - name: Hobart High Tide Time
        value_template: "{{ value_json.results.next_high.time | timestamp_local }}"
        device_class: timestamp
      - name: Hobart High Tide Height
        value_template: "{{ value_json.results.next_high.height }}"
        device_class: distance
        unit_of_measurement: m
      - name: Hobart Low Tide Time
        value_template: "{{ value_json.results.next_low.time | timestamp_local }}"
        device_class: timestamp
      - name: Hobart Low Tide Height
        value_template: "{{ value_json.results.next_low.height }}"
        device_class: distance
        unit_of_measurement: m

which I then threw into an entity card and added the ‘state’ as secondary objects to the times so I have both the actual time of the next low/high/last updated as well as the relative time to now


This working post BOM-Website refresh with a minimal user-agent

(What is it that most of the people working in this thread seem to be in Tassie :slight_smile: )

1 Like

I just tried playing with your code - by adding it into configuration.yaml & changing the BOM code for my location. Unfortunately, I get “Unknown” as the rest.

Got it to work with further examples above, after spending an hour or so going down a vibe coding cesspit.

Question on the tidal data - seems like the BOM tidal information is pretty limited, only 3-4 locations in Sydney for example? The tidal data is out by an hour for high-tide and 30-minutes low-tide (I’m downstream of Botany Bay which is closest data point BOM provides). But I see WillyWeather has more accurate locational data, shame about the paid API.