Lovelace: Sun Card

Hi guys!
I’ve created a simple Lovelace card to track sun position. It shows sun elevation during whole day. It uses sun.sun entity and requires time_date sensors to track current time. In next version I’ll try to enhance the card to support enhanced sun component. Everything you will find in github.


Wait! How are you compensating for the differences for the Earth really being flat?..


Too bad it’s not still April Fool’s Day…:smile:

nevermind…carry on…


As you see, the depiction of the horizon is flat like the Earth itself :wink:


Just want to inform that version 2.0 has been released with Enhanced Sun component support. Details under github link of the project.

1 Like

I just integrated it and I must confess it looks perfect.

1 Like

Glad to hear you like it. Thanks mate!

1 Like

This looks cool, will use it on my weather page. Awesome!

I dont have any data on the card, although i can see picture of horizon.
i have those all time&date sensors as per HA documentation.

But what is “time_date.time_utc” sensor? i either time_date or time_utc sensors


edit: worked , i just rebooted few times.

EDIT: I might have been a bit hasty! I wrote the original post as soon as I had it in my Lovelace. Having watched it (not literally!) for the last few hours it looks like I misunderstood and the sun moves across the card horizontally. So…
… that comment becomes a feature request. Could you make it move in an arc relative to the elevation?

This is a bit of fun!
I have a few cosmetic suggestions though.

Would it be possible to have the horizon with a slight curve?
Can the space between the edges of the card and the sunrise / sunset markers be equal. Or are they proportional to the time?
My sun elevation is currently 45 degrees but the depiction doesn’t really give that impression.
Why does one label say ‘in 11 hours’ and one just says ‘16 hours’ (without the ‘in’)?


1 Like

hi there.
i have installed but cannot make it work. can you support?
i get error that card is not configured


“time_date.time_utc” sensor returns current time for your HA instance in UTC (I could take it from the browser, but it is not always the same if you travel abroad). It helps tracking differences between current time and all Sun events (which are defined in UTC time).

Exactly! The width of the card is proportional to the time, so the left edge is “0:00” and the right edge - “24:00”.

I plan to draw a curve of sun elevation throughout the day. I think it will help to realise what is the current “state”.

First one means the sun is going to set in 11 hours. The second one shows daylight time (difference from sunset and sunrise), but a bit round off too much.

1 Like

Looks like it cannot find the card module. The configuration is minimal (only the name of the card) and optional, so there must be a problem with module loading. Did you downloaded file from github release: or set up a custom updater?

I think this would be a great addition.
Can I suggest that the two labels at the bottom are put on one line and also make the ‘ground’ slightly narrower so giving a bit more space for the sky. This would allow the curve to have a smaller radius.

Just a thought.
Thanks for this card!

Same issue here as @mclaudiopt . Used custom updater.

This is the code i added to Lovelace:

  - type: module
    url: /customcards/github/mishaaq/sun-card.js?track=true

and to add, in the git hub you state : Requires “time_date.time_utc` sensors as well to work properly”. What does this mean in practice and how do i know that these sensors work properly ? Maybe that is what is causing the issue ? Love the card looks btw ! Thanks !

Same here. Have tried both with custom_updater and with local and get No card type found.

My entity shows as sensor.time_utc not time_date.time_utc and my time and date are set up under sensors not as a component, possibly that is why it does not work?

It could be a problem with the release. I’ve made another one and I hope it will eliminate the problem with “No card type configured”

for me it is working
by the way custom_updater is depreciated, now the alternative is HACS

HACS is planned to be supported ofcourse.