Home

Awesome

Compass card

A custom Home Assistant dashboard card that displays an indicator in a circle.

GitHub Release GitHub Release Date GitHub Releases GitHub Releases

HACS Badge HomeAssistant License

Project Maintenance GitHub Activity Open bugs Open enhancements

Community Forum Buy Me A Coffee

Installation

HACS (Home Assistant Community Store)

  1. Go to HACS page on your Home Assistant instance
  2. Select Frontend
  3. Press add icon and search for compass
  4. Select Compass Card repo and install
  5. Force refresh the Home Assistant page (<kbd>Ctrl</kbd> + <kbd>F5</kbd>)
  6. Add compass-card to your page

Manual

  1. Download the 'compass-card.js' from the latest release (with right click, save link as)
  2. Place the downloaded file on your Home Assistant machine in the config/www folder (when there is no www folder in the folder where your configuration.yaml file is, create it and place the file there)
  3. In Home Assistant go to Configuration->Lovelace Dashboards->Resources (When there is no resources tag on the Lovelace Dashboard page, enable advanced mode in your account settings, and retry this step)
  4. Add a new resource
    1. Url = /local/compass-card.js
    2. Resource type = module
  5. Force refresh the Home Assistant page (<kbd>Ctrl</kbd> + <kbd>F5</kbd>)
  6. Add compass-card to your page

Using the card

type: custom:compass-card
indicator_sensors:
  - sensor: sensor.wind_dir

Lovelace Examples

Default

type: custom:compass-card
header:
  title:
    value: Friend's location
indicator_sensors:
  - sensor: sensor.friends_direction
value_sensors:
  - sensor: sensor.friends_distance

Issue #41 shows an example how to calculate the distance/direction of your friend.

Default

Compass indicator arrow_inward

type: custom:compass-card
header:
  title:
    value: Wind
indicator_sensors:
  - sensor: sensor.wind_dir
    indicator:
      type: arrow_inward
value_sensors:
  - sensor: sensor.wind_speed

Default

Compass indicator circle

type: custom:compass-card
header:
  title:
    value: Sun
indicator_sensors:
  - sensor: sun.sun
    attribute: azimuth
    indicator:
      type: circle
value_sensors:
  - sensor: sun.sun
    attribute: elevation

Default

Compass north indicator and direction offset

Left image yaml:

type: custom:compass-card
header:
  title:
    value: Sun
indicator_sensors:
  - sensor: sun.sun
    attribute: azimuth
    indicator:
      type: circle
value_sensors:
  - sensor: sun.sun
    attribute: elevation
compass:
  north:
    show: true

Right image yaml:

type: custom:compass-card
header:
  title:
    value: Sun
indicator_sensors:
  - sensor: sun.sun
    attribute: azimuth
    indicator:
      type: circle
value_sensors:
  - sensor: sun.sun
    attribute: elevation
compass:
  north:
    show: true
    offset: 15

Default

Compass cardinal indicators and background

type: custom:compass-card
header:
  title:
    value: Sun
indicator_sensors:
  - sensor: sun.sun
    attribute: azimuth
    indicator:
      type: circle
value_sensors:
  - sensor: sun.sun
    attribute: elevation
compass:
  circle:
    background_image: /local/compass-card/home.png
    background_opacity: 0.5
  north:
    show: true
    offset: 30
  east:
    show: true
  west:
    show: true
  south:
    show: true

Store the background image in your config/www/ folder (this maps to /local/)

Default

Options

NameTypeRequirementSupportedConfigDescription
typestringRequiredv0.0.1N.a.
headerheader objectOptionalv1.0.0See header objectCard header settings
compasscompass objectOptionalv1.0.0See compass objectCompass settings
indicator_sensorsArray of indicator sensors objectRequiredv1.0.0See indicator sensors objectEntities to use as indicator on compass
value_sensorsArray of value sensors objectOptionalv1.0.0See value sensors objectEntities to show under the direction in compass
languagelanguageOptionalv1.0.0Visual/YAMLShow the abbreviation in the language configured in Home Assistant (default/empty), or configured language
tap_actionaction config objectOptionalv1.0.0See action config objectTap action settings (what happens when you click/touch the card)
debugbooleanOptionalv1.0.0YAMLShow inflated configration & incorrect configured entities and attributes in browsers developers console

Header object

NameTypeRequirementSupportedConfigDescription
titletitle objectOptionalv1.0.0See title objectSettings for the title in the header
iconicon objectOptionalv1.0.0See icon objectSettings for the icon in the header

Title object

NameTypeRequirementSupportedConfigDescription
valuestringOptionalv1.0.0YAMLTitle to show in the card header
colorstringOptionalv1.0.0YAMLColor of object
showbooleanOptionalv1.0.0YAMLShow object
dynamic_styledynamic style objectOptionalv1.0.0 (WIP)YAMLChange style on entity values

Icon object

NameTypeRequirementSupportedConfigDescription
valuestringOptionalv1.0.0YAMLIcon show in the card header
colorstringOptionalv1.0.0YAMLColor of object
showbooleanOptionalv1.0.0YAMLShow object
dynamic_styledynamic style objectOptionalv1.0.0 (WIP)YAMLChange style on entity values

Compass object

NameTypeRequirementSupportedConfigDescription
northnorth objectOptionalv1.0.0See north objectSettings for the north indicator (default hidden)
eastproperties objectOptionalv1.2.0YAMLSettings for the east indicator (default hidden)
southproperties objectOptionalv1.2.0YAMLSettings for the south indicator (default hidden)
westproperties objectOptionalv1.2.0YAMLSettings for the west indicator (default hidden)
circlecircle objectOptionalv1.0.0See circle objectSettings for the compass circle

North object

NameTypeRequirementSupportedConfigDescription
offsetstringOptionalv1.0.0YAMLValue to offset the indicator display with.<br />(E.g. to create a relative north)
colorstringOptionalv1.0.0YAMLColor of object
showbooleanOptionalv1.0.0YAMLShow object
dynamic_styledynamic style objectOptionalv1.0.0 (WIP)YAMLChange style on entity values

Circle object

NameTypeRequirementSupportedConfigDescription
background_imagestringOptionalv1.2.0YAMLURL of image to show in the background of the circle (use square image of preferably 126px by 126px). See Home Assistant documentation for info about hosting files.
background_opacitynumberOptionalv1.2.0YAMLOpacity of the background image 1 = 100% visible, 0.5 = 50% half visible, 0 = fully hidden, anything between 0 and 1 will do.
offset_backgroundbooleanOptionalv1.2.0YAMLIf true then image rotates with north offset (default), if false then image does not rotate with north offset
colorstringOptionalv1.0.0YAMLColor of object
showbooleanOptionalv1.0.0YAMLShow object
dynamic_styleArray of dynamic style objectsOptionalv1.0.0YAMLChange style on entity values

Indicator Sensors object

NameTypeRequirementSupportedConfigDescription
sensorstringRequiredv1.0.0First visual, others YAMLEntity to read state from
attributestringOptionalv1.0.0YAMLAttribute of sensor to read value from instead of entity state
unitsstringOptionalv1.0.0YAMLUnits of measurement to display, default for entity, units of measurement of entity, default for attribute ''
decimalsnumberOptionalv1.0.0YAMLDecimals to show the value in, default 0
indicatorindicator objectOptionalv1.0.0See indicator objectSettings for displaying the state as indicator
state_abbreviationproperties objectOptionalv1.0.0YAMLSettings for displaying the state abbreviation
state_valueproperties objectOptionalv1.0.0YAMLSettings for displaying the state value
state_unitsproperties objectOptionalv1.0.0YAMLSettings for displaying the state units

Value Sensors object

NameTypeRequirementSupportedConfigDescription
sensorstringRequiredv1.0.0First visual, others YAMLEntity to read state from
attributestringOptionalv1.0.0YAMLAttribute of sensor to read value from instead of entity state
unitsstringOptionalv1.0.0YAMLUnits of measurement to display, default for entity, units of measurement of entity, default for attribute ''
decimalsnumberOptionalv1.0.0YAMLDecimals to show the value in, default 0
state_valueproperties objectOptionalv1.0.0YAMLSettings for displaying the state value
state_unitsproperties objectOptionalv1.0.0YAMLSettings for displaying the state units

Indicator object

NameTypeRequirementSupportedConfigDescription
typestringOptionalv1.0.0First visual, others YAMLOne of arrow_outward (default), arrow_inward, circle, the shape of the indicator

Properties object

NameTypeRequirementSupportedConfigDescription
colorstringOptionalv1.0.0YAMLColor of object
showbooleanOptionalv1.0.0YAMLShow object
dynamic_styleArray of dynamic style objectsOptionalv1.0.0YAMLChange style on entity values

Dynamic Style object

NameTypeRequirementSupportedConfigDescription
sensorstringOptionalv1.0.0YAMLEntity to listen to read value from style
attributestringOptionalv1.0.0YAMLAttribute of sensor to read value from to change style
bandsArray of style band objectsRequiredv1.0.0YAMLStyles to use from a certain value (values below the lowest configured value will display as the parent properties object settings)

Style band object

NameTypeRequirementSupportedConfigDescription
from_valuestringRequiredv1.0.0YAMLValue from which upward this bands settings are used to display the parent object with
colorstringOptionalv1.0.0YAMLColor of object
showbooleanOptionalv1.0.0YAMLShow object

Dynamic Style & Style band example

For a card that

Use the following configuration

type: 'custom:compass-card'
header:
  title:
    value: Sun
  icon:
    color: green # default color (for state is less than the lowest dynamic_style.bands.from_value)
    dynamic_style:
      sensor: sensor.uvi
      bands:
        - from_value: 3
          color: yellow
        - from_value: 6
          color: orange
        - from_value: 8
          color: red
        - from_value: 11
          color: purple
indicator_sensors:
  - sensor: sun.sun
    attribute: azimuth
    indicator:
      type: circle
      color: orange
      show: false # default visibility (for state is less than the lowest dynamic_style.bands.from_value)
      dynamic_style:
        sensor: sun.sun
        attribute: elevation
        bands:
          - from_value: 0
            show: true
value_sensors:
  - sensor: sun.sun
    attribute: elevation
    decimals: 1
compass:
  north:
    show: true
    color: green # default color (for state is less than the lowest dynamic_style.bands.from_value)
    dynamic_style:
      sensor: sensor.uvi
      bands:
        - from_value: 3
          color: yellow
        - from_value: 6
          color: orange
        - from_value: 8
          color: red
        - from_value: 11
          color: purple
  circle:
    color: green # default color (for state is less than the lowest dynamic_style.bands.from_value)
    dynamic_style:
      sensor: sensor.uvi
      bands:
        - from_value: 3
          color: yellow
        - from_value: 6
          color: orange
        - from_value: 8
          color: red
        - from_value: 11
          color: purple

Action Config object

NameTypeRequirementDefaultSupportedConfigDescription
actionlist itemOptionalmore-infov0.4.0YAML onlyType of action to launch when clicking/touching the card:<br />more-info<br />navigate<br />url<br/>call-service
entitystringOptional for action more-infoentity used for compass directionv0.4.0YAML onlyEntity to show the more-info of. When empty the compass direction more-info is shown
navigation_pathstringRequired for action navigatev0.4.0YAML onlyPath to navigate to, has to be on the same host as the card is. E.g. /logbook, /config/dashboard or lovelace/default_view
urlstringRequired for action urlv0.4.0YAML onlyUrl to navigate to, can be any valid webpage
new_tabbooleanOptional for action url and navigatetruev0.4.1YAML onlyOpen url or navigate in new tab/window
servicestringRequired for action call-servicev0.4.0YAML onlyHome Assistant service to call, see Developer Tools -> Services what services are available, e.g. light.turn_on
service_datastring, json formatOptional for action call-servicev0.4.0YAML onlyService data to send, see Developer Tools -> Services what data specific services need.<br/>Needs to be a string in json format e.g. {"entity_id": "light.kitchen", "rgb_color": [255,100,100]}

Action config examples

More Info

Open the more info of a person entity when clicking/touching the card

type: custom:compass-card
indicator_sensors:
  - sensor: sensor.friends_direction
value_sensors:
  - sensor: sensor.friends_distance
tap_action:
  entity: person.friend
Navigate

Open the Home Assistant map page when clicking/touching the card

type: custom:compass-card
indicator_sensors:
  - sensor: sensor.friends_direction
value_sensors:
  - sensor: sensor.friends_distance
tap_action:
  action: navigate
  navigation_path: /map
Url

Open Google Maps when clicking/touching the card

type: custom:compass-card
indicator_sensors:
  - sensor: sensor.friends_direction
value_sensors:
  - sensor: sensor.friends_distance
tap_action:
  action: url
  url: https://www.google.nl/maps
Call Service

Send notification when clicking/touching the card

type: custom:compass-card
indicator_sensors:
  - sensor: sensor.friends_direction
value_sensors:
  - sensor: sensor.friends_distance
tap_action:
  action: call-service
  service: notify.notify
  service_data: '{"message": "Hey Im watching you.", "title": "Message from your best friend"}'

Language

The following languages are supported:

LanguageYaml valueSupportedTranslated by
Bulgarianbgv1.4.0@Saentist
Catalancav1.6.0@joan-mb
Czechczv0.4.0@woodcat64
Danishdav1.3.0@DurgNomis-drol
Dutchnlv0.3.0@tomvanswam
Englishenv0.3.0@tomvanswam
Frenchfrv0.3.1@andilge
Germandev0.3.0@rainer-geiger
Hungarianhuv1.0.0@bboti86
Icelandicisv1.5.0@halliiav
Italianitv0.3.0@matteofranceschini
Norwegiannov0.3.1@hwikene
Portugeseptv0.3.1@andilge
Polishplv0.3.2@porebas
Slovenianslv1.2.0@thehijacker
Russianruv0.4.0@artemyevav
Spanishesv0.3.1@andilge
Swedishsev1.5.0@Boris65 and @nickrout
Swedishsvv2.0.0@Boris65 and @nickrout

Pick the language in the visual editor, or add it to yaml config.

Example for Portugese abbreviations (regardless of Home Assistant language setting):

type: custom:compass-card
indicator_sensors:
  - sensor: sensor.friends_direction
value_sensors:
  - sensor: sensor.friends_distance
compass:
  language: pt

More YAML examples

See the issues with the config how-to label for more configuration examples.

Upgrade from version v0.x.x to v1.0.0 +

v1.0.0 has breaking changes, meaning the card wil not work as expected after updating.

Semi-automatic update procedure

To upgrade your v0.x.x card, just open the card in the editor, and save it. No changes needed to the card. The configuration will update to the correct version, and your card is v1.0.0 ready.

If the compass-card is inside another card (horizontal/vertical-stack), use the visual editor menu to navigate to the compass-card. It will update to the new config.

Manual update procedure

See following YAML examples of a full v0.x.x config and its v1.0.0 equivalent Note: the tap_action object does not change and you can keep the v0.x.x version.

v0.x.x

type: custom:compass-card
name: title
entity: sensor.friends_direction
secondary_entity: sensor.friends_distance
direction_offset: 15
compass:
  language: pt
  indicator: arrow_outward
  show_north: true

v1.0.0 +

type: custom:compass-card
header:
  title:
    value: title
indicator_sensors:
  - sensor: sensor.friends_direction
    indicator:
      type: arrow_outward
value_sensors:
  - sensor: sensor.friends_distance
compass:
  north:
    show: true
    offset: 15
language: pt

Wish/Todo list

Contact

You can find me on the Home Assistant Community Site<br /> And occasionally on the HACS and Home Assistant Discord

Thanks to

Support

Help me out for a couple of :beers:, a :coffee: or legos!<br /> Or clone, and create and a PR to help make the card even better.

coffee