Weather forecast for Australia using BOM website

I’m in Melbourne and find using Yahoo, Dark Sky and others weather components give really poor weather forecasts for Australian cities.

So I’ve used the scape sensor to pull data from

I’ve been testing it for a couple of weeks and it is working okay. I get

  • Forecast maximum and minimum
  • UV forecast (UV index and times to avoid the sun)
  • Fire danger

I get a notification on my phone in the morning day’s forecast and evening with the evening and next day’s forecast, plus a group on the Home Assistant dashboard.

Morning notification

Evening notification

I haven’t quite figured out all of the ins and outs of scape, there’s no doubt a more sophisticated way to search for specific tags within the HTML. This has been working so far, but would welcome some more input.

Here’s my code, which is split across group.yaml, sensor.yaml and automation.yaml

For local current temperatures, I’ve used Open Weather Map to pick up a nearby weather station, using sensors like sensor.owm_temperature

# Group - in my group.yaml

     name: "Weather"
     view: yes
      - sensor.melbourne_maximum
      - sensor.melbourne_minimum
      - sensor.melbourne_summary
      - sensor.melbourne_uv_forecast
      - sensor.melbourne_forecast_line3   

# Sensor - in my sensor.yaml

# Scrape sensor for BOM weather forecasts
# Using scrape component to grab some HTML and put it in a value
# Follow guide at

  - platform: scrape
    name: Melbourne maximum
    select: '.max'
    unit_of_measurement: 'Max °C'
  - platform: scrape
    name: Melbourne minimum
    select: '.min'
    unit_of_measurement: 'Min °C'

  - platform: scrape
    name: Melbourne summary
    select: 'p:nth-of-type(4)'
    # unit_of_measurement: 'Nil'
  - platform: scrape
    name: Melbourne UV forecast
    select: 'p:nth-of-type(5)'
    # unit_of_measurement: 'Nil'

  - platform: scrape
    name: Melbourne forecast line3
    select: 'p:nth-of-type(6)'
    # unit_of_measurement: 'Nil'

  - platform: openweathermap 
    api_key: !secret openweathermap_api_key
    forecast: 0
      - weather
      - temperature
      - wind_speed
      - humidity
      - pressure
      - clouds
      - rain

# Automation - in my automation.yaml

  - alias: 'Send notification when sun rises'
      platform: sun
      event: sunrise
      offset: '+00:30:00'
      service: notify.html5
        message: "Good morning! Forecast: {{ states('sensor.melbourne_summary') }}, temp {{ states('sensor.melbourne_minimum') }} - {{ states('sensor.melbourne_maximum') }}°c  {{ states('sensor.melbourne_uv_forecast') }} Next line: {{ states('sensor.melbourne_forecast_line3') }} Now: {{ states('sensor.owm_temperature') }}°c {{ states('sensor.owm_condition') }}, {{ states('sensor.owm_rain') }}" 

  - alias: 'Send notification when sun sets'
      platform: sun
      event: sunset
      offset: '+00:00:00'
      service: notify.html5
        message: "The sun has set. Forecast: {{ states('sensor.melbourne_summary') }}, temp {{ states('sensor.melbourne_minimum') }} - {{ states('sensor.melbourne_maximum') }}°c  Now: {{ states('sensor.owm_temperature') }}°c {{ states('sensor.owm_condition') }}, {{ states('sensor.owm_rain') }}"

Nice! I might use some of this.
I currently use this component:

Although it doesn’t give you the nice ‘text’ explanation.

I realised I actually use the ‘sensor’ version of that component:

They only give current observations, whereas mine gives the forecast :slight_smile:

ah! of course. Halfway through editing it in now :slight_smile:

@enzymes Thanks for this, I’ve added this to my configuration and are also using it for my Google Home TTS reports.


just finished that myself :slight_smile:

two code sections below if anyone is interested.
Haven’t actually tested the ‘time’ trigger yet - hoping it turns on in the morning.

  - alias: 'Morning Weather and News'
      platform: time
      after: "07:15:00"
      condition: and
        - condition: time
            - mon
            - tue
            - wed
            - thu
            - fri
        - condition: state
          entity_id: group.all_devices
          state: home
      service: homeassistant.turn_on
      entity_id: script.morning_brief

#The morning brief - say the weather, then turn on radio national until we leave.
  alias: "The Morning Brief"
    - service: media_player.sonos_join
        master: media_player.living_room
        entity_id: media_player.bedroom
    - service: media_player.volume_set
        entity_id: media_player.living_room
        volume_level: 0.4
    - service: media_player.volume_set
        entity_id: media_player.bedroom
        volume_level: 0.2
    - service: tts.google_say
        entity_id: media_player.living_room
        message: "Good morning! The weather forecast for today is {{ states('sensor.melbourne_summary') }} with a minimum temperature of {{ states('sensor.melbourne_minimum') }} degrees and maximum of {{ states('sensor.melbourne_maximum') }} degrees.  It's currently {{ states('sensor.bom_current_weather_air_temp_c') }} degrees outside."
    - delay: 60
    - service: media_player.play_media
        entity_id: media_player.living_room
        media_content_id: "aac://"
        media_content_type: MUSIC

Nice one @enzymes

Fellow Melbournian here, so will be sure to use some of this!

Surely you Melbornians need a forecast 4 times a day to know in which order the 4 seasons will be applied that day!


At least the automation can be tweaked to do that - HASS to the rescue.

Phil - from Perth!


Very impressive @perrin7 ! I’ll have to get a media player :grinning:

1 Like

Great work here

1 Like

For anyone else who might find it useful, chance of rain today sensor.

- platform: scrape
    name: chance of rain
    select: '.pop'
    # unit_of_measurement: '%'

great work everyone really helpfull

I’m going to have a go at displaying the wind data from bom point wilson aws (no temp avail)
and the temp and wind from the wunderground clifton springs pws as there isnt a sensor close to portarlington. I can let you know if its successful if anyone has an interest


Hi !

I’ve got a newbie question…
When you write : select: '.pop'
How do you know which day it is ? Because it exits a .pop for each day on the website !!

thank you !!

I was hoping someone else would answer because I don’t really know @Will711990, I found that through trial and error and I am guessing it’s the first instance of .pop in the scrape. It seems to be correct for current day. I am sure the guys here who know what they are doing will .pop back in eventually. The 'p:nth-of-type… in the other scrape sensors here seems to be likely scraping through instances of data so I’d probably start googling from there.

By the way, the data returned for chance of rain includes a “%” sign which mucks up the HaDashboard display if your using it. You can get around it with a value template, I also use same sort of thing for converting the temperature to a whole number for TTS purposes so it doesn’t announce the temperature as “twenty six” “seven two” degrees.

I can’t be arsed converting to the thread standard Melbourne config today so straight copy paste.

  - platform: scrape
    name: rain chance
    select: '.pop'


# Rain Chance % sign stripper
- platform: template
        friendly_name: 'Chance of Rain'
        value_template: '{{ states.sensor.rain_chance.state | replace("%","") }}'

# Belambi Air Temp Whole No
- platform: template
        friendly_name: 'Belambi Current Temp'
        value_template: '{{ states.sensor.bom_bellambi_air_temp_c.state | round }}'

Hi Will
I use the following method to get the ‘select’ value:

  • In google chrome, do Ctrl+Shift+I to bring up the ‘inspect’ panel.

  • click on the box in the top left of the panel to start ‘visual selection’

  • click on the element you want

  • this will highlight the element in the side bar

  • right click on the element in the code and go Copy -> Copy Selector (screenshot below)

  • this gives you:
    #post_14 > div > div.topic-body.clearfix > div.topic-meta-data > div.names.trigger-user-card > span > a

  • you can use this as the ‘select’ (obviously not a great example using the forum as its a bit more dynamic than a weather page!)

See how you go!


Hijacking this thread to see if anyone in Melbourne is interested in a meetup?

I’ve created a meetup group, please join if your interested, and we can set up a pub session to chat about projects!

ping: @enzymes @philhawthorne @kiwinol

good one. Will join the meet up.

Hi all, just wondering how you guys are using this method for scraping the summary forecasts now there is a limit on the number of characters in the sensor state? I get errors trying to scrape the longer summaries now in version 0.57. Sensor state is limited to 255 characters (

I can’t get the -weather sensor to work