Customising the BOM Weather and lovelace - now in HACS

Lovelace

#################################################################
#                                                               #
#                         AirVisual Card                        #
#                                                               #
#################################################################

- type: horizontal-stack
  cards:
    - type: custom:gap-card

    - type: custom:air-visual-card
      air_pollution_level: sensor.chinese_air_pollution_level
      air_quality_index: sensor.chinese_air_quality_index
      main_pollutant: sensor.chinese_main_pollutant
      temp: "{{ (data | fromjson)['temp'] }}"
      city: 'Burleigh Waters'
      style: |
        ha-card  {
          border-radius: 5px;
        }

#################################################################
#                                                               #
#                        BOM Weather Card                       #
#                                                               #
#################################################################

    - type: custom:bom-weather-card
      title: BOM Weather
      entity_current_conditions: sensor.bom_gc_forecast_icon_0
      entity_temperature: sensor.bom_gc_air_temp_c
      entity_forecast_high_temp_1: sensor.bom_gc_forecast_max_temp_c_1
      entity_forecast_high_temp_2: sensor.bom_gc_forecast_max_temp_c_2
      entity_forecast_high_temp_3: sensor.bom_gc_forecast_max_temp_c_3
      entity_forecast_high_temp_4: sensor.bom_gc_forecast_max_temp_c_4
      entity_forecast_high_temp_5: sensor.bom_gc_forecast_max_temp_c_5
      entity_forecast_icon_1: sensor.bom_gc_forecast_icon_1
      entity_forecast_icon_2: sensor.bom_gc_forecast_icon_2
      entity_forecast_icon_3: sensor.bom_gc_forecast_icon_3
      entity_forecast_icon_4: sensor.bom_gc_forecast_icon_4
      entity_forecast_icon_5: sensor.bom_gc_forecast_icon_5
      entity_forecast_low_temp_1: sensor.bom_gc_forecast_min_temp_c_1
      entity_forecast_low_temp_2: sensor.bom_gc_forecast_min_temp_c_2
      entity_forecast_low_temp_3: sensor.bom_gc_forecast_min_temp_c_3
      entity_forecast_low_temp_4: sensor.bom_gc_forecast_min_temp_c_4
      entity_forecast_low_temp_5: sensor.bom_gc_forecast_min_temp_c_5
      entity_summary_1: sensor.bom_gc_forecast_summary_1
      entity_summary_2: sensor.bom_gc_forecast_summary_2
      entity_summary_3: sensor.bom_gc_forecast_summary_3
      entity_summary_4: sensor.bom_gc_forecast_summary_4
      entity_summary_5: sensor.bom_gc_forecast_summary_5
      entity_sun: sun.sun
      # entity_visibility: sensor.dark_sky_visibility
      entity_daytime_high: sensor.bom_gc_forecast_max_temp_c_0
      entity_daytime_low: sensor.bom_gc_forecast_min_temp_c_1
      entity_wind_bearing: sensor.bom_gc_wind_direction
      entity_wind_speed: sensor.bom_gc_wind_speed_kmh
      entity_humidity: sensor.bom_gc_relative_humidity
      # entity_pressure: sensor.dark_sky_pressure
      entity_apparent_temp: sensor.bom_gc_feels_like_c
      entity_daily_summary: sensor.bom_gc_forecast_detailed_summary_0
      entity_pop: sensor.bom_gc_forecast_chance_of_rain_0
      entity_pop_intensity: sensor.bom_gc_rain_today
      entity_possible_today: sensor.bom_gc_forecast_possible_rainfall_0
      entity_pos_1: sensor.bom_gc_forecast_possible_rainfall_1
      entity_pos_2: sensor.bom_gc_forecast_possible_rainfall_2
      entity_pos_3: sensor.bom_gc_forecast_possible_rainfall_3
      entity_pos_4: sensor.bom_gc_forecast_possible_rainfall_4
      entity_pos_5: sensor.bom_gc_forecast_possible_rainfall_5
      entity_pop_1: sensor.bom_gc_forecast_chance_of_rain_1
      entity_pop_2: sensor.bom_gc_forecast_chance_of_rain_2
      entity_pop_3: sensor.bom_gc_forecast_chance_of_rain_3
      entity_pop_4: sensor.bom_gc_forecast_chance_of_rain_4
      entity_pop_5: sensor.bom_gc_forecast_chance_of_rain_5
      entity_current_text: sensor.bom_current_text
      entity_uv_alert: sensor.bom_uv_alert
      entity_fire_danger: sensor.bom_fire_danger
      entity_uv_alert_summary: sensor.bom_uv_alert_summary
      entity_fire_danger_summary: sensor.bom_fire_danger_summary
      locale: en
      sunset: true
      static_icons: false
      # old_icon: "true"
      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: 0px            #default 0px px or em Note: pre-0.109.x default was -0.3em
      temp_font_weight: 300           #default 300 numeric
      temp_font_size: 4em             #default 4em em
      temp_right_pos: 0.85em          #default 0.85em px or em
      temp_uom_top_margin: -12px      #default -12px px or em Note: pre-0.109.x default was -9px
      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: 4.5em  #default 4.5em px or em pre-0.109.x default was 39px
      current_text_left_pos: 0px      #default 0px px or em pre-0.109.x default was 5em
      current_text_font_size: 1.5em   #default 1.5em em
      current_text_alignment: center  #default center
      current_text_width: 100%        #default 100%
      current_data_top_margin: 10em   #default 10em px or em pre-0.109.x default was 7em
      large_icon_top_margin: -3.2em   #default -3.2em px or em Note: pre-0.109.x default was -3.5em
      large_icon_left_position: 0px   #default 0px px or em
      separator_top_margin: 6em       #default 6em px or em
      summary_top_padding: 2em        #default 2em px or em pre-0.109.x default was 1em
      summary_font_size: 0.8em        #default 0.8em px or em
      slot_l1: daytime_high           #daytime_high
      slot_l2: daytime_low            #daytime_low
      slot_l3: wind                   #wind
      slot_l4: pressure               #pressure
      slot_l5: sun_next               #sun_next
      slot_r1: pop                    #pop
      slot_r2: humidity               #humidity
      slot_r3: uv_alert               #uv_alert
      slot_r4: fire_danger            #fire_danger
      slot_r5: sun_following          #sun_following

weather package

sensor:

####################################################
#                                                  #
#                   Sensor - BOM                   #
#                                                  #
####################################################

  - platform: bom
    station: IDQ60801.94592
    name: GC
    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
      
####################################################
#                                                  #
#               Sensor - BOM Forecast              #
#                                                  #
####################################################
      
## BOM Forecast
  - platform: bom_forecast
    product_id: IDQ10610
    name: GC Forecast
    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'

####################################################
#                                                  #
#                 Sensor - Template                #
#                                                  #
####################################################
      
  - platform: template
    sensors:

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

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

      bom_uv_alert_summary:
        value_template: >
            {%- if states('sensor.bom_gc_forecast_uv_alert_0') == '##' -%} 
            {% set val = 'No Data' %}
            {%- elif states('sensor.bom_gc_forecast_uv_alert_0') != 'n/a' -%} 
            {% set val = states('sensor.bom_gc_forecast_uv_alert_0').split('[')[1].split(']')[0] %}
            {%- elif states('sensor.bom_gc_forecast_uv_alert_1') == '##' -%} 
            {% set val = 'No Data' %}
            {%- elif states('sensor.bom_gc_forecast_uv_alert_1') != 'n/a' -%} 
            {% set val = states('sensor.bom_gc_forecast_uv_alert_1').split('[')[1].split(']')[0] %}
            {%- else -%}
            {%- set val = 'No Data' -%}
            {%- endif -%}
            {{ val | title }} 

      bom_fire_danger:
        value_template: >
            {%- if states('sensor.bom_gc_forecast_fire_danger_0') == '##' -%}
            Fire Danger Today: No Data
            {%- elif states('sensor.bom_gc_forecast_fire_danger_0') != 'n/a' -%} 
            Fire Danger Today: {{ states('sensor.bom_gc_forecast_fire_danger_0') }}
            {%- elif states('sensor.bom_gc_forecast_fire_danger_1') == '##' -%}
            Fire Danger Tomorrow: No Data
            {%- else -%}
            Fire Danger Tomorrow: {{ states('sensor.bom_gc_forecast_fire_danger_1') }}
            {%- endif -%}

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

      bom_forecast_0:
        entity_id:
          - sensor.bom_gc_forecast_max_temp_c_0
          - sensor.bom_gc_forecast_min_temp_c_1
          - sensor.bom_gc_forecast_chance_of_rain_0
          - sensor.bom_gosford_icon_0
        friendly_name: "Today"
        value_template: >
          {{states('sensor.bom_gc_forecast_max_temp_c_0')|round(0)}}°/{{states('sensor.bom_gc_forecast_min_temp_c_1')|round(0)}}°/{{states('sensor.bom_gc_forecast_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_gc_forecast_max_temp_c_1
          - sensor.bom_gc_forecast_min_temp_c_1
          - sensor.bom_gc_forecast_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_gc_forecast_max_temp_c_1')|round(0)}}°/{{states('sensor.bom_gc_forecast_min_temp_c_1')|round(0)}}°/{{states('sensor.bom_gc_forecast_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_gc_forecast_max_temp_c_2
          - sensor.bom_gc_forecast_min_temp_c_2
          - sensor.bom_gc_forecast_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_gc_forecast_max_temp_c_2')|round(0)}}°/{{states('sensor.bom_gc_forecast_min_temp_c_2')|round(0)}}°/{{states('sensor.bom_gc_forecast_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_gc_forecast_max_temp_c_3
          - sensor.bom_gc_forecast_min_temp_c_3
          - sensor.bom_gc_forecast_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_gc_forecast_max_temp_c_3')|round(0)}}°/{{states('sensor.bom_gc_forecast_min_temp_c_3')|round(0)}}°/{{states('sensor.bom_gc_forecast_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_gc_forecast_max_temp_c_4
          - sensor.bom_gc_forecast_min_temp_c_4
          - sensor.bom_gc_forecast_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_gc_forecast_max_temp_c_4')|round(0)}}°/{{states('sensor.bom_gc_forecast_min_temp_c_4')|round(0)}}°/{{states('sensor.bom_gc_forecast_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_gc_forecast_max_temp_c_5
          - sensor.bom_gc_forecast_min_temp_c_5
          - sensor.bom_gc_forecast_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_gc_forecast_max_temp_c_5')|round(0)}}°/{{states('sensor.bom_gc_forecast_min_temp_c_5')|round(0)}}°/{{states('sensor.bom_gc_forecast_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_gc_forecast_max_temp_c_6
          - sensor.bom_gc_forecast_min_temp_c_6
          - sensor.bom_gc_forecast_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_gc_forecast_max_temp_c_6')|round(0)}}°/{{states('sensor.bom_gc_forecast_min_temp_c_6')|round(0)}}°/{{states('sensor.bom_gc_forecast_chance_of_rain_6')|round(0)}}%
        entity_picture_template: >-
          {{ '/local/icons/bom_icons/' ~ states('sensor.bom_gosford_icon_6') ~ '.png' }}


#################################################################
#                                                               #
#                              Sun                              #
#                                                               #
#################################################################

sun:

Pressure. You have defined a slot for pressure but not parsing any entity to it. (Lots of BOM stations don’t have pressure so I am parsing one of my BME280 sensors through to it instead)
Also just FYI, BOM will show n/a for minimum and maximum during the day. The minimum generally disappears early in the morning and the maximum after around 2pm - seems once the min/max for the day is reached it is removed. That’s why I use a template sensor with the statistics sensor. (Actually I use the custom average component which lets me get the low/high since midnight)

and so it is well spotted thanks @DavidFW1960

How do you get the still image for your bom radar image?
Also do you think you could squeeze the AirVisual AQI entity in there somewhere?

There is a core component for that. I think my config is in the weather package no?

camera:
  - platform: generic
    name: BOM Satellite
    still_image_url: http://www.bom.gov.au/gms/IDE00135.jpg
  - platform: bom
    name: Sydney
    id: 714   
    frames: 6
    delta: 360
  - platform: bom
    name: Newcastle
    id: '043'
    frames: 6
    delta: 360

Then in Lovelace to display

      - type: vertical-stack
        cards:
          - type: picture-entity
            title: BOM Satellite
            entity: camera.bom_satellite
            tap_action:
              action: more-info
            hold_action:
              action: more-info
          - type: picture-entity
            title: BOM Radar Sydney
            entity: camera.sydney
            tap_action:
              action: more-info
            hold_action:
              action: more-info
          - type: picture-entity
            title: BOM Radar Newcastle
            entity: camera.newcastle
            tap_action:
              action: more-info
            hold_action:
              action: more-info

Is that provided by BOM?
I could make a slot for it. I don’t have it on mine.
You could use the visibility slot and parse the correct entity as visibility too.

I was more referring to the still_image_url: http://www.bom.gov.au/gms/IDE00135.jpg section

its not native to BOM no it is a seperate sensor AirVisual provides air quality index for your region. I could do that good idea.

I don’t understand?
On the BOM site if you open the map that is the URL of the map
go to http://www.bom.gov.au/australia/satellite/?ref=ftr
then right click the map and you get a full screen of the image.
http://www.bom.gov.au/gms/IDE00135.202005072230.jpg
But someone must have told me if you leave out the ‘date’ bit it shows the latest.
http://www.bom.gov.au/gms/IDE00135.jpg

New Version 0.68 that includes wind gust.


Need to add to lovelace configuration

entity_wind_gust: sensor.bom_gosford_wind_gust_kmh
1 Like

Righto works well with my conditional cards



1 Like

Today’s high showing as NaN… template not working?

I haven’t added in your templates for average sensor yet just been building the UI look n feel

1 Like

I have got this up and running today but am unable to get the two columns in the L/R slots.
screen shot below.
I am assuming the length of the text is what is making it all fit onto the one column, Im in Perth and have seen there is a template to select which station I want to use the data from but have no idea where to put this…

Are my assumptions correct?
If so can someone help with what to edit/add in the template section?

Yes that is why. I think there is a sample template sensor for Perth in the template file in the repo.

Hi David, Yes. I have seen there is info on it but have no idea where to actually put the additional parts into the template sensor itself?

interesting - 0.110 now resizes cards depending on the screen width before changing the number of columns:



Yeah it does. I noticed that yesterday. You need to use the vertical-stack or layout card. This is Home Assistant - nothing I can control.

sorry - wasn’t suggesting it was your fault, just that it is more evident with the weather card (but not your fault)

1 Like

No worries mate. All good.

I have pushed version 0.71 this morning.
There was an issue with the card not getting updated unless you refreshed the screen. @rudders helped me fix that. Thanks Adrian!

Also when I first forked this card (and I was pretty clueless about js) I changed the precipitation from x mm/h (or in/h) just to show mm by changing the unit of measurement. No one complained about that or even noticed however I have added a new variable you can define if your weather provider actually gives you a rate in mm/h or in/hr. You can not define both a flat rate of rainfall AND a rate/hr - if you do you will get an error saying invalid.

Check the info.md file or the docs for details.

I was also asked recently to be able to show windspeeds as knots instead of km/h. Is there any interest from anyone for me to do that? I see from BOM that there are sensors both for kt and km/h - I could just define another slot to show that as an option.

1 Like