Customising the BOM Weather and lovelace - now in HACS

@DavidFW1960

I am dumb as it was sitting in plain sight separator_top_margin: 5em. Tried increasing it but still have chopped text. I don’t think I use card-mod or anything else that manipulates css. Will try the defaults and see how it goes.

Thanks so much for your work on these addons, @DavidFW1960.

I’m trying to install on a fresh HassOS via HACS, and your repo’s aren’t working. Having had a look, it seems like it is looking for a repository.json which doesn’t appear on the git site.

I’m new to this method, so I’m probably missing something really obvious.

Any suggestions?

They are both default repos in HACS
You can go to the repo directly - it’s linked in the first post.

@tom_l I also made some minor changes that might affect you (to the kt) and discovered I had a logic error and it wasn’t updating properly… I think I fixed it in master if you want to have a try…
@angyp74 I don’t know what is going on with your setup…

2 Likes

Copied over the bom-weather-card.js file, deleted the bom-weather-card.gz file and refreshed.

All appears to be well.

Just see if it refreshes properly… you shouldn’t need to refresh for the items to update. There was potentially an issue if you weren’t parsing the km/h values through as well as the kt values - and it meant also that the rainfall today didn’t update either without refreshing the browser. Anyway, pretty sure I fixed it and we have rain at the moment…

Ok I’ll keep an eye on it and let you know in an hour or so (assuming the wind speed changes).

Unfortunately no, it takes a page refresh to update:

It can take a couple of minutes to update…

Also… what version does the console show? I’ll config for knots tomorrow and test myself as well.

Version 0.73b

I’ll have another look.

Ok no worries… it could be the reverse of the problem I fixed earlier and I’ll check that as well. It’s not impossible I screwed up :slight_smile:

It’s definitely not updating.

Ok. I know where to look…

1 Like

Hi, thank you in advance…

hoping for some help trouble shooting what is no doubt a stupid error. I have follow David’s guidance and get a config error I cant for the life of me figure out after a few days, hoping the experienced hands here can school me.

Error is:

Invalid config for [weather]: required key not provided @ data[‘platform’]. Got None.

yaml file…

sensor:
  - platform: bom
    station: IDN60801.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: IDN10064
    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'
    bom_current_text:
      value_template: >
        {% set val = states("sensor.bom_sydney_detailed_summary_0") %} 
        {{ val.split('.')[0] | title }}

  - platform: template
    sensors:
    
      bom_current_text:
        value_template: >
            {% set val = states('sensor.bom_sydney_summary_0').split('.')[0] %} 
            {{ val | title }}

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

      bom_uv_alert_summary:
        value_template: >
            {%- if states('sensor.bom_sydney_uv_alert_0') == '##' -%} 
            {% set val = 'No Data' %}
            {%- elif states('sensor.bom_sydney_uv_alert_0') != 'n/a' -%} 
            {% set val = states('sensor.bom_sydney_uv_alert_0').split('[')[1].split(']')[0] %}
            {%- elif states('sensor.bom_sydney_uv_alert_1') == '##' -%} 
            {% set val = 'No Data' %}
            {%- elif states('sensor.bom_sydney_uv_alert_1') != 'n/a' -%} 
            {% set val = states('sensor.bom_sydney_uv_alert_1').split('[')[1].split(']')[0] %}
            {%- else -%}
            {%- set val = 'No Data' -%}
            {%- endif -%}
            {{ 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_gosford_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
        value_template: >
          {%- if states('sensor.bom_sydney_max_temp_c_0') == 'n/a' -%} 
            {{ state_attr('sensor.today_temp_bom', '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
        value_template: >
          {%- if states('sensor.bom_sydney_min_temp_c_0') == 'n/a' -%} 
            {{ state_attr('sensor.today_temp_bom', '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

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

The current text is not a sensor - you defined it as a sensor and a template. Remove it from the sensor part. (Well it’s a template sensor)

Try master again now Tom.

This is a bastard how this works.
If say you define a variable… say pressure… but you don’t use it in a slot… the card will fail when it updates that unused variable and then everything else silently fails.

A fix is incoming but for now I moved those maybe unused variables down the bottom so if they fail it won’t matter. A more permanent fix is coming.

Giving it a go now. Just waiting for a BoM update.

@rudders just gave me the permanent fix. If you get that one it will be 0.73c. I’ll push 0.74 tomorrow.
It should 100% work - I pushed a state change and refreshed then waited for the component to reset it and then saw it change on the card (if that makes sense)
There is a delay of a minute or so before the card updates. The refresh interval in the card is 30 seconds so I guess within a minute if you just missed the first update.

9 minutes since update and no change in the card.

I did do a Ctrl+F5 after replacing the .js file. (seems to have the same version, 0.73b).

Will grab the new one and try that.

Win! It updated within a minute of the sensor updating.

1 Like

Check the console in your browser (right-click on the card-> Inspect) to see if you can see if the updateValues() function fails somewhere - there will be a console warning not an error but the function will fail at that point.

1 Like