Compass Card - Points you in the right direction šŸ§­

Great stuff, @tomvanswam! Just discussed with my kids that itā€™d be cool to have wind visualized with a compassā€“here it comes :wink:

North offset is awesome: now I can adjust the compass to match orientation of the display. Is it possible to put a custom image on the background? It could be a top overview of the house. So it would be nice to see, which windows wind actually goes.

I especially loved sun azimuth. However, it might be sensible to show it only when sun is actually above the horizon. Itā€™s a little bit weird to see sun on the North. Additionally, I think sun elevation could be integrated into the compass: putting circle closer to the center depending on the angle.

2 Likes

Thanks! Nice to hear the card is discussed with kids, I wish my kid is also interested in stuff like that when she grows up.

Adding a background is a good idea. If you could make a feature request on the github site, the request will stay on my radar.

It is already possible to hide the azimuth indicator at certain elevations, just use this piece of yaml for the azimuth inidcator:

indicator_sensors:
  - sensor: sun.sun
    attribute: azimuth
    indicator:
      type: circle
      color: orange
      show: false
      dynamic_style:
        sensor: sun.sun
        attribute: elevation
        bands:
          - from_value: 0
            show: true

This will hide the indicator for elevations less than 0.

Iā€™m less fan of changing the location of the indicator towards the inside of the circle tbh, so I hope the config above will also serve your needs well enough.

Thanks for the hint! Sorry, my faultā€“havenā€™t read that manualā€¦

I was wondering what are the options for the indicator object? Details on that are missing in the manual: there is a non-active link to (GitHub - tomvanswam/compass-card: A Lovelace card that shows a directional indicator on a compass for Home Assistant). Is it possible to use an mdi-icon as an indicator object?

Thanks for the heads-up on the link. No worries on not reading the manual. Iā€™ve been told itā€™s not that complete anyways :rofl:

Currently there are 3 types of indicators you can choose, all of which are shown in an example in the readme.

indicator_sensors:
  - sensor: sensor.wind_dir
    indicator:
      type: arrow_inward
  - sensor:  sun.sun
    attribute: azimuth
    indicator:
      type: circle
  - sensor: sensor.friends_direction
    indicator:
      type: arrow_outward

mdi support would be a nice feature I guess. Iā€™ll think about it, and how to implement it.

Iā€™m using the compass card for lightnings, add-on blitzortung.org and it works flawlessly. I have one little problem though, when there is no lightning activity (95% of the time) the add-on brings back ā€œunknownā€ in the azimuth entitiy and compass card falls back to default azimuth 0Ā°, north.

Since ā€œunknownā€ is not an integer or float value, the band filter doesnā€™t show any effect. As a result many times I have zero lightning in north which is a bit annoying.

Do you think itā€™s feasible to integrate a general filter for ā€œunknownā€ instead of the fallback to zero/north?

Good idea!

Would you be so kind to add a feature request on Github?

Yup, I can do so. Do you prefer feature requests in the issue or pr section?

When you also can provide the code change, I prefer the PR section :wink:

Otherwise the issue section will do, and you can add the enhancement label.

done with


but I canā€™t label it with enhancement.

Ah didnā€™t know that, but I added it already.

Iā€™m trying to use the compass card. But canā€™t get the wind direction to work, it keeps pointing North. Iā€™m on HA 2021.5.5.

I have the following configuration:
1

type: 'custom:compass-card'
indicator_sensors:
  - sensor: sensor.tuk_wind_direction
    indicator:
      type: arrow_inward
value_sensors:
  - sensor: sensor.tuk_wind_speed
language: nl

3

What could be the cause?

The sensor only works with numeric degrees (0-360) or cardinal directions abbreviated in English. Your sensor has the cardinal directions abbreviated in Dutch, so it displays the default north.

The direction abbreviation language is only for displaying the abbreviation, not for reading the abbreviation from the sensor.

Use the sensor.tuk_wind_direction_azimuth (enable in your configuration.yaml when needed) to get numeric values and use the card.

1 Like

Thanks for the fast response, it worked!

4

1 Like

How do I get the direction (ENE in your screenshot) larger?

You can do that with card-mod

This should show you most of the options:
1

type: custom:compass-card
style:
  top: 50%
  left: 50%
  box-shadow: none
  background-color: transparent
  transform: scale(1,1) translate(-50%,-50%)
indicator_sensors:
  - sensor: sensor.wf_wind_bearing_avg
    indicator:
      type: arrow_inward
value_sensors:
  - sensor: sensor.wf_wind_speed_avg
  - sensor: sensor.wf_wind_bearing_avg
language: en
compass:
  north:
    show: true
1 Like

Except the one he asked about for which he will need card-mod
Example:

            header:
              title:
                value: Wind Direction & Sun
            indicator_sensors:
              - sensor: sensor.gosford_wind_direction
                indicator:
                  type: arrow_inward
                  dynamic_style:
                    sensor: sensor.gosford_wind_speed_kilometre
                    bands:
                      - from_value: 0
                        color: '#039BE5'
                      - from_value: 18.52
                        color: '#0da035'
                      - from_value: 37.04
                        color: '#e0b400'
                      - from_value: 55.56
                        color: '#e45e65'
              - sensor: sun.sun
                attribute: azimuth
                indicator:
                  type: circle
            value_sensors:
              - sensor: sensor.gosford_wind_speed_kilometre
              - sensor: sensor.solar_elevation
            compass:
              north:
                show: true
                offset: 0
            card_mod:
              style: |
                .sensor-1 .measurement {
                  font-size: 28px !important; 
                } 

But he will need to work out the element name for the direction text.
image

1 Like

I use card-mod classes in my themes:

  card-mod-theme: day
  card-mod-card: |

    ha-card.top-level-graph.compass-card .name {
      font-size: 20px !important;
      font-weight: 300 !important;
      letter-spacing: 0px;
    }

    ha-card.top-level-graph.compass-card .icon,
    ha-card.top-level-graph.compass-card .name,
    ha-card.top-level-graph.compass-card .indicator-sensors .abbr {
      color: var(--primary-text-color) !important;
    }

    ha-card.top-level-graph.compass-card .name {
      margin-top: -2px;
    }

    ha-card.top-level-graph.compass-card .value-sensors {
      top: 92px;
      font-weight: 100;
    }

    ha-card.top-level-graph.compass-card .value-sensors .value {
      font-size: 14px;
      line-height: 1.2em;
      font-weight: 400;
    }

    ha-card.top-level-graph.compass-card .value-sensors .measurement {
      font-size: 14px;
      font-weight: 300;
      line-height: 1.6em;
      opacity: 1;
      color: var(--primary-text-color) !important;
    }

    ha-card.top-level-graph.compass-card .indicator-sensors {
      top: 60px;
      font-weight: 300;
    }

    ha-card.top-level-graph.compass-card .indicator-sensors .abbr  {
      font-size: 2.4em;
      line-height: 30px;
      opacity: 1;
      color: var(--primary-text-color) !important;
    }

Then in the card:

card_mod:
  class: top-level-graph
type: custom:compass-card
indicator_sensors:
  - sensor: sensor.hobart_wind_direction
...ect

by element name you are refering to ā€œ.sensor-1 .measurementā€?

I use your theme but dont adjust my cards with the card-mod classes. I dont fully understand how cards breakdown to be able to adjust them properly.

I can add the card-mod class to the card and it changes to whats in the theme but when I adjust the class(es) in the theme nothing happens.