项目作者: DavidFW1960

项目描述 :
Custom BOM Australia Animated Weather Card
高级语言: JavaScript
项目地址: git://github.com/DavidFW1960/bom-weather-card.git
创建时间: 2019-07-06T04:28:22Z
项目社区:https://github.com/DavidFW1960/bom-weather-card

开源协议:

下载


hacs_badge GitHub GitHub last commit Maintenance

Custom Animated Weather Card for any weather provider

IMPORTANT CHANGES

This card is essentially deprecated now in favour of Platinum Weather Card The new card should import the configuration from this card.

I have renamed this card to remove the emphasis on BOM. This is a generic card that works with any provider

NON-Australian Users: This card and docs has always been a generic card with an emphasis on BOM in Australia however it will work with ANY weather provider that can supply the sensors.

AUSTRALIA ONLY NOTE: I have made some changes to the docs so that this card now uses the new BOM Component by Brendan
This new repo can be added to HACS See also the excellent new BOM Radar Card by @therat here

I have updated the lovelace.yaml and templates (NOTE THESE AE EXAMPLES and can be customised for your needs) as well for this new component.

When you install Brendans new BOM Component, you will get sensors that look like this:
For the Observations, they will be named for the BOM Observation station like.. sensor.gosford_temperature as an example.
For the Forecast, they will be named by your local suburb determined from the entered Latitude and Longitude (which will default to your HA configuration) like sensor.kariong_icon_descriptor_0

It MAY be that there will be some new conditions from BOM. If icons are missing or you get any errors please let me know.

IF you are using the old card as well with the 7 days forecast, note the new component only provides 6 days now and additionally I have added some icons so make sure you grab the bom_icons.zip file and extract the contents to /config/www/bom_icons The animated icons for the card itself are unchanged.

image

This card is a modification of a fork of iammexx/home-assistant-config dark-sky-weather-card
This card provides MANY additional features as well as compatability with later versions of home assistant.
New features not in original card include:

  • Lit 2
  • Only use Day time icons for forecast for future days (days 1-5)
  • More icons
  • Adds Locale customisation for number formats
  • Added to card-picker in Lovelace
  • Added option to show minimum or maximum first in forecast
  • Added option to show 1 decimal place to temperatures
  • Added option to display windspeeds in knots
  • Show rainfall as an intensity or absolute number
  • Removed leading zeros if 12hr time
  • Added Wind Gust
  • Can use different icon sets
  • Added extra (5th) row of slots
  • Added slots (optional) for UV and fire danger ratings
  • Added possibility of rainfall to forecast

NOTE: This card REQUIRES any weather component that can provide the required sensors. (like the new BOM Component if in Australia)
Alternately, if you are using DarkSky (or any other provider), the important thing is that any entities parsed to the card must be provided by that platform and you should carefully check the sensor names exist. Parsing a non existant sensor to the card will cause the card to fail to display!

The Weather Card provides current and forecast weather conditions using HA sensors. You configure the card by passing in sensor entities from the weather component.

The weather package in the repo shows configuration for this card. This package is for HA versions > 0.115.0.

The card is very customizable. You can configure many aspects of it’s look and feel as well as which specific content to show by passing in customization flags and defining optional sensors. Content can also be rearranged if desired.

Hovering over a forecast day will display the daily weather summary in a tooltip popup if that option has been enabled.

Installation


EASY Way? use HACS

This plugin is now part of the default HACS store. You should not need to add it manually. Add this repo https://github.com/DavidFW1960/bom-weather-card

Install card from HACS as per other plugins. Note that you must add this card as a module to the resources section as per the instructions when you install the card.

NOTE: Home Assistant caches stuff in a way that seems particularly hard to break some times and HACS makes this worse unfortunately.
The rule of thumb is that when you install a new version you MUST break the cache in order for HA to load the new card. This is fairly easy to do.
In CHROME open up the Dev Tools by pressing F12
Then right click on the refresh icon in the task bar (see graphic) and you will see a menu of options. Select Empty cache and hard reload from the options. It is the only option with no shortcut!

image

You then need to press either CTRL+R OR CTRL+F5 at least TWICE. Then check the version in the same dev-tools. It will look something like this:

image

The first time you do the CTRL+F5 you might find that the version will again change back to the previous version but a second refresh will fix it.

EDIT: Latest HACS version includes a version tag in the resource which will change when you update the card so the caching fix described above is no longer necessary! Yay!

HARD Way? manual installation as follows:

  1. Add bom-weather-card.js to your <config-dir>/www/ directory. If you don’t have this directory (this is your first custom card), you will need to create it.
  2. Add /local/bom-weather-card/bom-weather-card.js?v=o.89 type js to resources. You must increment or use a different version number for every update to break the caching of the card and make it use the new version.

    Then install the icon files

    Please download ALL icons required are in this file here
    In addition to the amcharts ones from here I have found a few more svg icons (from here and also via the Home Assistant Forums here to use in this component. Put them in <config-dir>/www/icons/weather_icons and then sub folders animated and static. Create the directories if necessary.

I used to recommend downloading Download the amcharts icons from https://www.amcharts.com/dl/svg-weather-icons/ however if you don’t use my zip file version some icons will be missing.

To use the basic card, you will also need the //www/icons/bom_icons which are contained in bom_icons.zip

You should end up with the following folders:
This structure is after all configuration is done. If you install via HACS you must still configure the package/yaml and icons manually.
HACS:-

  1. └── ...
  2. └── configuration.yaml
  3. └── packages
  4. └── weather.yaml
  5. └── www
  6. └── community
  7. └── bom-weather-card
  8. └── bom-weather-card.js
  9. └── bom-weather-card.js.gz
  10. └── icons
  11. └── bom_icons ###### Containing bom_icons.zip unzipped (ONLY if using the basic card and icons)
  12. └── weather_icons
  13. └── animated ###### Containing the animated icons from weather_icons.zip animated directory
  14. └── static ###### Containing the animated icons from weather_icons.zip static directory

This structure is after all configuration is done. You must still configure the package/yaml and icons manually.
MANUAL INSTALL:-

  1. └── ...
  2. └── configuration.yaml
  3. └── packages
  4. └── weather.yaml
  5. └── www
  6. └── bom-weather-card.js
  7. └── icons
  8. └── bom_icons ###### Containing bom_icons.zip unzipped (ONLY if using the basic card and icons)
  9. └── weather_icons
  10. └── animated ###### Containing the animated icons from weather_icons.zip animated directory
  11. └── static ###### Containing the animated icons from weather_icons.zip static directory

IF YOU USE the SAMBA addin in Home Assistant, the ICON directory will be hidden by default. Go to the configuration of the addon and remove the exclusion of icons and restart the addon otherwise you can’t create the directory.

Configuration


  1. All configuration for the component is done via the GUI!

It seems the new BOM API actually will generate a forecast for ANY location/Suburb in Australia and observations for defined observation stations. The nearest station is used.

The next two steps are completed differently based on the version of HA you are using:

  • Pre 0.84 or if using yaml mode in 0.84 or above : Add to your ui-lovelace.yaml file.
  • Using storage mode in 0.84 or above use the GUI Editor to add the reference and definition to the config.
  1. Add the card reference to resources
    If you installed using HACS, the resources should be updated automatically (see below)

    Note: Ensure type is set to module and not js
    Note: /local/ points to the <config-dir>/www/ dir.
    Note: /hacsfiles/ points to the <config-dir>/www/community/ dir.

Note that neither /local/ of /hacsfiles/ physically exist! The directory structure is as per above.

For a HACS Installation:

  1. resources:
  2. - url: /hacsfiles/bom-weather-card/bom-weather-card.js
  3. type: module

For the manual installation:

  1. resources:
  2. - url: /local/custom_ui/bom-weather-card.js?v=0.1
  3. type: module

To use the package, copy weather.yaml to your packages folder as per above. Create that directory if it doesn’t exist.
Edit weather.yaml for your sensor names and ensure you include packages in configuration.yaml:

  1. homeassistant:
  2. packages: !include_dir_named packages
  1. Add the card definition: You can add this card from the card picker but need to configure the entities and flags in YAML. There are required / optional and flag entries.
    NOTE: All my values refer to Gosford observation entities and Kariong forecast.. You will need to edit these to match your sensors names.**
    This card has been added to the custom-card-picker in Lovelace

image

An example configuration is in lovelace.yaml - this can be pasted into the manual card configuration in the GUI editor
If you paste it in the raw editor or in a yaml file, take care with the indenting.

Required entries must be present
in your configuration. The card will not work at all if any of these lines are missing. EDIT gosford/kariong to match your observations/forecasts

  1. type: custom:bom-weather-card
  2. title: BOM Weather
  3. entity_current_conditions: sensor.kariong_icon_descriptor_0
  4. entity_temperature: sensor.gosford_temp
  5. entity_forecast_high_temp_1: sensor.kariong_temp_max_1
  6. entity_forecast_high_temp_2: sensor.kariong_temp_max_2
  7. entity_forecast_high_temp_3: sensor.kariong_temp_max_3
  8. entity_forecast_high_temp_4: sensor.kariong_temp_max_4
  9. entity_forecast_high_temp_5: sensor.kariong_temp_max_5
  10. entity_forecast_icon_1: sensor.kariong_icon_descriptor_1
  11. entity_forecast_icon_2: sensor.kariong_icon_descriptor_2
  12. entity_forecast_icon_3: sensor.kariong_icon_descriptor_3
  13. entity_forecast_icon_4: sensor.kariong_icon_descriptor_4
  14. entity_forecast_icon_5: sensor.kariong_icon_descriptor_5
  15. entity_forecast_low_temp_1: sensor.kariong_temp_min_1
  16. entity_forecast_low_temp_2: sensor.kariong_temp_min_2
  17. entity_forecast_low_temp_3: sensor.kariong_temp_min_3
  18. entity_forecast_low_temp_4: sensor.kariong_temp_min_4
  19. entity_forecast_low_temp_5: sensor.kariong_temp_min_5
  20. entity_summary_1: sensor.kariong_short_text_1
  21. entity_summary_2: sensor.kariong_short_text_2
  22. entity_summary_3: sensor.kariong_short_text_3
  23. entity_summary_4: sensor.kariong_short_text_4
  24. entity_summary_5: sensor.kariong_short_text_5
  25. entity_sun: sun.sun

Optional entries add components to the card. My BOM area (Gosford) does not include visibility or pressure. Edit entities to your correct sensor names. Replace Gosford with your name.

*Please note entity_pop_1 to 5 lines must all be included for daily pop (probability of precip) to show in forecast

*Also note that for daily possible rainfall to show, entity_possible_today as well as the 5 entity_pos_1 to 5 lines are needed.

*Also note that the name for tomorrow’s possible rainfall has changed!

*Defining NEITHER/BOTH entity_pop_intensity and entity_pop_intensity_rate will give an ‘Config Error’ message in the pop slot if defined.

  1. # entity_visibility: If provided from a different source
  2. entity_daytime_high: sensor.bom_today_max
  3. entity_daytime_low: sensor.bom_today_min
  4. entity_temp_next: sensor.gosford_now_temp_now
  5. entity_temp_next_label: sensor.gosford_now_now_label
  6. entity_temp_following: sensor.gosford_now_temp_later
  7. entity_temp_following_label: sensor.gosford_now_later_label
  8. entity_wind_bearing: sensor.gosford_wind_direction
  9. entity_wind_speed: sensor.gosford_wind_speed_kilometre
  10. entity_wind_gust: sensor.gosford_gust_speed_kilometre
  11. # entity_wind_speed_kt: sensor.gosford_wind_speed_knot
  12. # entity_wind_gust_kt: sensor.gosford_gust_speed_knot
  13. entity_humidity: sensor.gosford_humidity
  14. # entity_pressure: sensor.nodemcu_lounge_bme280_seapressure I get pressure from a NodeMCU. Bom does not supply this!
  15. entity_apparent_temp: sensor.gosford_temp_feels_like
  16. entity_daily_summary: sensor.kariong_extended_text_0
  17. entity_pop: sensor.kariong_rain_chance_0
  18. entity_pop_intensity: sensor.gosford_rain_since_9am
  19. entity_possible_today: sensor.kariong_rain_amount_range_0
  20. entity_rain_today: sensor.gosford_rain_since_9am
  21. entity_pos_1: sensor.kariong_rain_amount_range_1
  22. entity_pos_2: sensor.kariong_rain_amount_range_2
  23. entity_pos_3: sensor.kariong_rain_amount_range_3
  24. entity_pos_4: sensor.kariong_rain_amount_range_4
  25. entity_pos_5: sensor.kariong_rain_amount_range_5
  26. entity_pop_1: sensor.kariong_rain_chance_1
  27. entity_pop_2: sensor.kariong_rain_chance_2
  28. entity_pop_3: sensor.kariong_rain_chance_3
  29. entity_pop_4: sensor.kariong_rain_chance_4
  30. entity_pop_5: sensor.kariong_rain_chance_5
  31. entity_fire_danger_summary: sensor.kariong_fire_danger_0

Note: The following entries require template sensors.

  1. entity_current_text: sensor.bom_current_text
  2. entity_uv_alert: sensor.bom_uv_alert
  3. entity_fire_danger: sensor.bom_fire_danger
  4. entity_uv_alert_summary: sensor.uv_cat_formatted

Example template sensors: You can call template sensors whatever you want so long as you use the same name in the card config. (Included in weather.yaml)
I don’t believe templates for areas with two fire danger areas like Perth are required anymore with the new forecasts.
NOTE ALSO that the minimum temperature ‘disappears’ in the early afternoon from the BOM feed. ALso the UV and fire information becomes unknown around 10PM. I have used Template sensors toselect the next day when this happens but have not done this in this latest package (too little benefit!)
I am also parsing the ACTUAL minimum and maximum temperatures to the card rather than the forecast ones for the current day. If you don’t like that, feel free to make your own sensors. (See the minimal card template for examples)

These templates are EXAMPLES. Adjust and adapt as required. Up-to-date templates will always be in the templates.md file.

  1. sensor:
  2. - platform: template
  3. sensors:
  4. bom_current_text:
  5. value_template: >
  6. {% set val = states('sensor.kariong_short_text_0').split('.')[0] %}
  7. {{ val | title }}
  8. uv_cat_formatted:
  9. value_template: "{{ states('sensor.kariong_uv_category_0') | replace('veryhigh', 'Very High') | title }}"
  10. bom_uv_alert:
  11. value_template: >
  12. UV Today: Sun Protection
  13. {{ as_timestamp(states('sensor.kariong_uv_start_time_0'),default='n/a') | timestamp_custom(' %I:%M%p',default='n/a') | lower | replace(" 0", "") }} to {{ as_timestamp(states('sensor.kariong_uv_end_time_0'),default='n/a') | timestamp_custom(' %I:%M%p',default='n/a') | lower | replace(" 0", "") }}, UV Index predicted to reach {{ states('sensor.kariong_uv_max_index_0') }} [{{ states('sensor.uv_cat_formatted') }}]
  14. bom_fire_danger:
  15. value_template: "Fire Danger Today: {{ states('sensor.kariong_fire_danger_0') }}"

Flags are used to control the look and feel of the card (See below for details)

  1. locale: en
  2. static_icons: false
  3. tooltip_bg_color: 'rgb( 75,155,239)'
  4. tooltip_border_color: orange
  5. tooltip_border_width: 3
  6. tooltip_caret_size: 10
  7. tooltip_fg_color: '#fff'
  8. tooltip_left_offset: -12
  9. tooltip_width: 100
  10. tooltips: true
  11. old_daily_format: false
  12. time_format: 24
  13. show_beaufort: true
  14. old_icon: "true" # must be true in quotes for old icons to be rendered
  15. show_decimals: false

Flags

Flag Values Usage
locale en / fr / de / etc. Sets locale display of day names and time formats
static_icons true / false Switches between static (true) and animated (false) icons
tooltips true / false Enables tooltips that show daily forecast summary
tooltip_width 110 Sets the width of the tooltip in px
tooltip_bg_color rgb( 75,155,239) Sets the background color of the tooltip (rgb / # / color)
tooltip_fg_color #fff Sets the foreground color of the tooltip (rgb / # / color)
tooltip_border_color rgb(255,161,0) Sets the color of the tooltip border including the caret (rgb / # / color)
tooltip_border_width 1 Sets the width of the tooltip border in px
tooltip_caret_size 5 Sets the size of the caret (the little arrow pointing down) in px
tooltip_left_offset -12 Sets the offset of the left edge of the tooltip. In negative (-)x
refresh_interval 30 / Integer value Sets the nuber of seconds between card value refreshes
old_daily_format true / false Sets the format of the daily high & low temps to be stacked (old format)
show_beaufort true / false Shows Beaufort Scale wind information
show_separator true / false Shows separator between current conditions columns and current temp / Icon
tempformat highlow / noentry Any setting for this flag will trigger the option to show max/min in daily
time_format locale / 12 / 24 Sets the format sunset and sunrise times. locale format is the default.
temp_top_margin 0px / px or em value Sets the top margin of the Temperature.
temp_font_weight 300 / numeric value Sets the font weight of the Temperature.
temp_font_size 4em / em value Sets the font size of the Temperature.
temp_right_pos 0.85em / px or em value Sets the right position of the Temperature.
temp_uom_top_margin -12px / px or em value Sets the top margin of the Temperature Unit of Meaure.
temp_uom_right_margin 4px / px or em value Sets the right margin of the Temperature Unit of Measure.
apparent_top_margin 45px / px or em value Sets the top margin of the apparent (feels Like) temperature
apparent_right_pos 1em / px or em value Sets the right position of the apparent (feels Like) temperature
apparent_right_margin 1em / px or em value Sets the right margin of the apparent (feels Like) temperature
current_text_top_margin 4.5em / px or em value Sets the top margin of the current temperature text
current_text_left_pos 0px / px or em value Sets the left position of the current temperature text
current_text_font_size 1.5em / em value Sets the font size of the current temperature text
current_text_alignment center / left, right or center Sets the alignment of current text
current_text_width 100% / px, em or % Sets the width of current text
current_data_top_margin 10em / px or em value Sets the top margin of the current data blocks
large_icon_top_margin -3.2em / px or em value Sets the top margin of the current conditions icon
large_icon_left_pos 0px / px or em value Sets the left position of the current conditions icon
separator_top_margin 6em / px or em value Sets the top margin of the separator line
summary_top_padding 2em / px or em Sets the gap between the forecast and summary text
summary_font_size 0.8em / px or em Sets the font size for the summary text
slot_l1 daytime_high Sets the value used in current conditions slot l1 : See slots for more info
slot_l2 daytime_low Sets the value used in current conditions slot l2 : See slots for more info
slot_l3 wind Sets the value used in current conditions slot l3 : See slots for more info
slot_l4 pressure Sets the value used in current conditions slot l4 : See slots for more info
slot_l5 sun_next Sets the value used in current conditions slot l4 : See slots for more info
slot_r1 pop Sets the value used in current conditions slot r1 : See slots for more info
slot_r2 humidity Sets the value used in current conditions slot r2 : See slots for more info
slot_r3 uv_summary Sets the value used in current conditions slot r3 : See slots for more info
slot_r4 fire_summary Sets the value used in current conditions slot r4 : See slots for more info
slot_r5 sun_following Sets the value used in current conditions slot r4 : See slots for more info
use_old_column_format false / true Moves the right column to the right edge (not recommended)
old_icon true / hybrid or false Sets card to render old icons. Must use quotes
show_decimals false / true Sets card to render current and apparent temperatures to 1 decimal place.
show_decimals_today false / true Sets card to render todays min and max temperatures to 1 decimal place.
show_decimals_pressure 0 / 1, 2, 3 Sets card to render pressure with specified decimal places.
custom1_icon mdi:help-box / mdi icon Sets the icon to use for slot custom1
custom1_value unknown / sensor Sets the sensor to use for the value of slot custom1
custom1_units “” / string Sets the string to use for the units of slot custom1
custom2_icon mdi:help-box / mdi icon Sets the icon to use for slot custom2
custom2_value unknown / sensor Sets the sensor to use for the value of slot custom2
custom2_units “” / string Sets the string to use for the units of slot custom2

Slots

The current condition columns are specified by ‘slots’. There are 5 left column slots (designated l1 - l5) and 5 right column
slots (designated r1 - r5). There are currently 10 possible values that can be assigned to a slot. These are:

  • daytime_high
  • daytime_low
  • temp_next
  • temp_following
  • wind
  • wind_kt
  • visibility
  • sun_next (the next sun event … sunset or sunrise)
  • sun_following (The following sun event … if sun_next is a sunset then this will be the following sunrise and vice versa)
  • pop (probability of precipitation) Shows % possible rainfall today and the actual recorded rainfall
  • popforecast Shows % possible rainfall today and forecast rainfall
  • humidity
  • pressure
  • uv_summary
  • fire_summary
  • possible_today (possible rainfall today)
  • possible_tomorrow (possible rainfall tomorrow)
  • rainfall (actual rainfall today)
  • custom1 (populates using config fields custom1_icon, custom1_value and custom1_units)
  • custom2 (populates using config fields custom2_icon, custom2_value and custom2_units)
  • empty (empty slot… the slot below does not rise to fill the space)
  • remove (same as empty but the slot below rises to take the place of the slot)

If configuring with Slots please ensure to fill all available positions, the slots that you do not need can be filled with “remove” to ensure that they remain blank.

My FULL Lovelace configuration for this card is here Cut and paste it into your lovelace.

MINIMAL CARD Example

Please be aware I may update the templates and lovelace config for these cards without making a new release so if you watch this repo you will get notified when this happens.

See these templates:

  1. sensor:
  2. - platform: template
  3. sensors:
  4. bom_forecast_0:
  5. friendly_name: "Today"
  6. value_template: >
  7. {% if states('sensor.kariong_temp_min_0') == 'unknown' %} {% set min = states('sensor.bom_today_min') %} {% else %} {% set min = states('sensor.kariong_temp_min_0') %} {% endif %}
  8. {% if states('sensor.kariong_temp_max_0') == 'unknown' %} {% set max = states('sensor.bom_today_max') %} {% else %} {% set max = states('sensor.kariong_temp_max_0') %} {% endif %}
  9. {{ max|round(0,default='none')}}°/{{ min|round(0,default='none')}}°/{{states('sensor.kariong_rain_chance_0')|round(0,default='none')}}%
  10. entity_picture_template: >-
  11. {%- if states('sun.sun') == 'below_horizon' and (states('sensor.kariong_icon_descriptor_0') == 'fog' or states('sensor.kariong_icon_descriptor_0') == 'haze' or states('sensor.kariong_icon_descriptor_0') == 'hazy' or states('sensor.kariong_icon_descriptor_0') == 'light-showers' or states('sensor.kariong_icon_descriptor_0') == 'partly-cloudy' or states('sensor.kariong_icon_descriptor_0') == 'showers' or states('sensor.kariong_icon_descriptor_0') == 'light_shower' or states('sensor.kariong_icon_descriptor_0') == 'shower' or states('sensor.kariong_icon_descriptor_0') == 'light_showers' or states('sensor.kariong_icon_descriptor_0') == 'partly_cloudy') -%}
  12. {{ '/local/icons/bom_icons/' ~ states('sensor.kariong_icon_descriptor_0') ~ '-night.png' }}
  13. {%- else -%}
  14. {{ '/local/icons/bom_icons/' ~ states('sensor.kariong_icon_descriptor_0') ~ '.png' }}
  15. {%- endif -%}
  16. bom_forecast_1:
  17. friendly_name_template: >
  18. {%- set date = as_timestamp(now(),default='n/a') + (1 * 86400 ) -%}
  19. {{ date | timestamp_custom('Tomorrow (%-d/%-m)',default='n/a') }}
  20. value_template: >
  21. {{states('sensor.kariong_temp_max_1')|round(0)}}°/{{states('sensor.kariong_temp_min_1')|round(0)}}°/{{states('sensor.kariong_rain_chance_1')|round(0)}}%
  22. entity_picture_template: >-
  23. {{ '/local/icons/bom_icons/' ~ states('sensor.kariong_icon_descriptor_1') ~ '.png' }}
  24. bom_forecast_2:
  25. friendly_name_template: >
  26. {%- set date = as_timestamp(now(),default='n/a') + (2 * 86400 ) -%}
  27. {{ date | timestamp_custom('%A (%-d/%-m)',default='n/a') }}
  28. value_template: >
  29. {{states('sensor.kariong_temp_max_2')|round(0)}}°/{{states('sensor.kariong_temp_min_2')|round(0)}}°/{{states('sensor.kariong_rain_chance_2')|round(0)}}%
  30. entity_picture_template: >-
  31. {{ '/local/icons/bom_icons/' ~ states('sensor.kariong_icon_descriptor_2') ~ '.png' }}
  32. bom_forecast_3:
  33. friendly_name_template: >
  34. {%- set date = as_timestamp(now(),default='n/a') + (3 * 86400 ) -%}
  35. {{ date | timestamp_custom('%A (%-d/%-m)',default='n/a') }}
  36. value_template: >
  37. {{states('sensor.kariong_temp_max_3')|round(0)}}°/{{states('sensor.kariong_temp_min_3')|round(0)}}°/{{states('sensor.kariong_rain_chance_3')|round(0)}}%
  38. entity_picture_template: >-
  39. {{ '/local/icons/bom_icons/' ~ states('sensor.kariong_icon_descriptor_3') ~ '.png' }}
  40. bom_forecast_4:
  41. friendly_name_template: >
  42. {%- set date = as_timestamp(now(),default='n/a') + (4 * 86400 ) -%}
  43. {{ date | timestamp_custom('%A (%-d/%-m)',default='n/a') }}
  44. value_template: >
  45. {{states('sensor.kariong_temp_max_4')|round(0)}}°/{{states('sensor.kariong_temp_min_4')|round(0)}}°/{{states('sensor.kariong_rain_chance_4')|round(0)}}%
  46. entity_picture_template: >-
  47. {{ '/local/icons/bom_icons/' ~ states('sensor.kariong_icon_descriptor_4') ~ '.png' }}
  48. bom_forecast_5:
  49. friendly_name_template: >
  50. {%- set date = as_timestamp(now(),default='n/a') + (5 * 86400 ) -%}
  51. {{ date | timestamp_custom('%A (%-d/%-m)',default='n/a') }}
  52. value_template: >
  53. {{states('sensor.kariong_temp_max_5')|round(0)}}°/{{states('sensor.kariong_temp_min_5')|round(0)}}°/{{states('sensor.kariong_rain_chance_5')|round(0)}}%
  54. entity_picture_template: >-
  55. {{ '/local/icons/bom_icons/' ~ states('sensor.kariong_icon_descriptor_5') ~ '.png' }}
  56. bom_forecast_6:
  57. friendly_name_template: >
  58. {%- set date = as_timestamp(now(),default='n/a') + (6 * 86400 ) -%}
  59. {{ date | timestamp_custom('%A (%-d/%-m)',default='n/a') }}
  60. value_template: >
  61. {{states('sensor.kariong_temp_max_6')|round(0,default='unknown')}}°/{{states('sensor.kariong_temp_min_6')|round(0,default='unknown')}}°/{{states('sensor.kariong_rain_chance_6')|round(0,default='unknown')}}%
  62. entity_picture_template: >-
  63. {{ '/local/icons/bom_icons/' ~ states('sensor.kariong_icon_descriptor_6') ~ '.png' }}
  64. bom_today_max:
  65. value_template: >
  66. {{ state_attr('sensor.today_temp_bom', 'max_value') }}
  67. bom_today_min:
  68. value_template: >
  69. {{ state_attr('sensor.today_temp_bom', 'min_value') }}
  70. - platform: average
  71. name: today_temp_bom
  72. entities:
  73. - sensor.gosford_temp
  74. start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
  75. end: '{{ now() }}'

NOTE I am using a custom component average for the bom_today_max and bom_today_min sensors.
See that for day 0, if the min/max is missing from the forecast it uses the average component.
In the weather.yaml package, I use the statistics sensor instead of the custom average component (and provide code for both so you can choose)..
You can then display these on an entities card like this:
Note this uses a custom hui_element card in case BOM isn’t publishing day 6

  1. type: entities
  2. title: BOM Forecast
  3. show_header_toggle: false
  4. entities:
  5. - sensor.bom_forecast_0
  6. - sensor.bom_forecast_1
  7. - sensor.bom_forecast_2
  8. - sensor.bom_forecast_3
  9. - sensor.bom_forecast_4
  10. - sensor.bom_forecast_5
  11. - type: 'custom:hui-element'
  12. card_type: conditional
  13. conditions:
  14. - entity: sensor.bom_forecast_6
  15. state_not: "unknown°/unknown°/unknown%"
  16. card:
  17. type: entities
  18. card_mod:
  19. style: |
  20. ha-card {
  21. box-shadow: none;
  22. --ha-card-background: rgba(0, 0, 0, 0);
  23. margin: -16px -16px -16px -16px;
  24. }
  25. entities:
  26. - entity: sensor.bom_forecast_6

image

Extra Info Card example

image

I show some additional info on a seperate card. This utilises the Beaufort, Heat Index templates as well as an illuminance computation.
I have added an illuminance package derived from Brian Hanifin’s work here

I also used Phil Bruckners illuminance component for comparison using met.no here

I use a history graph to display these

image

Please be aware I may update the templates and lovelace config for these cards without making a new release so if you watch this repo you will get notified when this happens.

I am hoping to refine this and maybe use to assist with turning on an indoor light.

My Lovelace Code to display these is here:
(Note I am using the config-template-custom-card also in HACS by Ian)

  1. - type: 'custom:config-template-card'
  2. variables:
  3. - states['sensor.beaufort'].state
  4. - states['sensor.heatindex'].state
  5. - states['sensor.heatindexrating'].state
  6. - states['sensor.gosford_temp'].attributes['issue_time']
  7. entities:
  8. - sensor.beaufort
  9. - sensor.heatindex
  10. - sensor.heatindexrating
  11. - sensor.gosford_temp
  12. card:
  13. type: 'custom:hui-entities-card'
  14. entities:
  15. - entity: sensor.bom_forecast_0
  16. - entity: sensor.beaufort
  17. name: "${'Beaufort force:' + '\xa0'.repeat(2) + (vars[0] == 12 ? 'Hurricane Force' : vars[0] == 11 ? 'Violent Storm' : vars[0] == 10 ? 'Storm, whole gale' : vars[0] == 9 ? 'Strong/severe gale' : vars[0] == 8 ? 'Gale/ fresh gale' : vars[0] == 7 ? 'High wind, moderate/near gale' : vars[0] == 6 ? 'Strong breeze' : vars[0] == 5 ? 'Fresh breeze' : vars[0] == 4 ? 'Moderate breeze' : vars[0] == 3 ? 'Gentle breeze' : vars[0] == 2 ? 'Light breeze' : vars[0] == 1 ? 'Light air' : 'Calm')}"
  18. - entity: sensor.heatindex
  19. name: "${'Heat Index:' + '\xa0'.repeat(2) + vars[2]}"
  20. - entity: sensor.gosford_temp
  21. name: "${'BOM Update:' + '\xa0'.repeat(2) + ( new Date(vars[3]).toLocaleTimeString('en-US') ) + '\xa0'.repeat(2) + 'Current Temp' }"
  22. - entity: sensor.illuminance
  23. type: "custom:template-entity-row"
  24. secondary: "{{ states('weather.kariong') }} weather.kariong"
  25. state: "{{ '{:,}'.format((states('sensor.illuminance'))|int) }} lx"
  26. icon: mdi:brightness-5
  27. - entity: sensor.estimated_illuminance
  28. type: "custom:template-entity-row"
  29. secondary: "{{ states('weather.home') }} weather.home"
  30. state: "{{ '{:,}'.format((states('sensor.estimated_illuminance'))|int) }} lx"
  31. icon: mdi:brightness-5
  32. - type: history-graph
  33. title: Outdoor Illuminance
  34. hours_to_show: 48
  35. refresh_interval: 300
  36. entities:
  37. - sensor.illuminance
  38. - sensor.estimated_illuminance