Customising the BOM Weather and lovelace - now in HACS

I’ve done something similar to this.

weather
I have ‘jimmied’ the values into another custom card - the dark sky custom card.

entity_apparent_temp: sensor.bom_feels_like_c
entity_current_conditions: sensor.dark_sky_icon
entity_daily_summary: sensor.dark_sky_daily_summary
entity_daytime_high: sensor.dark_sky_daytime_high_temperature_0d
entity_forecast_high_temp_1: sensor.dark_sky_daytime_high_temperature_1d
entity_forecast_high_temp_2: sensor.dark_sky_daytime_high_temperature_2d
entity_forecast_high_temp_3: sensor.dark_sky_daytime_high_temperature_3d
entity_forecast_high_temp_4: sensor.dark_sky_daytime_high_temperature_4d
entity_forecast_high_temp_5: sensor.dark_sky_daytime_high_temperature_5d
entity_forecast_icon_1: sensor.dark_sky_icon_1d
entity_forecast_icon_2: sensor.dark_sky_icon_2d
entity_forecast_icon_3: sensor.dark_sky_icon_3d
entity_forecast_icon_4: sensor.dark_sky_icon_4d
entity_forecast_icon_5: sensor.dark_sky_icon_5d
entity_forecast_low_temp_1: sensor.dark_sky_overnight_low_temperature_0d
entity_forecast_low_temp_2: sensor.dark_sky_overnight_low_temperature_1d
entity_forecast_low_temp_3: sensor.dark_sky_overnight_low_temperature_2d
entity_forecast_low_temp_4: sensor.dark_sky_overnight_low_temperature_3d
entity_forecast_low_temp_5: sensor.dark_sky_overnight_low_temperature_4d
entity_humidity: sensor.bom_relative_humidity
entity_pop: sensor.dark_sky_precip_probability
entity_pop_1: sensor.dark_sky_precip_probability_1d
entity_pop_2: sensor.dark_sky_precip_probability_2d
entity_pop_3: sensor.dark_sky_precip_probability_3d
entity_pop_4: sensor.dark_sky_precip_probability_4d
entity_pop_5: sensor.dark_sky_precip_probability_5d
entity_pop_intensity: sensor.dark_sky_precip_intensity
entity_pressure: sensor.dark_sky_pressure
entity_summary_1: sensor.dark_sky_summary_1d
entity_summary_2: sensor.dark_sky_summary_2d
entity_summary_3: sensor.dark_sky_summary_3d
entity_summary_4: sensor.dark_sky_summary_4d
entity_summary_5: sensor.dark_sky_summary_5d
entity_sun: sun.sun
entity_temperature: sensor.bom_air_temp_c
entity_visibility: sensor.dark_sky_visibility
entity_wind_bearing: sensor.dark_sky_wind_bearing
entity_wind_speed: sensor.dark_sky_wind_speed
type: 'custom:dark-sky-weather-card'

Just need to get that rainfall in there too

Yes this card is a fork of and enhancement to that card.

Markdown card for the title … should have worked that one out for myself.

Thanks @DavidFW1960.

1 Like

Hey @DavidFW1960 I’m seeing this in the browser inspector

Do I need to define popunit in the card config (mm?) or is this due to your mm size adjustments?

Um… i’ll Check tomorrow. Does it disappear with refresh or hard reload?

Still occurs after a hard refresh (CTRL + SHIFT + R).

ok Tom… I have had that view open in my HA now for over 10 minutes with the Chrome Dev tools open.
This is all I see.


With dev tools open, right click on the refresh icon & select ‘Empty Cache & Hard Reload’ There is no shortcut button for that.
Popunit is defined on line 107 of the js and is just the unit and size definition. It’s then used on line 765 (which is how I fixed the sizing problem) as for some inexplicable reason (I guess it’s because that block isn’t html it won’t accept a span class no matter what I do. (You can see from the error that it’s objecting on line 765)

(Oh yeah… BTW… this is all YOUR fault wanting the possible rain displayed :wink: )

Just did a bit of testing. It only appears to be occurring in firefox (as soon as a page refresh is made) and only if using a certificate exception for the local IP address rather than my duckdns address.

Ignore it. It’s not that much of an issue and is not affecting operation or display of the card.

I really like firefox’s customisability but it seems to be creating a great number of issues for web devs lately. It still can’t display input datetimes with zero value minutes correctly.

1 Like

ok sorry if I miss somethin but I can’t find the 5 days

entity_forecast_high_temp_1:?
entity_forecast_high_temp_2:?
entity_forecast_high_temp_3:?
entity_forecast_high_temp_4:?
entity_forecast_high_temp_5:?

I tryed

entity_forecast_high_temp_1: sensor.bom_brisbane_max_temp_c_1
entity_forecast_high_temp_2: sensor.bom_brisbane_max_temp_c_2
entity_forecast_high_temp_3: sensor.bom_brisbane_max_temp_c_3
entity_forecast_high_temp_4: sensor.bom_brisbane_max_temp_c_4
entity_forecast_high_temp_5: sensor.bom_brisbane_max_temp_c_5

I have add

  - platform: bom
    station: IDQ60901.94578
    name: Brisbane
    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

and do get some



Did you install the BOM forecast custom component?

no :frowning: just the bom integrations. I was just about to add your

ok so if I add the Bom forecast custom component I don’t need your wather.yaml

thanks you sorry for that lol
Capture

You need the custom bom forecast component, the core BOM component/sensor, need to add the configuration (weather.yaml contains all of the ones you need) and the custom card to display the card in Lovelace.

@DavidFW1960 big thankyou for the good work! I have been using this card for a few weeks now and loving it.
One hiccup I have it that the main icon dosen’t change at night. I see night icons in config/www/icons/weather_icons folder and scrolling through all the screen shots in this thread, I have not seen anyone posting a night time screen shot except maybe one.

Have I got some settings incorrect or is this feature not implemented yet.

BoM don’t differentiate day and night icons. Have a look at the sate of:

sensor.bom_[your_station]_icon_0

Or have a look at the BoM web page for your location.

I guess it could be automated in the card to use the day / night icons depending on the sunset/sunrise times - but that would be up to David.

There are ways and rules regarding day and night icons. The JavaScript doesn’t make it easy (for a hacker like me) to switch them out. You’ll notice the card I use in the custom component does change to a night icon at 6pm but that’s not actually strictly correct either.

I can take another look but it’s of little benefit.

Also @tom_l

Ok I think I can do this pretty easily. Let’s see…

OK I think I’ve done it… let me know but it’s working for me here. (Won’t 100% know till sun goes below horizon)

NOTE: I also fixed the weather.yaml for the non-fancy card… (night icons)

1 Like

Hi @DavidFW1960

Thanks for all your work on this.

I am however having issues getting it working, I’ve installed both the component and plugin from HACS and copied your yaml files exactly other than changing location to Sydney.

I get nothing at all showing in Lovelace and get the error below;

Log Details (ERROR)
Fri Jul 26 2019 16:15:12 GMT+1000 (Australian Eastern Standard Time)
Error while setting up platform bom_forecast
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, 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 243, in setup_platform
    bom_forecast_data.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 224, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/bom_forecast/sensor.py", line 423, in update
    ftp.retrbinary('RETR ' + self._product_id + '.xml', file_obj.write)
  File "/usr/local/lib/python3.7/ftplib.py", line 442, in retrbinary
    with self.transfercmd(cmd, rest) as conn:
  File "/usr/local/lib/python3.7/ftplib.py", line 399, in transfercmd
    return self.ntransfercmd(cmd, rest)[0]
  File "/usr/local/lib/python3.7/ftplib.py", line 365, in ntransfercmd
    resp = self.sendcmd(cmd)
  File "/usr/local/lib/python3.7/ftplib.py", line 273, in sendcmd
    return self.getresp()
  File "/usr/local/lib/python3.7/ftplib.py", line 246, in getresp
    raise error_perm(resp)
ftplib.error_perm: 550 Failed to open file.

I’m currently running Hassio 0.96.5 on a RPi 4 with HassOS 3.3 so not sure if that is causing the issue but not having any other problems.

Any ideas?

It could be HassOS beta/Pi4… How did you install the ftp component? Did you use HACS? Did you manually d/l files?

Can you show your yaml config for the custom component?

I installed using HACS.

lovelace.yaml

          - type: custom:bom-weather-card
            title: BOM Weather
            entity_current_conditions: sensor.bom_sydney_icon_0
            entity_temperature: sensor.bom_sydney_air_temp_c
            entity_forecast_high_temp_1: sensor.bom_sydney_max_temp_c_1
            entity_forecast_high_temp_2: sensor.bom_sydney_max_temp_c_2
            entity_forecast_high_temp_3: sensor.bom_sydney_max_temp_c_3
            entity_forecast_high_temp_4: sensor.bom_sydney_max_temp_c_4
            entity_forecast_high_temp_5: sensor.bom_sydney_max_temp_c_5
            entity_forecast_icon_1: sensor.bom_sydney_icon_1
            entity_forecast_icon_2: sensor.bom_sydney_icon_2
            entity_forecast_icon_3: sensor.bom_sydney_icon_3
            entity_forecast_icon_4: sensor.bom_sydney_icon_4
            entity_forecast_icon_5: sensor.bom_sydney_icon_5
            entity_forecast_low_temp_1: sensor.bom_sydney_min_temp_c_1
            entity_forecast_low_temp_2: sensor.bom_sydney_min_temp_c_2
            entity_forecast_low_temp_3: sensor.bom_sydney_min_temp_c_3
            entity_forecast_low_temp_4: sensor.bom_sydney_min_temp_c_4
            entity_forecast_low_temp_5: sensor.bom_sydney_min_temp_c_5
            entity_summary_1: sensor.bom_sydney_summary_1
            entity_summary_2: sensor.bom_sydney_summary_2
            entity_summary_3: sensor.bom_sydney_summary_3
            entity_summary_4: sensor.bom_sydney_summary_4
            entity_summary_5: sensor.bom_sydney_summary_5
            entity_sun: sun.sun
#           entity_visibility: sensor.dark_sky_visibility
            entity_daytime_high: sensor.bom_today_max
            entity_daytime_low: sensor.bom_today_min
            entity_wind_bearing: sensor.bom_sydney_wind_direction
            entity_wind_speed: sensor.bom_sydney_wind_speed_kmh
            entity_humidity: sensor.bom_sydney_relative_humidity
#           entity_pressure: sensor.dark_sky_pressure
            entity_apparent_temp: sensor.bom_sydney_feels_like_c
            entity_daily_summary: sensor.bom_sydney_detailed_summary_0
            entity_pop: sensor.bom_sydney_chance_of_rain_0
            entity_pop_intensity: sensor.bom_sydney_rain_today
            entity_possible_today: sensor.bom_sydney_possible_rainfall_0
            entity_pos_1: sensor.bom_sydney_possible_rainfall_1
            entity_pos_2: sensor.bom_sydney_possible_rainfall_2
            entity_pos_3: sensor.bom_sydney_possible_rainfall_3
            entity_pos_4: sensor.bom_sydney_possible_rainfall_4
            entity_pos_5: sensor.bom_sydney_possible_rainfall_5
            entity_pop_1: sensor.bom_sydney_chance_of_rain_1
            entity_pop_2: sensor.bom_sydney_chance_of_rain_2
            entity_pop_3: sensor.bom_sydney_chance_of_rain_3
            entity_pop_4: sensor.bom_sydney_chance_of_rain_4
            entity_pop_5: sensor.bom_sydney_chance_of_rain_5
            entity_current_text: sensor.bom_current_text
            locale: en
            sunset: true
            static_icons: false
            tooltip_bg_color: 'rgb( 75,155,239)'
            tooltip_border_color: 'rgb(255,161,0)'
            tooltip_border_width: 1
            tooltip_caret_size: 5
            tooltip_fg_color: '#fff'
            tooltip_left_offset: -12
            tooltip_width: 110
            tooltips: true
            old_daily_format: false
            time_format: 12
            show_beaufort: false
            refresh_interval: 60
            show_separator: false
            temp_top_margin: -0.3em         #default -0.3em px or em
            temp_font_weight: 300           #default 300 numeric
            temp_font_size: 4em             #default 4em em
            temp_right_pos: 0.85em          #default .85em px or em
            temp_uom_top_margin: -9px       #default -9px px or em
            temp_uom_right_margin: 7px      #default 7px px or em
            apparent_top_margin: 45px       #default 45px px or em
            apparent_right_pos: 1em         #default 1em px or em
            apparent_right_margin: 1em      #default 1em px or em
            current_text_top_margin: 39px   #default 39px px or em
            current_text_left_pos: 5em      #default 5em px or em
            current_text_font_size: 1.5em   #default 1.5em em
            current_data_top_margin: 7em    #default 7em px or em
            large_icon_top_margin: -3.5em   #default -3.5em px or em
            large_icon_left_position: 0em   #default 0em px or em
            separator_top_margin: 6em       #default 6em px or em
            slot_l1: daytime_high           #daytime_high
            slot_l2: daytime_low            #wind
            slot_l3: wind                   #visibility but BOM has no visibility reported
            slot_l4: sun_next               #sun_next
            slot_r1: pop                    #pop
            slot_r2: humidity               #humidity
            slot_r3: possible_today         #pressure but BOM has no pressure reported
            slot_r4: sun_following          #sun_following

sensor.yaml

- platform: bom
  station: "IDN60901.94768"
  name: Sydney
  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: "IDN60901"
  name: Sydney
  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'

- platform: template
  sensors:
      bom_current_text:
        value_template: >
            {% set val = states('sensor.bom_sydney_summary_0').split('.')[0] %} 
            {{ val | title }}
      bom_forecast_0:
        entity_id:
          - sensor.bom_today_max
          - sensor.bom_today_min
          - sensor.bom_sydney_chance_of_rain_0
          - sensor.bom_sydney_icon_0
        friendly_name: "Today"
        value_template: >
          {{states('sensor.bom_today_max')|round(0)}}°/{{states('sensor.bom_today_min')|round(0)}}°/{{states('sensor.bom_sydney_chance_of_rain_0')|round(0)}}%
        entity_picture_template: >-
          {%- if states('sun.sun') == 'below_horizon' and (states('sensor.bom_sydney_icon_0') == 'fog' or states('sensor.bom_sydney_icon_0') == 'haze' or states('sensor.bom_sydney_icon_0') == ' light-showers' or states('sensor.bom_sydney_icon_0') == 'partly-cloudy' or states('sensor.bom_sydney_icon_0') == 'showers') -%}
          {{ '/local/icons/bom_icons/' ~ states('sensor.bom_sydney_icon_0') ~ '-night.png' }}
          {%- else -%}
          {{ '/local/icons/bom_icons/' ~ states('sensor.bom_sydney_icon_0') ~ '.png' }}
          {%- endif -%}
      bom_forecast_1:
        entity_id:
          - sensor.bom_sydney_max_temp_c_1
          - sensor.bom_sydney_min_temp_c_1
          - sensor.bom_sydney_chance_of_rain_1
          - sensor.bom_sydney_icon_1
        friendly_name_template: >
          {%- set date = as_timestamp(now()) + (1 * 86400 ) -%}
          {{ date | timestamp_custom('Tomorrow (%-d/%-m)') }}
        value_template: >
          {{states('sensor.bom_sydney_max_temp_c_1')|round(0)}}°/{{states('sensor.bom_sydney_min_temp_c_1')|round(0)}}°/{{states('sensor.bom_sydney_chance_of_rain_1')|round(0)}}%
        entity_picture_template: >-
          {{ '/local/icons/bom_icons/' ~ states('sensor.bom_sydney_icon_1') ~ '.png' }}
      bom_forecast_2:
        entity_id:
          - sensor.bom_sydney_max_temp_c_2
          - sensor.bom_sydney_min_temp_c_2
          - sensor.bom_sydney_chance_of_rain_2
          - sensor.bom_sydney_icon_2
        friendly_name_template: >
          {%- set date = as_timestamp(now()) + (2 * 86400 ) -%}
          {{ date | timestamp_custom('%A (%-d/%-m)') }}
        value_template: >
          {{states('sensor.bom_sydney_max_temp_c_2')|round(0)}}°/{{states('sensor.bom_sydney_min_temp_c_2')|round(0)}}°/{{states('sensor.bom_sydney_chance_of_rain_2')|round(0)}}%
        entity_picture_template: >-
          {{ '/local/icons/bom_icons/' ~ states('sensor.bom_sydney_icon_2') ~ '.png' }}
      bom_forecast_3:
        entity_id:
          - sensor.bom_sydney_max_temp_c_3
          - sensor.bom_sydney_min_temp_c_3
          - sensor.bom_sydney_chance_of_rain_3
          - sensor.bom_sydney_icon_3
        friendly_name_template: >
          {%- set date = as_timestamp(now()) + (3 * 86400 ) -%}
          {{ date | timestamp_custom('%A (%-d/%-m)') }}
        value_template: >
          {{states('sensor.bom_sydney_max_temp_c_3')|round(0)}}°/{{states('sensor.bom_sydney_min_temp_c_3')|round(0)}}°/{{states('sensor.bom_sydney_chance_of_rain_3')|round(0)}}%
        entity_picture_template: >-
          {{ '/local/icons/bom_icons/' ~ states('sensor.bom_sydney_icon_3') ~ '.png' }}
      bom_forecast_4:
        entity_id:
          - sensor.bom_sydney_max_temp_c_4
          - sensor.bom_sydney_min_temp_c_4
          - sensor.bom_sydney_chance_of_rain_4
          - sensor.bom_sydney_icon_4
        friendly_name_template: >
          {%- set date = as_timestamp(now()) + (4 * 86400 ) -%}
          {{ date | timestamp_custom('%A (%-d/%-m)') }}
        value_template: >
          {{states('sensor.bom_sydney_max_temp_c_4')|round(0)}}°/{{states('sensor.bom_sydney_min_temp_c_4')|round(0)}}°/{{states('sensor.bom_sydney_chance_of_rain_4')|round(0)}}%
        entity_picture_template: >-
          {{ '/local/icons/bom_icons/' ~ states('sensor.bom_sydney_icon_4') ~ '.png' }}
      bom_forecast_5:
        entity_id:
          - sensor.bom_sydney_max_temp_c_5
          - sensor.bom_sydney_min_temp_c_5
          - sensor.bom_sydney_chance_of_rain_5
          - sensor.bom_sydney_icon_5
        friendly_name_template: >
          {%- set date = as_timestamp(now()) + (5 * 86400 ) -%}
          {{ date | timestamp_custom('%A (%-d/%-m)') }}
        value_template: >
          {{states('sensor.bom_sydney_max_temp_c_5')|round(0)}}°/{{states('sensor.bom_sydney_min_temp_c_5')|round(0)}}°/{{states('sensor.bom_sydney_chance_of_rain_5')|round(0)}}%
        entity_picture_template: >-
          {{ '/local/icons/bom_icons/' ~ states('sensor.bom_sydney_icon_5') ~ '.png' }}
      bom_forecast_6:
        entity_id:
          - sensor.bom_sydney_max_temp_c_6
          - sensor.bom_sydney_min_temp_c_6
          - sensor.bom_sydney_chance_of_rain_6
          - sensor.bom_sydney_icon_6
        friendly_name_template: >
          {%- set date = as_timestamp(now()) + (6 * 86400 ) -%}
          {{ date | timestamp_custom('%A (%-d/%-m)') }}
        value_template: >
          {{states('sensor.bom_sydney_max_temp_c_6')|round(0)}}°/{{states('sensor.bom_sydney_min_temp_c_6')|round(0)}}°/{{states('sensor.bom_sydney_chance_of_rain_6')|round(0)}}%
        entity_picture_template: >-
          {{ '/local/icons/bom_icons/' ~ states('sensor.bom_sydney_icon_6') ~ '.png' }}
      bom_today_max:
        entity_id:
          - sensor.bom_sydney_max_temp_c_0
          - sensor.today_temp_bom_mean
        value_template: >
          {%- if states('sensor.bom_sydney_max_temp_c_0') == 'n/a' -%} 
            {{ state_attr('sensor.today_temp_bom_mean', 'max_value') }}
          {% else %}
            {{ states('sensor.bom_sydney_max_temp_c_0') }}
          {% endif %}
      bom_today_min:
        entity_id:
          - sensor.bom_sydney_min_temp_c_0
          - sensor.today_temp_bom_mean
        value_template: >
          {%- if states('sensor.bom_sydney_min_temp_c_0') == 'n/a' -%} 
            {{ state_attr('sensor.today_temp_bom_mean', 'min_value') }}
          {% else %}
            {{ states('sensor.bom_sydney_min_temp_c_0') }}
          {% endif %}
          
- platform: statistics
  name: today_temp_bom
  sampling_size: 150
  entity_id: sensor.bom_sydney_air_temp_c
  max_age:
    hours: 24
1 Like