Problems displaying wind speed and bearing on a single small card

I’m building a H-stack of additional weather info (wind, humidity, rain) to display under a standard weather card, however I feel like I’m going out of my mind trying to get a single small simple card that shows the current wind status, with both speed and bearing, in a style that matches a plain sensor card.

A weather entity contains separate attributes for wind speed and bearing, but when I check any weather entity in Settings > Entities it shows a single combined “Wind speed” attribute with a value of “<speed> <unit> (<bearing>)”, and even autoconverts a degree bearing to a compass direction. That’s what I want. However, this exact same output does not seem to be available on any native Lovelace card, nor anywhere else outside a weather entity detail pane. Am I missing something here?

The OpenWeatherMap integration provides separate sensor entities for wind speed and bearing. Its wind speed sensor allows the unit of measurement and precision to be changed for display, while the wind bearing sensor displays in degrees but only allows display precision change, not unit of measurement. HASS clearly has built-in support for converting from degrees to compass direction since it does so for the detail view of any weather entity, but does not allow it here for some reason, so (with thanks to some very helpful forum posts) I’ve added a template sensor to get around this limitation.

(Separately, the template helper sensor provides historical values just fine, but enabling graph on its sensor card only shows “no state history found”. I’m guessing this may be due to not being able to plot the string value numerically?)

I can use a sensor card to display either wind value individually no worries. Speed and bearing display on separate cards no worries either. Trying to combine the two in a way that displays consistently alongside other basic weather-related sensor cards in a H-stack seems utterly absurdly frustrating.

V-stacking the individual speed/bearing sensors within the H-stack blows out the H-stack height.

Creating a new template sensor outputting combined speed and compass bearing means either not displaying a unit of measurement for the wind speed, or manually concatenating it between the speed and bearing. Both options break consistency, either by not having a unit of measurement, or by the unit of measurement being in the same font as the state value.

Using an entities card to display both sensors has its own problems; if the card name is set it displays in a different style to the name on a sensor card, and if the card icon is set it displays on the opposite side to a plain sensor card and in a different colour. Leaving the name/icon blank would be acceptable if there was a way to hide the individual entity/sensor names, but this doesn’t seem possible when setting them to blank/null/emptystr reverts to the sensor’s name (which is then too wide to fit name+value within the card).

I’ve also played around with the “multiple-entity-row” package on HACS, but since it extends the entities card it inherits the same issues with card title style and icon colour/alignment.

Is there something obvious I’ve missed?
Is there a way to get a standard Lovelace card to show the combined wind speed+bearing attribute from a weather entity’s detail view?
Is there a way to prevent displaying an entity name within an entities card?
Is there a way to append a second attribute/state in-line after a sensor/entity/entities card’s unit of measurement while retaining the correct value/unit styles?

It seems wild to me that HASS will provide basically the exact output I’m trying to achieve, but only within the detail view of a weather entity. I’ve been trying to keep things as vanilla as possible so far, but do I need to just bite the bullet and wrap my head around building a custom card?

If I do need to go down the custom card route is there a template/skel available anywhere to match the format/styles of a standard sensor card? I had a bit of a look through the frontend source tree but to my lay eyes the standard cards seem built in a very different way. Worst-case I’ll try digging into how the multiple-entity-row package extends the built-in entities card and see if I can adapt that into extending the sensor card to display a second value after the UoM, but hoping someone might have a better idea.

Any thoughts/suggestions/feedback would be greatly appreciated.
Thanks in advance.

I skim read most of that as I am short on time so apologies if you mentioned it but have you seen this?

https://community.home-assistant.io/t/compass-card-points-you-in-the-right-direction/217909

2 Likes

Yes, there is - if you mean this:

This is an entities card with a custom multiple entity row, but I understand you’ve already tried and rejected it.

Do you mean like this?
image

That’s just a matter of putting a blank space in the name field in the entity row editor.

Could you post some examples to show what you mean by “issues with card title style and icon colour/alignment”?

Welcome to the forum, by the way. :grin:

1 Like

Hadn’t come across that, thanks for the tip.

:face_exhaling: …there is not enough facepalm, thanks.

hass ex 1

src
type: horizontal-stack
cards:
  - graph: line
    type: sensor
    entity: sensor.openweathermap_wind_speed
    detail: 1
    name: Wind
  - type: entities
    title: Wind
    icon: mdi:weather-windy
    entities:
      - entity: sensor.openweathermap_wind_speed
        name: " "
        icon: none
      - entity: sensor.wind_direction
        name: " "
  - type: entities
    entities:
      - entity: sensor.openweathermap_wind_speed
        name: " "
      - entity: sensor.wind_direction
        name: " "

Ideally the entities card would render name/icon in the same style as the sensor card (and entity name/value would expand to fill if icon/name are hidden), or if there’s a way to display the direction appended inline to the speed UoM (but styled as a value/state) on a sensor(-styled) card.

Alternatively, I might try playing around with using a combined direction/speed helper sensor (like I assume yours is, with direction prepended so the value style matches) that also uses the original speed sensor graph… I’m guessing stacking a second graph value for the direction is asking a bit much :sweat_smile:

Cheers, and thanks again for your assistance :smile:
…whitespace… I’m still facepalming…

My data come from a weather station in the garden, so they are two separate sensors. The wind direction comes in degrees, and I use a ridiculously elaborate template to convert it to bearings. Other people have posted similar templates, so I don’t think there can be a built-in helper. Let me know if you find one! :grin:

  - sensor:
      - name: "Wind direction ecowitt"
        unique_id: 92a7a6bb-8b91-47ea-81e0-e2d544d52b0e
        icon: mdi:compass-outline
        state: >
        
          {% if states('sensor.wind_direction') | float(0) >= 0 and states('sensor.wind_direction') | float(0) < 11 %}
              N
          {% elif states('sensor.wind_direction') | float(0) >= 11 and states('sensor.wind_direction') | float(0) < 33 %}
              NNE
          {% elif states('sensor.wind_direction') | float(0) >= 33 and states('sensor.wind_direction') | float(0) < 56 %}
              NE
          {% elif states('sensor.wind_direction') | float(0) >= 56 and states('sensor.wind_direction') | float(0) < 78 %}
              ENE
          {% elif states('sensor.wind_direction') | float(0) >= 78 and states('sensor.wind_direction') | float(0) < 100 %}
              E
          {% elif states('sensor.wind_direction') | float(0) >= 100 and states('sensor.wind_direction') | float(0) < 122 %}
              ESE
etc etc etc

Here’s mine: Weather Card | Old + New = Better? - #14 by Markus99

Not sure if anything in there helps, but, if of interest, most of the code is here: GitHub - markus99/ms_weather: Home Assistant Weatherflow Tempest Forecast, Sensors, Template(s)

Wind Snippets:

      ## Wind Speed Sensors
      m99_weather_wind_0d:
        value_template: "{{ states('sensor.wind_speed') | float | round(1) }}"

      ## Wind Direction Senors ( DIR )
      m99_weather_wind_dir_0d:
        value_template: >
          {% set direction = ['N','NNE','NE','ENE','E','ESE','SE','SSE','S','SSW','SW','WSW','W','WNW','NW','NNW','N'] %}
          {% set degree = state_attr('weather.forecast','wind_bearing')|float(0) %}
          {{ direction[((degree+11.25)/22.5)|int] }}

      ## Wind Sensors Combined for Display ( # DIR )
      m99_weather_wind_both_0d:
        value_template: "{{ states('sensor.m99_weather_wind_0d')|round(0) }}{{' '}}{{ states('sensor.m99_weather_wind_dir_0d') }}"