Australian Weather Forecast using BOM Public FTP

@so3n Thanks for grabbing the changes I made. Hopefully they pass your testing and will make it through.

Glad I was able to contribute to this great addition to HA :+1:

2 Likes

Terrific job! Thanks so much!

1 Like

Great thinking to have the friendly /all output options too :grin:

1 Like

Thought I’d post this small mod I made to the lovelace weather card to get a bit more detail for today and tomorrow. But you could build up whatever you like with a template.

todayTommorrow

In config under sensor:

  - platform: template
    sensors:
      today_tommorrow_weather_summary:
        friendly_name: 'Today & Tommorrow Weather Summary'
        value_template: "Today: {{states.sensor.bom_forecast_melbourne_0.state}} {{-'\n'}} Tomorrow: {{states.sensor.bom_forecast_melbourne_1.state}}"

Then just use in for your entity_daily_summary:

    cards:
      - type: custom:dark-sky-weather-card
        entity_sun: sun.sun
        entity_daily_summary:  sensor.today_tommorrow_weather_summary
        entity_current_conditions: sensor.dark_sky_icon
        entity_humidity: sensor.humidity_158d0001b92424
        entity_pressure: sensor.pressure_158d0001b92424
        entity_temperature: sensor.temperature_158d0001b92424
        entity_visibility: sensor.dark_sky_visibility
        entity_wind_bearing: sensor.bom_wind_bear
        entity_wind_speed: sensor.bom_wind_sp
        entity_forecast_high_temp_1: sensor.bom_melbourne_spilt_max_temp_c_1
        entity_forecast_high_temp_2: sensor.bom_melbourne_spilt_max_temp_c_2
        entity_forecast_high_temp_3: sensor.bom_melbourne_spilt_max_temp_c_3
        entity_forecast_high_temp_4: sensor.bom_melbourne_spilt_max_temp_c_4
        entity_forecast_high_temp_5: sensor.bom_melbourne_spilt_max_temp_c_5
        entity_forecast_low_temp_1: sensor.bom_melbourne_spilt_min_temp_c_1
        entity_forecast_low_temp_2: sensor.bom_melbourne_spilt_min_temp_c_2
        entity_forecast_low_temp_3: sensor.bom_melbourne_spilt_min_temp_c_3
        entity_forecast_low_temp_4: sensor.bom_melbourne_spilt_min_temp_c_4
        entity_forecast_low_temp_5: sensor.bom_melbourne_spilt_min_temp_c_5
        entity_forecast_icon_1: sensor.dark_sky_icon_1
        entity_forecast_icon_2: sensor.dark_sky_icon_2
        entity_forecast_icon_3: sensor.dark_sky_icon_3
        entity_forecast_icon_4: sensor.dark_sky_icon_4
        entity_forecast_icon_5: sensor.dark_sky_icon_5
4 Likes

Hi All,

Can someone please help me to extract the possible_rainfall for a specific day from the forecast entity?

I tried the below but it doesn’t work and templates are not my strong point by any means.

value_template: "{{ states.sensor.bom_forecast_perth_weather_forecast_0.attributes.possible_rainfall }}"

Hi there, just update your code and for some reason only getting the current day showing, days 2-5 don’t show now. Dropped it back to show 3 days and still the same issue. Just the current day showing. Anything obvious I could be missing?.. Thanks!
Untitled

Example of what is in the logs

2018-12-04 11:01:20 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 352, in _async_add_entity
await entity.async_update_ha_state()
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 232, in async_update_ha_state
state = self.state
File “/home/homeassistant/.homeassistant/custom_components/sensor/bom_forecast.py”, line 354, in state
friendly_state = friendly_state.replace(’{{{}}}’.format(condition), self._bom_forecast_data.get_reading(condition, self._index))
File “/home/homeassistant/.homeassistant/custom_components/sensor/bom_forecast.py”, line 398, in get_reading
detailed_summary = self._data.find(_FIND_QUERY_2.format(index, SENSOR_TYPES[condition][0])).text
AttributeError: ‘NoneType’ object has no attribute ‘text’

@sparkydave This should work:

"{{ state_attr('sensor.bom_forecast_perth_weather_forecast_0', 'Possible Rainfall') | replace("mm", "") | float }}"

If you’re using the dev branch from github, you will need to update your configuration.yaml file as per the readme.

Off memory you need to replace friendly configuration item with mode and pick one of the 3 options.

@tom_l champion! that seems to work in my template dev tool so I’ll give it a try in my code. Thanks

Thanks for the response. So the friendly mode only creates the current sensor for that day? Not up to five as it was before? I prefer the friendly view, but this is no good if it is just one day at a time. Cheers

No you still should get the number of days you specify in configuration.yaml

Here’s mine as an example, although for mode I’m using all (both friendly and separated sensors)

- platform: bom_forecast
  product_id: IDV10450
  name: Melbourne
  forecast_days: 5
  rest_of_today: True
#   friendly: False
  mode: all
  friendly_state_format: '{max}, {summary}'
  text_if_no_value: 'N/A'
  monitored_conditions:
    - 'max'
    - 'min'
    - 'chance_of_rain'
    - 'possible_rainfall'
    - 'summary'
    - 'detailed_summary'

conf

Unusual then

Not sure, only thing I would suggest is having a look in ‘states’ under developer tools in home assistant frontend to check if the sensor names got renamed

I just tried it. Works for me with this config:

- platform: bom_forecast
  product_id: IDT13600
  name: Hobart
  forecast_days: 6
  rest_of_today: True
  mode: friendly
  friendly_state_format: '{min} to {max}, {summary}, {chance_of_rain} chance of {possible_rainfall} rain'
  text_if_no_value: '-'
  monitored_conditions:
    - 'max'
    - 'min'
    - 'chance_of_rain'
    - 'possible_rainfall'
    - 'summary'
    - 'detailed_summary'

@grantc, check the contents of your \config\custom_components\sensor\bom_forecast.py file. Depending on how you downloaded it from github the format can be messed up. Best way is to use the green clone or download button and download a zip archive.

@so3n, any idea how I can get a line feed in my friendly state format?

Thanks Tom, will give it a try - just d/loaded in raw format before and has never been an issue. Still just wants to create the one sensor. No dramas will roll back to an older version.

What happens if you remove the fire danger ans UV alert monitored conditions?

Good pick up Tom - it appears the UV and Fire Danger attributes are the issue. I use the UV rating to send alerts, so still need to roll back to older version unfortunately.

what do you mean by this?

I meant an output like this:

12°C to 20°C
Mostly sunny.

This is the solution for single quoted scalars according to the YAML docs :

  forecast_days: 6
  rest_of_today: True
  friendly_state_format: '{min}°C to {max}°C

    {summary}'
  text_if_no_value: '-'
  monitored_conditions:
    - 'max'

But it does not work.

@sparkydave, Just realised that isn’t going to work for forecasts like this “2 to 8 mm”.