Australian Weather Forecast using BOM Public FTP

I just tried.

      bom_today_max:
        entity_id:
          - sensor.bom_gosford_max_temp_c_0
        value_template: >
          {%- if states('sensor.bom_gosford_max_temp_c_0') == 'n/a' -%} 
            {{ state_attr('sensor.today_temp_bom_mean', 'max_value') }}
          {% else %}
            {{ states('sensor.bom_gosford_max_temp_c_0') }}
          {% endif %}
      bom_today_min:
        entity_id:
          - sensor.bom_gosford_min_temp_c_0
        value_template: >
          {%- if states('sensor.bom_gosford_min_temp_c_0') == 'n/a' -%} 
            {{ state_attr('sensor.today_temp_bom_mean', 'min_value') }}
          {% else %}
            {{ states('sensor.bom_gosford_min_temp_c_0') }}
          {% endif %}

  - platform: statistics
    name: today_temp_bom
    sampling_size: 50
    entity_id: sensor.bom_gosford_air_temp_c
    max_age:
      hours: 12

But even though the templates work in the template tool, I get unknown in the state for sensor.bom_today_max and sensor.bom_today_min and I donā€™t understand why!

@petro any clue?

image

Why the ā€œ-ā€ ?

beats meā€¦ it removes whitespace right? It gives the same result in the editor with/without or are you sufggesting thatā€™s the issue?

nope - just not seen it before - but not done much with templating - as you were typing I found a description about - still not entirely sure what its actually doing.

You can see the statistics sensor and the 2 template sensor values here as well. I just donā€™t see why itā€™s not working.

Well crapā€¦ Turns out the sensors are not getting updatedā€¦ oh crap! I should include the statistics sensor in the template I thinkā€¦

Yes that fixed it.

2 Likes

So for anyone following this, here is what I added to my weather package to fix this n/a:

      bom_today_max:
        entity_id:
          - sensor.bom_gosford_max_temp_c_0
          - sensor.today_temp_bom_mean
        value_template: >
          {%- if states('sensor.bom_gosford_max_temp_c_0') == 'n/a' -%} 
            {{ state_attr('sensor.today_temp_bom_mean', 'max_value') }}
          {% else %}
            {{ states('sensor.bom_gosford_max_temp_c_0') }}
          {% endif %}
      bom_today_min:
        entity_id:
          - sensor.bom_gosford_min_temp_c_0
          - sensor.today_temp_bom_mean
        value_template: >
          {%- if states('sensor.bom_gosford_min_temp_c_0') == 'n/a' -%} 
            {{ state_attr('sensor.today_temp_bom_mean', 'min_value') }}
          {% else %}
            {{ states('sensor.bom_gosford_min_temp_c_0') }}
          {% endif %}

  - platform: statistics
    name: today_temp_bom
    sampling_size: 150
    entity_id: sensor.bom_gosford_air_temp_c
    max_age:
      hours: 24

So if either the min or the max is n/a, it will use the statistics sensor to give you the lowest or highest temperature for the past 24 hours.

I guess I could screw around some more with a template to refine the hours from 24 to the number of hours since midnight but it doesnā€™t seem to be worth the trouble.

Anyone else with this issue ā€œIntegration bom_forecast not found when trying to verify its sensor platform.ā€ seems to be a problem with Custom Components using HASS.IO v0.93 or higher?

No problems here. Iā€™m on 0.94.3 right now.

Problem was resolved with the blank init.py file

Hi All,

I am in the process off getting my head around HA.

One of the things I want to be able to have is the weather, (I live in Adelaide SA Australia).
Found a few about the BOM, this topic seems to have what I would like, forecast, daily and radar map.

As I am a newbie, can some be able to post the latest working code, and the required folders, to be able to get it working, in both yaml and Lovelace cards

Thanks in advance
Deblen

Ok after finally getting this to work I have struck a few issues. Lithgow gets it data from deep within IDN11060. I have had to add IDN11060 to the sensor.py file for it to even look at it and give some data, but itā€™s only giving the generic Sydney info, and thatā€™s absolutely useless here.

Is there any way to read a sub section of a file based on this ā€œparentā€ area and the locationā€™s name??

Same problem I have living in central Victoria.
As such I wrote another weather component based on the www.willyweather.com.au data (from BoM) that takes readings from nearby weather stations, rather than a single one. That way, all the data is populated.
Look for WillyWeather in these forums if you are interested.

Hi - I upgraded to the HACS version of this integration from one I manually installed. My only change to the config was to add the icon, fire danger and UV.

I use friendly mode, and now I only get only one day sensor (tomorrow).

Based on the error in the logs, I removed the new monitored conditions and it now works. Any suggestions?

  - platform: bom_forecast
    name: MyName
    forecast_days: 6
    rest_of_today: True
    friendly: true
    friendly_state_format: '{min} to {max}, {summary}'
    product_id: IDV10703
    monitored_conditions:
      - 'max'
      - 'min'
      - 'chance_of_rain'
      - 'possible_rainfall'
      - 'summary'
      - 'detailed_summary'
      - 'icon'
      - 'uv_alert'
      - 'fire_danger'

This is the error in the logs:

Log Details (ERROR)
Thu Dec 05 2019 17:34:59 GMT+1100 (Australian Eastern Daylight Time)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 275, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 309, in _async_write_ha_state
    state = self.state
  File "/config/custom_components/bom_forecast/sensor.py", line 361, in state
    condition, self._index))
  File "/config/custom_components/bom_forecast/sensor.py", line 425, in get_reading
    _FIND_QUERY.format(index, 'uv_alert')).text
AttributeError: 'NoneType' object has no attribute 'text'

I have only tested:

    friendly_state_format: '{max}, {summary}'

With the icon and new conditions. Did you try that?

Just testing a fix for this now. Will release a new version shortly. Thanks to @exxamalte again!

1 Like

Hi all, I have this in the config yaml.

sensor:
  - platform: bom_forecast
    product_id: IDW12300
    name: Perth
    forecast_days: 6
    rest_of_today: True
    friendly: True
    friendly_state_format: '{max}, {summary}'
    monitored_conditions:
      - 'max'
      - 'min'
      - 'chance_of_rain'
      - 'possible_rainfall'
      - 'summary'
      - 'detailed_summary'
      - 'fire_danger'
      - 'uv_alert'

When I add the glance card, I find that the icons are missing for some days.

Annotation 2020-01-27 121605

Also, I could not figure out how to produce a glance card that is like this?

Appreciate help please.

This component (an updated component with more features) and the Lovelace card are both available in HACS. Maybe check this thread here https://community.home-assistant.io/t/customising-the-bom-weather-and-lovelace-now-in-hacs/

Many thanks David. I have now installed HACS, and installed both the BOM Forecast integrations + BOM Weather Card plugins as per instruction.

I have also added the following to config yaml

sensor:
  - platform: bom_forecast
    product_id: IDW12300
    name: Perth
    forecast_days: 6
    rest_of_today: true
    friendly: false
    friendly_state_format: '{max}, {summary}'
    monitored_conditions:
      - 'max'
      - 'min'
      - 'chance_of_rain'
      - 'possible_rainfall'
      - 'summary'
      - 'detailed_summary'
      - 'icon'
      - 'uv_alert'
      - 'fire_danger'

But I still could not figure out how to create that cool looking glance card like the image above? I know I am missing something I just could not figure out what?

Please use the other thread and post your BOM component configuration as well as the FTP component and post your lovelace configuration as well. Canā€™t really help without much more info.