Home Assistant Lovelace card to present sun.sun
entity. Requires sensor.time_utc
sensor from date_time
component as well to work properly.
It provides visual information about current sun elevation throughout the day, time of sunrise/sunset. Available data depends on used Sun component: pre-existing one from Home Assistant (Basic), extended available here (Extended) or leverage Sun2 extension available here.
Used Sun component | Current sun elevation | Sunrise | Sunset | Noon | Daylight duration | Time to sunset |
---|---|---|---|---|---|---|
Basic | ☀️ | Only future | Only future | 🌑 | 🌑 | ☀️ |
Extended | ☀️ | ☀️ | ☀️ | 🌑 | ☀️ | ☀️ |
Sun2 | ☀️ | ☀️ | ☀️ | ☀️ | ☀️ | ☀️ |
You have to have mentioned
monitored_conditions
enabled in component:
- for
Extended sun
component:elevation
,max_elevation
,daylight
,sunrise
,sunset
- for
Sun2
component:sunrise
,sunset
,solar_noon
,max_elevation
,daylight
Name | Type | Requirement | Description |
---|---|---|---|
type | string | Required | custom:sun-card |
name | string | Optional | Card name |
You can simply change default style of the card specifying CSS variables in your theme:
Variable | CSS Attribute | Purpose |
---|---|---|
--sc-background | background | background of the viewport |
--sc-sun-color | fill | Sun fulfillment color |
--sc-sunbeam-color | stroke | Sunbeam stroke color |
--sc-event-line-color | stroke | Sunrise, noon and sunset timestamp markers color |
--sc-sun-night-color | stroke | Sun stroke color when being below horizon |
--sc-horizon-color | stroke | Horizon line color |
- Make sure the HACS component is installed and working.
- Add this github repository https://github.com/mishaaq/sun-card/ as custom plugin repository in HACS settings.
- Install the plugin
Sun card
and update lovelace configuration accordingly.
- Make sure the custom_updater component is installed and working.
- Configure Lovelace to load the card.
resources:
- url: /customcards/github/mishaaq/sun-card.js?track=true
type: module
- Run the service
custom_updater.check_all
or click the "CHECK" button if you use thetracker-card
. - Refresh the website.
- Download the sun-card
- Place the file in your
config/www
folder - Include the card code in your
ui-lovelace-card.yaml
title: Home
resources:
- url: /local/sun-card.js
type: module
- Write configuration for the card in your
ui-lovelace.yaml
- type: "custom:sun-card"
name: Sun