Home

Awesome

Lovelace Windrose card

hacs_badge

Attention! Version (1.0.0 and higher) has breaking configuration changes. The easiest way is to just add the card and modify the generated configuration.

A Home Assistant Lovelace custom card to show wind speed and direction data in a Windrose diagram.

<img alt="Peview dark" src="https://raw.githubusercontent.com/aukedejong/ha-windrose-card/main/example/windrose-example-north-orientation-dark.png?raw=true" width="482"/> <img alt="Peview light" src="https://raw.githubusercontent.com/aukedejong/ha-windrose-card/main/example/windrose-example-north-orientation-white.png?raw=true" width="482"/> ## Install

HACS (recommended)

This card is available in HACS (Home Assistant Community Store). <small>HACS is a third party community store and is not included in Home Assistant out of the box.</small>

Manual install

  1. Download and copy windrose-card.js from the latest release into your config/www directory.

  2. Add the resource reference as decribed below.

CLI install

  1. Move into your config/www directory.

  2. Grab windrose-card.js:

$ wget https://github.com/aukedejong/lovelace-windrose-card/releases/latest/download/windrose-card.js
  1. Add the resource reference as decribed below.

Add resource reference

If you configure Lovelace via YAML, add a reference to windrose-card.js inside your configuration.yaml:

resources:
  - url: /local/lovelace-windrose-card/windrose-card.js?v=0.0.1
    type: module

Else, if you prefer the graphical editor, use the menu to add the resource:

  1. Open any lovelace view
  2. Select from the three dot menu - "edit dashboard"
  3. The three dot menu is then replaced with another one, select the new three-dot menu (and do not select raw configuration editor*, it will tell you when you try to save it with the resource section, that for adding resources you have to use the three-dot menu choice "Manage Resources" instead). Select "Manage Resources"
  4. Click "Add Resource",
  5. Enter this for url: /hacsfiles/lovelace-windrose-card/windrose-card.js
  6. Click the check box for "Javascript Module" and
  7. Click the word "Create" in the corner to add the entry.

Card options

NameTypeDefaultRequiredDescription
typestringxcustom:windrose-card.
titlestring-The card title.
wind_direction_entityobjectxThe wind direction entity, having directing in degrees as the state.
windspeed_entitiesobjectxOne are more windspeed entities. Only the first is used for the windrose.
refresh_intervalnumber300-Refresh interval in seconds
hours_to_show (DEPRECATED)number-Deprecated. Still works for now. Use the data period object instead.
data_periodobjectxConfigure what data period to query. See object data_period below. Only one options should be configured.
windspeed_bar_locationstringbottom-Location of the speed bar graph: bottom, right
windspeed_bar_fullbooleantrue-When true, renders all wind ranges, when false, doesn't render the speed range without measurements.
hide_windspeed_barbooleanfalse-Hides all windspeed bars.
output_speed_unitstringmps-Windspeed unit used on card, see Windspeed unit options bellow.
output_speed_unit_labelstring-Overwrite the output speed units name, only for display.
center_calm_percentagebooleantrue-Show the calm speed percentage in the center of windrose. Directions corresponding with speeds in the first speedrange are not displayed in a direction leave.
speed_range_beaufortbooleantrue-Uses the Beaufort speed ranges. The exact Beaufort ranges depend on the output windspeed unit. Default is true, when you want to show other speed unit on the bar graph, set this property to false.
speed_range_stepnumberdepends on output speed unit-Sets the speed range step to use. Not possible for output speed unit bft (Beaufort) .
speed_range_maxnumberdepends on output speed unit-Sets the speed range max to use. Not possible for output speed unit bft (Beaufort). For example: step 5, max 20 creates ranges: 0-5, 5-10, 10-15, 15-20, 20-infinity
speed_rangesobjectdepends on output speed unit-Define custom speedranges and colours.
cardinal_direction_lettersstringNESW-The cardinal letters used in the windrose.
wind_direction_countstring16-How many wind direction the windrose can display, min. 4 max. 32
windrose_draw_north_offsetnumber0-At what degrees the north direction is drawn. For example, if you want the windrose north orientation the same as your properties north orientation
show_current_direction_arrowbooleanfalse-Shows the last reported wind direction with a red arrow on the wind rose.
matching_strategystringdirection-first-How to match direction and speed measurements. Find a speed with each direction or a direction with each speed measurement. Options: direction-first, speed-first
colorsobject-Configure colors for different parts of the windrose and windspeedbar. See object Colors.
log_levelstringWARN-Browser console log level, options: NONE, ERROR, WARN, INFO, DEBUG and TRACE

Object data_period

Only one of the options should be configured.

NameTypeDefaultRequiredDescription
hours_to_shownumber-Show winddata for the last number of hours. Number higher then 0.
from_hour_of_daynumber-Show winddata from the configured hours till now. 0 is midnight, so only data of the current day is used. If the set hour is not yet arrived, data from the previous day from that hour is used.

Object wind_direction_entity

NameTypeDefaultRequiredDescription
entitystringxWind speed entity
use_statisticsbooleanfalse-Use Home Assistant 5 minute statistics data, works only if available for this entity. Can make fetching data faster.
direction_unitstringdegrees-Wind direction unit, options: degrees, letters. Where letters being N, NE upto 32 directions.
direction_compensationnumber0-Compensate the measured direction in degrees.
direction_lettersstringNESWX-Only used when direction_unit is 'letters'. Some weather integrations use language specific letters. With this property you can change the default letters used. See https://en.wikipedia.org/wiki/Points_of_the_compass for more info.

Object windspeed_entities

NameTypeDefaultRequiredDescription
entitystringxWind speed entity .
namestring-Label, displayed with the windspeed bar.
use_statisticsbooleanfalse-Use Home Assistant 5 minute statistics data, works only if available for this entity. Can make fetching data faster.
render_relative_scalebooleantrue-Renders the blocks in the windspeed bar relative to the speedrange size. Set to false evenly distributes the blocks.
speed_unitstringauto-Windspeed unit of measurement, see Windspeed unit options bellow. When the speed_range_beaufort property is not set or set to true, the bars will show Beaufort ranges.

Windspeed unit options:

Default is auto. When no windspeed unit is configured, the unit_of_measurement from Home Assisstant is used.

When your windspeed entity uses an unit of measurement not mentioned in the table below, please open an issue in GitHub.

NameDescriptionInputOutputRecognized HA units of measurements
autoautomaticx
BeaufortBeaufortxBeaufort
mpsmetres per secondxxmps, m/s
kphkilometer per hourxxkph, km/h
mphmiles per hourxxmps, m/h
fpsfeet per secondxxfps, f/s
knotknotsxxknots, knts, kts

Object speed_ranges

NameTypeDefaultRequiredDescription
from_valuenumberxStart speed of a speed range
colorstringxColor CSS value

Object colors

For some value the theme variable --primary-text-color is used. This is needed if HA switches theme light/dark mode. CSS color values are allowed.

NameTypeDefaultRequiredDescription
rose_linesstringrgb(160, 160, 160)Circles, borders and the cross color
rose_direction_lettersstring--primary-text-colorDirection letters color
rose_center_percentagestringautoCenter calm percentage color. Auto means black or white depending on background color.
rose_percentagesstring--primary-text-colorPercentage legend color
rose_current_direction_arrowstringredCurrent direction arrow color
bar_borderstringrgb(160, 160, 160)Bar border color
bar_unit_namestring--primary-text-colorUnit name color
bar_namestring--primary-text-colorEntity name color
bar_unit_valuesstring--primary-text-colorUnit value color
bar_percentagesstringautoPercentage color. Auto means black or white depending on background color.
_

Example colors yaml

colors:
  rose_lines: 'rgb(0,255,0)'
  rose_direction_letters: 'yellow'
  rose_center_percentage: 'red'
  rose_percentages: 'blue'
  rose_current_direction_arrow: 'purple'
  bar_border: 'hsl(200, 100%, 60%)'
  bar_unit_name: 'purple'
  bar_name: 'yellow'
  bar_unit_values: 'blue'
  bar_percentages: 'orange'

Examples using custom speed ranges

Custom fixed length speed ranges:

Uses speed_range_step and speed_range_max.

<img alt="Pevriew" src="https://raw.githubusercontent.com/aukedejong/ha-windrose-card/main/example/speedbar_step_5_max_25.png?raw=true" width="415"/>
type: custom:windrose-card
title: Wind direction
data_period:
  hours_to_show: 24
windspeed_bar_full: true
wind_direction_entity:
  entity: sensor.wind_direction
windspeed_entities:
  - entity: sensor.wind_speed
    name: Average
speed_range_beaufort: false
output_speed_unit: mps
speed_range_step: 5
speed_range_max: 25

When you want full control

Uses speed_ranges configuration, custom ranges and colors.

Always make sure there is a speedrange starting from 0, otherwise you can the this error:

Speed is not in a speedrange: 0.6 unit: mps

<img alt="Pevriew" src="https://raw.githubusercontent.com/aukedejong/ha-windrose-card/main/example/speedbar_speed_ranges_custom.png?raw=true" width="412"/>
type: custom:windrose-card
title: Wind direction
data_period:
  hours_to_show: 24
windspeed_bar_full: true
wind_direction_entity:
  entity: sensor.wind_direction
windspeed_entities:
  - entity: sensor.wind_speed
    name: Average
output_speed_unit: mps
speed_range_beaufort: false
speed_ranges:
  - from_value: 0
    color: rgb(0,255,0)
  - from_value: 5
    color: yellow
  - from_value: 10
    color: hsl(200, 100%, 60%)
  - from_value: 20
    color: orange
  - from_value: 40
    color: red

Getting errors?

Make sure you have javascript_version: latest in your configuration.yaml under frontend:.

Make sure you have the latest versions of windrose-card.js.

If you have issues after updating the card, try clearing your browser cache.

If you have issues displaying the card in older browsers, try changing type: module to type: js at the card reference in ui-lovelace.yaml.

License

This project is under the MIT license.