Australian Weather Forecast using BOM Public FTP

That’s strange. This (today’s sensor, no value):

  {% if state_attr('sensor.bom_forecast_hobart_0', 'Max Temp C') | string not in ['unavailable', 'unknown', 'None' ] %}
     {{ state_attr('sensor.bom_forecast_hobart_1', 'Max Temp C') }}
  {% else %}
     Other sensor
  {% endif %}

Gives me Other Sensor but this (tomorrow’s sensor which has a value):

  {% if state_attr('sensor.bom_forecast_hobart_1', 'Max Temp C') | string not in ['unavailable', 'unknown', 'None' ] %}
     {{ state_attr('sensor.bom_forecast_hobart_1', 'Max Temp C') }}
  {% else %}
     Other sensor
  {% endif %}

Gives me 25

Are you using mode: friendly for your BoM sensor?

BOM forecast doesn’t show the temperature for the current day.

I build a “rest of today” string, like the BOM site does, which looks like this:

  - platform: template
    sensors:
      rutherglen_weather:
        friendly_name: "Now"
        value_template: |
          {{ states('sensor.bom_rutherglen_air_temp_c') }}, {{ state_attr('sensor.bom_forecast_rutherglen_0', 'Summary') }}
          Feels like: {{ states('sensor.bom_rutherglen_feels_like_c') }}
          Humidity: {{ states('sensor.bom_rutherglen_relative_humidity') }}%
          Wind: {% if is_state('sensor.bom_rutherglen_wind_direction', 'CALM') %} CALM {% else %} {{ states('sensor.bom_rutherglen_wind_direction') }} {{ states('sensor.bom_rutherglen_wind_speed_kmh') }} km/h {% endif %}
        icon_template: "{{ state_attr('sensor.bom_forecast_rutherglen_0', 'icon') }}"

This is built from the ftp forecast add-on, plus the normal BOM weather data.

Hope that makes sense? It looks like this (with the forecast days 1 through 6 below it):

32

But it does show the forecast maximum and minimum for today (have a look after midnight). Just not for the whole day. That’s what the template fixes.

Thanks Tom. I take it back it does seem to be working so thanks very much. Now I notice that another card has n/a in the temperature field because of the lack of value. Can I actually change the value of the “Max Temp C” attribute rather than what you have done above?

Also I was just thinking can the sensor value just get remembered? Something like:

todaymintemp:
    friendly_name: "Minimum Temperature Today"
    value_template: >
          {% if state_attr('sensor.bom_forecast_brisbane_0', 'Min Temp C') | string not in ['unavailable', 'Unknown', 'None' ] %}
            {{ state_attr('sensor.bom_forecast_brisbane_0', 'Min Temp C') }}
          {% else %}
            {{ states('sensor.todaymintemp') }}
          {% endif %}
1 Like

I think you would have to write your own version of the sensor. Or maybe with a python script. Beyond my area of competence though.

Actually I found this which should do the job of keeping track of the values

I guess this addon needs updating now with 0.92?

Yes my configuration validation is saying “Integration bom_forecast not found when trying to verify its sensor platform” since upgrade. And so the forecast just says entity not available.
I did make changes to my configuration.yaml by adding the BOM radar camera but I don’t think I broke anything there.

If it’s like other custom components, try creating a __init__.py file - just a blank one and see if that corrects the problem…

That was actually the first thing I tried but unfortunately it comes back witth:

Integration bom_forecast not found when trying to verify its sensor platform.
Integration bom_radar not found when trying to verify its camera platform.

Well the bom radar is now native supported in 0.92.0 - been running that since introduced in b0 and it’s working fine for the released version as well for me…

As of 0.92.0, custom components require a manifest.json file (see here).

Create a file in the bom_forecast directory named “manifest.json” which contains the following:

{
  "domain": "bom_forecast",
  "name": "BOM Forecast",
  "documentation": "https://github.com/bremor/bom_forecast",
  "dependencies": [],
  "codeowners": [],
  "requirements": []
}

This will fix the “Integration bom_forecast not found when trying to verify its sensor platform.” error.

2 Likes

I wasn’t aware, will give that a try thanks!

I’ll try this also, thank you.

I have custom components that have no manifest. I believe from reading the dev docs this is only for core components… Other custom components are working fine without the manifest and personally I’d rather wait for the developer to comment on the issue instead of making changes that might have other unintended consequences.

it has been clarified that its is not a requirement for custom components to have a manifest.json
The documentation will be updated shortly.
There is however a requirement to have an emtpy __init__.py file for all custom components

Pretty much 1 out of every 2 restarts I get this problem:

2019-04-26 05:54:44 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform bom_forecast Traceback (most recent call last): File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py”, line 126, in _async_setup_platform SLOW_SETUP_MAX_WAIT, loop=hass.loop) File “/usr/local/lib/python3.7/asyncio/tasks.py”, line 416, in wait_for return fut.result() File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run result = self.fn(*self.args, **self.kwargs) File “/config/custom_components/bom_forecast/sensor.py”, line 251, in setup_platform bom_forecast_data.update() File “/usr/local/lib/python3.7/site-packages/homeassistant/util/init.py”, line 224, in wrapper result = method(*args, **kwargs) File “/config/custom_components/bom_forecast/sensor.py”, line 437, in update ftp = ftplib.FTP(‘ftp.bom.gov.au’) File “/usr/local/lib/python3.7/ftplib.py”, line 117, in init self.connect(host) File “/usr/local/lib/python3.7/ftplib.py”, line 152, in connect source_address=self.source_address) File “/usr/local/lib/python3.7/socket.py”, line 707, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): File “/usr/local/lib/python3.7/socket.py”, line 748, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -3] Try again

@ BrendanMoran have you got some ideas on how to solve this problem?

I’ve tried the __init__.py and manifest.json but I’m getting the same errors as everyone else. The old “Integration bom_forecast not found when trying to verify its sensor platform.” error

I’ve moved your script into /config/custom_components/sensor/bom_forecast and in that folder are:

  1. bom_forecast.py
  2. __init__.py (which is empty)
  3. manifest.json

My manifest.json file looks like this:

    {
      "domain": "bom_forecast",
      "name": "BOM Forecast",
      "documentation": "https://github.com/bremor/bom_forecast",
      "dependencies": [],
      "codeowners": [],
      "requirements": []
    }

Thanks in advance :grinning:

1 Like

Rename the file bom_forecast.py to sensor.py. Rename the folder files are in to bom_forecast.

That and the manifest file you have already should solve your problem.

3 Likes

Thanks! That fixed it.

So, I did this:

  1. Moved the files to /config/custom_components/bom_forecast

  2. Renamed bom_forecast.py to sensor.py

  3. Created __init__.py (which is empty)

  4. Created manifest.json like it is listed below

    {
      "domain": "bom_forecast",
      "name": "BOM Forecast",
      "documentation": "https://github.com/bremor/bom_forecast",
      "dependencies": [],
      "codeowners": [],
      "requirements": []
    }

And the sensor is working again. Thanks @tom_l :grinning:

5 Likes