Compass Card - Points you in the right direction 🧭

I thnik language goes directly under type and not indented under compass.
so like this:

type: custom:compass-card
indicator_sensors:
  - sensor: sensor.windrichting_graden
    indicator:
      type: arrow_inward
value_sensors:
  - sensor: sensor.windsnelheid
language: nl
1 Like

Yes, that works!

Thanks!

I would love to replicate this dashboard. Specifically, the small cards that show min/max/current/history
What cards are used? With what sensors? and what config?

Much appreciated

It’s just these in vertical and horizontal stacks (grid card did not exist when I made it but that would work too):

type: custom:mini-graph-card
color_thresholds:
  - color: '#e45e65'
    value: 30
  - color: '#e0b400'
    value: 20
  - color: '#0da035'
    value: 10
  - color: '#039BE5'
    value: -50
color_thresholds_transition: hard
entities:
  - entity: sensor.hobart_wind_speed_knot
group: false
hour24: true
line_width: 4
points_per_hour: 6
show:
  extrema: true
  fill: fade
  icon: true
  labels: false
  name: true
  state: true

Is it possible to somehow add the moon as the 2nd circle to show it’s position and phase? The default moon integration doesn’t contain the azimuth data so I’m guessing I’d have to set up a separate sensor for it.

A second circle is certainly possible. However you’ll need a sensor for that as you said, and I’m not aware of one.

Configure the card something like this for 2 circles.

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

Please tell us if you manage to make a moon sensor with the moons position.

This plus a restful integration? API for sunrise, sunset, moonrise and moonset timing

1 Like

Thanks for the link.

Works fine:

  - platform: rest
    resource: https://api.ipgeolocation.io/astronomy?apiKey=MyKey=MyTown,MyCountry
    name: Moon API
    scan_interval: 1200
    json_attributes: 
      - date
      - current_time
      - moonrise
      - moonset
      - moon_status
      - moon_altitude
      - moon_distance
      - moon_azimuth
      - moon_parallactic_angle
    value_template: >
       {% if value_json.moon_altitude > 0 %}
         up
       {% else %}
         down
       {% endif %}
    icon: >
      {{ state_attr('sensor.moon', 'icon') }}

image

@tomvanswam
Please consider to make the indictor object selectable using an icon or the sensors icon attribute.
This way the indicator can change with the sensors state like the suns or the moons state. And some parameter saying to hold the icon level or not, so the icon is not standing on its head when going around the compass.

3 Likes

the astronomy sensor works fine but how did you link it to the compass card? A code snippet would be appreciated!! Thanks


  - type: custom:compass-card
    header:
      title:
        value: Sun and Moon
    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
      - sensor: sensor.moon_api
        attribute: moon_azimuth
        indicator:
          type: circle
          color: black
          show: false
          dynamic_style:
            sensor: sensor.moon_api
            attribute: moon_altitude
            bands:
              - from_value: 0
                show: true
    value_sensors:
      - sensor: sun.sun
        attribute: azimuth
        units: °
        state_value:
          show: false
          dynamic_style:
            sensor: sun.sun
            attribute: elevation
            bands:
              - from_value: 0
                show: true
                color: orange
      - sensor: sensor.moon_api
        attribute: moon_azimuth
        units: °
        state_value:
          show: false
          dynamic_style:
            sensor: sensor.moon_api
            attribute: moon_altitude
            bands:
              - from_value: 0
                show: true
                color: gray
    compass:
      circle:
        color: '#4169E1'
        background_opacity: null
      north:
        show: true
        color: red
      east:
        show: true
      west:
        show: true
      south:
        show: true
1 Like

Trying to show the icon from a binary sensor (binary_sensor.sun2_sun_is_up) in the cards header.
The sensor icon changes with suns position and the moon phase.

Dynamic_style cant be used and it also looks like it cant be used with binary sensors.
How do I get this to work?

  - type: custom:compass-card
    header:
      title:
        value: Sun and Moon
      icon: "{{ state_attr('binary_sensor.sun2_sun_is_up', 'icon') }}" #????

It could be that binary_sensor states are not processed correctly in the dynamic_style.
Please open an issue on GitHub and I’ll try to look into that.
Work around would be, creating a template sensor that has an number state derived from your binary_sensor.

I saw your GitHub feature request, thanks for that!

I commented to the GitHub feature request, I think it’s best to keep the discussion/comments on a feature over there.

thanks for the Moon Api config (and Nick for the link)

rewrote that to the rest: format (as that seems to be the preferred new way to use Rest):

rest:

  - resource: https://api.ipgeolocation.io/astronomy
    scan_interval: 1200
    params:
      apiKey: !secret ipgeolocation_api
      city: Roosendaal
#       country: Netherlands

    sensor:

      - name: Maan astronomy
        unique_id: maan_astronomy
        value_template: >
           {{'Op' if value_json.moon_altitude > 0  else 'Onder'}}
        json_attributes:
          - date
          - current_time
          - moonrise
          - moonset
          - moon_status
          - moon_altitude
          - moon_distance
          - moon_azimuth
          - moon_parallactic_angle

I see this as response:

date: '2022-11-28'
current_time: '12:03:55.998'
moonrise: '13:17'
moonset: '21:13'
moon_status: '-'
moon_altitude: -8.93389619752283
moon_distance: 366052.2397367933
moon_azimuth: 116.93608653786458
moon_parallactic_angle: -32.40016581180939
friendly_name: Maan astronomy

and wonder if the moon_status should be empty, what do you see there please? If I enter it directly on the website, there is no attributes like tat at all, so maybe thats not available in all regions/circumstances

will check the moon tonight certainly, as I cant understand why it would set at 21:13… and rise at 13:17. the Time and date reference clearly state the same, so some digging to do in understanding that… :wink:

Thanks for cleaning up the API code.

From the documentation:

 Moon_status is equal to "-" if the moonrise and moonset
 values are not equal to "-:-". moon_status can be equal to 
 "Always above the horizon" or "Always below the horizon" 
 if the moon is always up or always set within the current 24 hours of the day.

By the way, I have raised an issue with core moon sensor asking for more moon data since python package Astral (V. 3.2 ) now has the calculations for Moon rise, set, azimuth and zenith. And the core moon sensor uses Astral

thanks
considering that, I believe we can leave out the moon_sttus then, as it will always be - in my region?

I did add the sun_distance just now, as that was the only attribute missing from the other integrations (core sun, sun2 by Phil Bruckner) in my config.

would be nice if core would indeed enhance that, though I believe an issue for a FR wont be accepted,… you’d need a true FR for that, or start PR’ing yourself

I also notified Phil Bruckner so hopefully someone does the right thing : )

I ended up using a custom AstroWeather component from HACS to get the Moon Azimuth. Would definitely love to be able to replace the circle indicator with a mdi:icon using the sensor.moon_phase from the Moon integration.

In the mean time I wonder how I can change the direction of the circle so the correct “side” of the moon is facing inwards. Currently I set the color to black so it resembles the moon, but would love to have the dark side facing the appropriate way.

The reasoning behind the two colors on the icon is that the line on which the 2 colors touch is the actual direction. Having just a circle is quite a rough estimate of direction.

There is a feature request for using icons for the indicators. Not sure when I get to that, however I’m more in inclined to implement that instead of rotating indicators for the reasoning mentioned above.

1 Like