Australian Weather Forecast using BOM Public FTP

Can you look for errors in the log and post those? I’ll try your config tomorrow and see what happens then…
The Fire and UV are specific to my repo… not the original one - I added that and some other features… are you using mine or Brendans? Mine is the one in HACS BTW but Brendans component doesn’t include some features…

I am using your repo from HACS. I think I have most of the errors sorted except for:


Logger: homeassistant.components.template.sensor
Source: components/template/sensor.py:237
Integration: template ([documentation](https://www.home-assistant.io/integrations/template), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+template%22))
First occurred: 8:11:38 PM (1 occurrences)
Last logged: 8:11:38 PM

Could not render template bom_uv_alert_summary: UndefinedError: list object has no element

and I can’t work out how to get the card up on the front end.

so that looks like a template sensor is failing.
Can you post the EXACT weather.yaml you are using (with your specific edits please)
Also which card are you trying to use?

Hi David,
This is my weather.yaml

# Download the BOM icons from https://github.com/DavidFW1960/bom_forecast/blob/3d5c5dce220a302e719f497c0ee755bacda0f04b/bom_icons.zip
# and save them under <config-dir>/www/icons/bom_icons/ (Note this is for the example in the ftp component. This is different to the animated card.)
# For the animated card follow the instructions and put the icons in <config-dir>/www/icons/weather_icons. This is a DIFFERENT icon file to the above.
# Show BOM Satellite and Radar

sensor:

  - platform: bom
    station: !secret my_bom_station
    name: !secret my_bom_name
    monitored_conditions:
      - apparent_t
      - delta_t
      - gust_kmh
      - gust_kt
      - air_temp
      - dewpt
      - rain_trace
      - rel_hum
      - wind_dir
      - wind_spd_kmh
      - wind_spd_kt

  - platform: bom_forecast
    product_id: !secret my_bom_product_id
    name: !secret my_bom_name
    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'
      
  - platform: template
    sensors:

      bom_current_text:
        value_template: >
            {% set val = states('sensor.bom_gosford_summary_0').split('.')[0] %} 
            {{ val | title }}

      bom_uv_alert:
        value_template: >
            {%- if states('sensor.bom_gosford_uv_alert_0') == '##' -%}
            UV Today: No Data
            {%- elif states('sensor.bom_gosford_uv_alert_0') != 'n/a' -%} 
            UV Today: {{ states('sensor.bom_gosford_uv_alert_0') }}
            {%- elif states('sensor.bom_gosford_uv_alert_1') == '##' -%}
            UV Tomorrow: No Data
            {%- else -%}
            UV Tomorrow: {{ states('sensor.bom_gosford_uv_alert_1') }}
            {%- endif -%}

      bom_uv_alert_summary:
        value_template: >
            {%- if states('sensor.bom_gosford_uv_alert_0') == '##' -%} 
            {% set val = 'No Data' %}
            {%- elif states('sensor.bom_gosford_uv_alert_0') != 'n/a' -%} 
            {% set val = states('sensor.bom_gosford_uv_alert_0').split('[')[1].split(']')[0] %}
            {%- elif states('sensor.bom_gosford_uv_alert_1') == '##' -%} 
            {% set val = 'No Data' %}
            {%- elif states('sensor.bom_gosford_uv_alert_1') != 'n/a' -%} 
            {% set val = states('sensor.bom_gosford_uv_alert_1').split('[')[1].split(']')[0] %}
            {%- else -%}
            {%- set val = 'No Data' -%}
            {%- endif -%}
            {{ val | title }} 
          
      bom_fire_danger:
        value_template: >
            {%- if states('sensor.bom_gosford_fire_danger_0') == '##' -%}
            Fire Danger Today: No Data
            {%- elif states('sensor.bom_gosford_fire_danger_0') != 'n/a' -%} 
            Fire Danger Today: {{ states('sensor.bom_gosford_fire_danger_0') }}
            {%- elif states('sensor.bom_gosford_fire_danger_1') == '##' -%}
            Fire Danger Tomorrow: No Data
            {%- else -%}
            Fire Danger Tomorrow: {{ states('sensor.bom_gosford_fire_danger_1') }}
            {%- endif -%}

      bom_fire_danger_summary:
        value_template: >
            {%- if states('sensor.bom_gosford_fire_danger_0') == '##' -%}
            No Data
            {%- elif states('sensor.bom_gosford_fire_danger_0') != 'n/a' -%} 
            {{ states('sensor.bom_gosford_fire_danger_0') }}
            {%- elif states('sensor.bom_gosford_fire_danger_1') == '##' -%}
            No Data
            {%- else -%}
            {{ states('sensor.bom_gosford_fire_danger_1') }}
            {%- endif -%}

      bom_forecast_0:
        entity_id:
          - sensor.bom_today_max
          - sensor.bom_today_min
          - sensor.bom_gosford_chance_of_rain_0
          - sensor.bom_gosford_icon_0
        friendly_name: "Today"
        value_template: >
          {{states('sensor.bom_today_max')|round(0)}}°/{{states('sensor.bom_today_min')|round(0)}}°/{{states('sensor.bom_gosford_chance_of_rain_0')|round(0)}}%
        entity_picture_template: >-
          {%- if states('sun.sun') == 'below_horizon' and (states('sensor.bom_gosford_icon_0') == 'fog' or states('sensor.bom_gosford_icon_0') == 'haze' or states('sensor.bom_gosford_icon_0') == 'light-showers' or states('sensor.bom_gosford_icon_0') == 'partly-cloudy' or states('sensor.bom_gosford_icon_0') == 'showers') -%}
          {{ '/local/icons/bom_icons/' ~ states('sensor.bom_gosford_icon_0') ~ '-night.png' }}
          {%- else -%}
          {{ '/local/icons/bom_icons/' ~ states('sensor.bom_gosford_icon_0') ~ '.png' }}
          {%- endif -%}

      bom_forecast_1:
        entity_id:
          - sensor.bom_gosford_max_temp_c_1
          - sensor.bom_gosford_min_temp_c_1
          - sensor.bom_gosford_chance_of_rain_1
          - sensor.bom_gosford_icon_1
        friendly_name_template: >
          {%- set date = as_timestamp(now()) + (1 * 86400 ) -%}
          {{ date | timestamp_custom('Tomorrow (%-d/%-m)') }}
        value_template: >
          {{states('sensor.bom_gosford_max_temp_c_1')|round(0)}}°/{{states('sensor.bom_gosford_min_temp_c_1')|round(0)}}°/{{states('sensor.bom_gosford_chance_of_rain_1')|round(0)}}%
        entity_picture_template: >-
          {{ '/local/icons/bom_icons/' ~ states('sensor.bom_gosford_icon_1') ~ '.png' }}

      bom_forecast_2:
        entity_id:
          - sensor.bom_gosford_max_temp_c_2
          - sensor.bom_gosford_min_temp_c_2
          - sensor.bom_gosford_chance_of_rain_2
          - sensor.bom_gosford_icon_2
        friendly_name_template: >
          {%- set date = as_timestamp(now()) + (2 * 86400 ) -%}
          {{ date | timestamp_custom('%A (%-d/%-m)') }}
        value_template: >
          {{states('sensor.bom_gosford_max_temp_c_2')|round(0)}}°/{{states('sensor.bom_gosford_min_temp_c_2')|round(0)}}°/{{states('sensor.bom_gosford_chance_of_rain_2')|round(0)}}%
        entity_picture_template: >-
          {{ '/local/icons/bom_icons/' ~ states('sensor.bom_gosford_icon_2') ~ '.png' }}

      bom_forecast_3:
        entity_id:
          - sensor.bom_gosford_max_temp_c_3
          - sensor.bom_gosford_min_temp_c_3
          - sensor.bom_gosford_chance_of_rain_3
          - sensor.bom_gosford_icon_3
        friendly_name_template: >
          {%- set date = as_timestamp(now()) + (3 * 86400 ) -%}
          {{ date | timestamp_custom('%A (%-d/%-m)') }}
        value_template: >
          {{states('sensor.bom_gosford_max_temp_c_3')|round(0)}}°/{{states('sensor.bom_gosford_min_temp_c_3')|round(0)}}°/{{states('sensor.bom_gosford_chance_of_rain_3')|round(0)}}%
        entity_picture_template: >-
          {{ '/local/icons/bom_icons/' ~ states('sensor.bom_gosford_icon_3') ~ '.png' }}

      bom_forecast_4:
        entity_id:
          - sensor.bom_gosford_max_temp_c_4
          - sensor.bom_gosford_min_temp_c_4
          - sensor.bom_gosford_chance_of_rain_4
          - sensor.bom_gosford_icon_4
        friendly_name_template: >
          {%- set date = as_timestamp(now()) + (4 * 86400 ) -%}
          {{ date | timestamp_custom('%A (%-d/%-m)') }}
        value_template: >
          {{states('sensor.bom_gosford_max_temp_c_4')|round(0)}}°/{{states('sensor.bom_gosford_min_temp_c_4')|round(0)}}°/{{states('sensor.bom_gosford_chance_of_rain_4')|round(0)}}%
        entity_picture_template: >-
          {{ '/local/icons/bom_icons/' ~ states('sensor.bom_gosford_icon_4') ~ '.png' }}

      bom_forecast_5:
        entity_id:
          - sensor.bom_gosford_max_temp_c_5
          - sensor.bom_gosford_min_temp_c_5
          - sensor.bom_gosford_chance_of_rain_5
          - sensor.bom_gosford_icon_5
        friendly_name_template: >
          {%- set date = as_timestamp(now()) + (5 * 86400 ) -%}
          {{ date | timestamp_custom('%A (%-d/%-m)') }}
        value_template: >
          {{states('sensor.bom_gosford_max_temp_c_5')|round(0)}}°/{{states('sensor.bom_gosford_min_temp_c_5')|round(0)}}°/{{states('sensor.bom_gosford_chance_of_rain_5')|round(0)}}%
        entity_picture_template: >-
          {{ '/local/icons/bom_icons/' ~ states('sensor.bom_gosford_icon_5') ~ '.png' }}

      bom_forecast_6:
        entity_id:
          - sensor.bom_gosford_max_temp_c_6
          - sensor.bom_gosford_min_temp_c_6
          - sensor.bom_gosford_chance_of_rain_6
          - sensor.bom_gosford_icon_6
        friendly_name_template: >
          {%- set date = as_timestamp(now()) + (6 * 86400 ) -%}
          {{ date | timestamp_custom('%A (%-d/%-m)') }}
        value_template: >
          {{states('sensor.bom_gosford_max_temp_c_6')|round(0)}}°/{{states('sensor.bom_gosford_min_temp_c_6')|round(0)}}°/{{states('sensor.bom_gosford_chance_of_rain_6')|round(0)}}%
        entity_picture_template: >-
          {{ '/local/icons/bom_icons/' ~ states('sensor.bom_gosford_icon_6') ~ '.png' }}

      bom_today_max:
        entity_id:
          - sensor.bom_gosford_max_temp_c_0
          - sensor.today_temp_bom
        value_template: >
          {%- if states('sensor.bom_gosford_max_temp_c_0') == 'n/a' -%} 
            {{ state_attr('sensor.today_temp_bom', '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
        value_template: >
          {%- if states('sensor.bom_gosford_min_temp_c_0') == 'n/a' -%} 
            {{ state_attr('sensor.today_temp_bom', '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

automation:
- alias: 'Update BOM Icons'
  trigger:
    - event: start
      platform: homeassistant
    - entity_id: sun.sun
      platform: state
      to: 'above_horizon'
    - entity_id: sun.sun
      platform: state
      to: 'below_horizon'
  action:
    - service: homeassistant.update_entity
      entity_id: sensor.bom_forecast_0, sensor.bom_forecast_1, sensor.bom_forecast_2, sensor.bom_forecast_3, sensor.bom_forecast_4, sensor.bom_forecast_5, sensor.bom_forecast_6

I have put the details in a secret.yaml in the packages folder:

my_bom_station: IDV60901.95867
my_bom_name: Scoresby
my_bom_product_id: IDV10450

I am trying to get the weather and forecast for Scoresby failing that then Melbourne.

So all the template sensors reference Gosford - you need to update those so they reflect your BOM station… you need to check the dev-tools to see the correct sensor names…

Does this integration still work? I’m now getting an error, and looking at the repository it was last updated back in March.

I archived my fork of this repo when the new BOM custom component (by the original author) was released. I believe the old one now will fall afoul of BOM’s TOS and scraping which is probably why it’s failing. The old BOM core component was also pulled by HA and no longer works either.
Why do you still use this one when there is a better working alternative available?

What is the new one? I couldn’t find it.

It’s also in HACS

Yep, that’s the one I’m using. Must have posted in the wrong post.:man_facepalming:

Well what error do you see? It is working fine.

Looks like 2 errors. Just saw the second one…

2021-10-10 12:26:39 ERROR (MainThread) [custom_components.bureau_of_meteorology] Unexpected error fetching BOM observation Albion Park data: 'NoneType' object is not subscriptable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data
return await self.update_method()
File "/config/custom_components/bureau_of_meteorology/PyBoM/collector.py", line 153, in async_update
await self.get_observations_data()
File "/config/custom_components/bureau_of_meteorology/PyBoM/collector.py", line 86, in get_observations_data
await self.format_observations_data()
File "/config/custom_components/bureau_of_meteorology/PyBoM/collector.py", line 93, in format_observations_data
flattened["wind_speed_kilometre"] = wind["speed_kilometre"]
TypeError: 'NoneType' object is not subscriptable

and the second one

2021-10-10 12:26:41 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up bureau_of_meteorology platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/bureau_of_meteorology/sensor.py", line 64, in async_setup_entry
forecast_region = collector.daily_forecasts_data["metadata"]["forecast_region"]
TypeError: 'NoneType' object is not subscriptable

What version of HA? And latest of this component?
There may be an issue similar to this on the repo… you might need to add your errors there.

2021.10.2 and latest version of component according to hacs.

Someone posted the same error a while ago, but no response from the developer. https://github.com/bremor/bureau_of_meteorology/issues/78

He has been around a bit lately… maybe try PM’ing him here?

I’m around i am just very lazy :slight_smile:
Sometimes data is missing from BOM and my code doesn’t handle it gracefully and instead has errors. I will look into this, i promise :slight_smile:

3 Likes

No worries mate.

I guess if there is missing data when HA starts, it fails to load. I’ll just restart HA every now and then until it starts working again.

Props to Brendan for adding hourly data.

It works ace with the custom weather chart card

1 Like

Which weather card is that? Got a link handy?