GithubHelp home page GithubHelp logo

mishaaq / sun-card Goto Github PK

View Code? Open in Web Editor NEW
50.0 50.0 10.0 394 KB

Lovelace card for sun component - Home Assistant

License: MIT License

JavaScript 2.50% TypeScript 97.50%
home-assistant lovelace lovelace-ui

sun-card's People

Contributors

chipriley avatar mishaaq avatar pmosbach avatar thelastproject avatar thomasloven avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sun-card's Issues

Moon phases for Southern Hemisphere

Describe the bug
The moon phases are seen differently in the Northern and Southern Hemispheres. There needs to be a capability where the hemisphere can be specified. See link: moon phases

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.
The phases are shown based in the hemisphere of the location of home assistant instance.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Card not showing up on the Dashboard

I'm probably missing something here, but the Sun card seems to be properly installed in HACS, but I still can't find it when trying to add a new card on lovelace.

image

image

Everything is updated and running on the most recent versions, no significant errors in the logs and I already rebooted several times after install.

No default language, card crashes when using "Norwegian Bokmål" (language code "no")

Describe the bug
When language set to "Norwegian Bokmål" on the user profile, the card crashes due to unkown language code "no". If I change it to English the card works as expected.

To Reproduce
Click on your name in left menu and change to language "Norwegian Bokmål". Go back to the view where you have added the card and you will see that it doesn't render. In developer tools, you will find this:

Uncaught (in promise) Error: No language undefined.
doHumanization sun-card.js:452
humanize sun-card.js:452
renderDaylight sun-card.js:700
render sun-card.js:620
update sun-card.js:186
update sun-card.js:616
performUpdate sun-card.js:148
_enqueueUpdate sun-card.js:148
_requestUpdate sun-card.js:148
initialize sun-card.js:148
initialize sun-card.js:186
J sun-card.js:148
ne sun-card.js:186
a sun-card.js:616
createElement ute:1
s chunk.c136a66895309b59c3fe.js:13138
d chunk.c136a66895309b59c3fe.js:13138
d chunk.c136a66895309b59c3fe.js:13138
l chunk.c136a66895309b59c3fe.js:13138
Vt chunk.c136a66895309b59c3fe.js:12159
value chunk.c136a66895309b59c3fe.js:23707
value chunk.c136a66895309b59c3fe.js:24142
value chunk.c136a66895309b59c3fe.js:23707
n app.664a8247.js:1
d chunk.c136a66895309b59c3fe.js:13138
sun-card.js:452:212500
_enqueueUpdate sun-card.js:148
InterpretGeneratorResume self-hosted:1478
AsyncFunctionNext self-hosted:684
(Async: async)
_requestUpdate sun-card.js:148
initialize sun-card.js:148
initialize sun-card.js:186
J sun-card.js:148
ne sun-card.js:186
a sun-card.js:616
createElement ute:1
s chunk.c136a66895309b59c3fe.js:13138
d chunk.c136a66895309b59c3fe.js:13138
d chunk.c136a66895309b59c3fe.js:13138
l chunk.c136a66895309b59c3fe.js:13138
Vt chunk.c136a66895309b59c3fe.js:12159
value chunk.c136a66895309b59c3fe.js:23707
value chunk.c136a66895309b59c3fe.js:24142
value chunk.c136a66895309b59c3fe.js:23707
n app.664a8247.js:1
d chunk.c136a66895309b59c3fe.js:13138

Expected behavior
Fallback to a defined language if the card stumbles upon a unknown language. I would guess english is a good default language.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Firefox
  • Version 80.0.1

Additional context
If given pointers to where I should add translations for "no" I can submit a PR

Current elevation presentation

It's a nice graphical representation of the sun's elevation, but where do I see the current elevation as a number?
If this isn't available yet, I think it's a nice feature to add as I wanted to use this card to help me to decide what elevation to use to trigger my lightning automation.

Sunrise Info Incorrect in Card

Hello -

Thank you for the awesome work. I have a quick question: I've been trying to find a solution online, but have yet to do so.

I've configured Sun2, and the data is correct, as seen in the attached screen grab from the Developer's Tool. However, the displayed Sunrise info in the card is wrong - it adds a little to it each day, i.e. 13 hours 46 minutes will become 13 hours 52 minutes the following day. But the sunrise displayed info is wrong. I have also added a screen grab of the card configuration.

The sunrise info never gets below 13 hours.

I would greatly appreciate any assistance.

Many thanks.
Screenshot 2023-05-08 at 14 50 30
Screenshot 2023-05-08 at 14 48 20

One idea !

congrats for this !
i would suggest that 👍

  • the sensor sensor.moon could be added on the same card
  • current time also
  • possible to change font size and size of the sun
  • possible to add custom background

Not working with HA 0.110

Describe the bug
A clear and concise description of what the bug is.
The card does not work with HA 0.110. Nothing is displayed.

To Reproduce
Steps to reproduce the behavior:
Upgrade to HA 0.110

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Any
  • Browser Any
  • Version

Smartphone (please complete the following information):

  • Device: Any
  • OS: N/A
  • Browser All
  • Version

Additional context
Add any other context about the problem here.

24h clock format does not include leading 0

Describe the bug
When sun-card is configured to show time using Clock format 24h it does not include leading 0.

Screenshot 2020-08-25 at 03 16 08

To Reproduce

  1. Go to Card Configuration
  2. Set Clock format to 24h

Screenshot 2020-08-25 at 03 18 41

Expected behavior
Numbers under 10 usually have a zero in front as described in Wikipedia 24-hour clock. For example in the screen show below 6:10 should be 06:10.

Desktop (please complete the following information):

  • OS: iOS
  • Browser: Firefox
  • Version: 79.0

Problem with "humanize" of sunEntity.to_sunset

Hello.

I'm using the card with sun2, moon sensor and the required time_utc sensor as well.

It seems that the "sunEntity.to_sunset.humanize(true)" (line 192 of the card.ts) is using the fallback to english instead of the localized version. I find it quite strange, since the other information related to the daylight is displaying in the correct localized language.

I've tried other languages as well, but it's always using the english fallback.

picture

Unfortunately I'm not sure if this problem is related to this card, the sensor or the humanize-duration itself.

High CPU Load

Hi,

If I use your nice Integration on my Dashboard within a browser on a remote raspberry pi 3. I face an very high cpu load for it.
For trying to get an evidence that it comes realy from ha-sun2, I put the integration onto a new blank tab Page as the only element and all Time I switch onto that tab the Raspberry CPU load is going up to 75% - 90%. If I switch back to other Stuff on parallel Pages e.g. Weather or mini media panel it is alway goes down to less then 5% to 10% of CPU load.
If I let the browser window on that tab with your integration, CPU load raises until the raspberry shows up a temperatur alarm on the upper right corner.
I did no special configuration for the configuration on lovelace:

entities:
max_elevation: sun.sun
moon: sensor.moon
noon: sensor.solar_noon
sunrise: sensor.sunrise
sunset: sensor.sunset
meridiem: false
name: Sonnenstand
type: 'custom:sun-card'

Do someone have the same behavier or a hint to prevent it ?

Moon not appearing on Lovelace Card

Describe the bug
Unfortunately I can't see the Moon on the Custom Lovelace Card.
After updating the Sun-Card to the latest version (also version 4.0) is simply isn't present.
Browser has been cleaned an also different browsers has been used for testing.

To Reproduce
Steps to reproduce the behavior:

  1. Open Chrome / Firefox
  2. Go to Home Assistant Lovelace View
  3. Locate the Sun-Card --> No Moon

Expected behavior
The Sun-Card should show the Moon Position, but isn't.

Screenshots
If applicable, add screenshots to help explain your problem.
image

Desktop (please complete the following information):

  • Chrome (Version 79.0.3945.130 (Officiel version) (64-bit))
  • Firefox / Safari (Latest release)

Smartphone (please complete the following information):

  • Ariela Android App, with webview (Latest)

Additional

  • No errors shown in the logs comlaining about the syntax / Moon integration.

JS error appears for a second or two after refreshing the UI

What you mean by "UI is updating" - it occurs from time to time or it happens after page refresh or after after changing the UI config (card or whole UI?)?

When refreshing the UI (pulling down on ios apps (iPhone or iPad) , I havent seen it on chrome yet)
While individual cards are updating assync, the yellow message appears for a couple of seconds, then is replaced by the sun card wich displays correctly (albeit missing moon sensor).

Originally posted by @hugo929 in #16 (comment)

Predicted sunrise incorrect

Describe the bug
Using Sun2, configuration:

entities:
  max_elevation: sensor.max_elevation
  noon: sensor.solar_noon
  sunrise: sensor.nextsunrise
  sunset: sensor.nextsunset
  time: sensor.date_time_utc
meridiem: false
name: Sun
type: 'custom:sun-card'

The time to the predicted sunrise is missing and the predicted time to sunset is way off. This was taken at 22:21 local:

Screenshot_2020-04-06 Home Assistant

Expected behavior
Accurate times to the next sunrise/set

Screenshots
As above.

Desktop (please complete the following information):

  • OS: Windows 10 Pro 64 bit
  • Firefox 74.0
  • v4.3

Additional context
Sun2 configuration:

- platform: sun2
  monitored_conditions:
    - astronomical_dawn
    - sunrise
    - solar_noon
    - sunset
    - astronomical_dusk
    - civil_daylight
    - civil_night
    - max_elevation

I've tried using the local time_date sensor but this made no difference.
My timezone (UTC+11) is set correctly as I have other sensors that depend on this and they are operating correctly.

Moon path

Its possible to get moon data from ipgeolocation.io like:

  - platform: rest
    resource: https://api.ipgeolocation.io/astronomy?apiKey=MyKey&location=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: '{{value_json.moon_status}}'
date: 2022-11-24
current_time: 19:32:50.036
sunrise: 08:36
moonrise: 09:44
moonset: 15:09
moon_status: -
moon_altitude: -26.863470965430853
moon_distance: 364301.28898391494
moon_azimuth: 265.84440759063875
moon_parallactic_angle: 27.564141243389596
friendly_name: Moon API

Would be nice to see the Moon path in your card.

Card not displaying Sunrise

Hello, I'd first and foremost like to say I really enjoy your component and I have been waiting for something like this!

I'm having a small bit of trouble though. The card only display's Sunset. I know there's been some talk of an issue with the default sun component but there wasn't any indication of this affecting your component. Any ideas? Thanks!

Hardware: Raspberry Pi 3
System: HassIO
System Version: 0.92.2
Installation Method: Automatic - Custom_Updater
Card Version: 2.0

image

Release 4.0 doesn't show sensors value

Describe the bug
After updated to 4.0 release with this configuration:

              - type: custom:sun-card
                name: Sole
                meridiem: false
                entities:
                  elevation: sun.sun
                  max_elevation: sun.sun
                  sunrise: sensor.sunrisetoday
                  sunset: sensor.sunsettoday
                  moon: sensor.moon

I don’t see any of the above sensors displayed in the card…

Desktop (please complete the following information):

  • OS: Home Assistant 0.105.3
  • Browser Chrome

Disable AM/PM + fontsize or convert to 24hrs

First text size for AM/PM is too big
Add possibilty to disable AM/PM text
Add possibility to change to 24 hrs display

image

used config

card:
  name: ' '
  type: 'custom:sun-card'
style:
  background-repeat: no-repeat
  background-size: 100% 100%
  border: 'solid 1.5px  # rgba(57,128,228)'
  border-radius: 10px
  '--sc-sunbeam-color': white
  '--sc-event-line-color': white
  '--sc-horizon-color': null
  '--sc-background': >-
    linear-gradient(rgba(1, 1, 254,  0%), rgb(0, 191, 255) 46%, rgb(0, 250, 
    124) 54%, rgba(11, 1,  40,  0%))
type: 'custom:card-modder'

Allow sensors to be specified

Describe the bug
I have sun2 installed and configured, however I've got an entity_namespace setup to group the sensors that it creates - this prevents this card from using the sun2 sensors because the sensors the card is looking for is hard-coded

To Reproduce
Steps to reproduce the behavior:

  1. Setup Sun2
  2. Set entity_namespace for sun2 to anything
  3. setup Card

Additional context
It would be good to be able to specify the names of the sensors required rather then relying on hardcoded values

Shadows at the top and bottom of the plane, due to the linear gradient opacity.

Describe the bug
I want to get rid of the shadows seen at the top/bottom of the image. In the image below the shadows are purple, due to the theme I am using. In the default theme, the shadows are white.

I was trying to set box-shadow, background and the sc-background manually but that didn't solve the issue. It's most likely to be caused by the linear gradient opacity set in the background, but I cannot get it to work at opacity=1.

Can you point me in the right direction?

Also such behavior can me optional to anyone that would want it.

shadow_top_bottom

  • OS: Linux
  • Browser Chrome and Firefox

Day/night customizing

One of the coolest Lovelace cards!

If I may forward my wish list:

  1. Moon path, - not available from the sun component, but maybe just a generic arch?
  2. Customize the moon color.
  3. Customize the day and night sky color (switch when sun is down under the horizon).
  4. Customize the day and night earth color switch when sun is down under the horizon).

Cheers.

No text showing

I have had Sun card work before but some time during the latest updates it broke.
Currently I'm running Home Assistant 0.107.7
sun-card 3.4 works
sun-card 4.0 is broken
sun-card 4.1 is broken
sun-card 4.2 is broken
sun-card 4.3 is broken

image

Name can't be hidden

Describe the bug
The name: field is optional, but blank or unset values do not hide the name from the card

To Reproduce

  1. configure the sun card in lovelace
  2. set the name: property to False or comment it out entirely in the config
  3. observe the default Sun still showing up on the card.

Expected behavior
I would expect that a value of False or an unset value would hide the label/name from the card

Additional context
I am trying to achieve a dense lovelace UI for a project. Every vertical pixel matters and i would like to reclaim the pixels that the name: takes up.

sensor.moon doesnt display

Describe the bug
Moon sensor is not displayed

To Reproduce
Lovelace

          - entities:
              max_elevation: sun.sun
              moon: sensor.moon
              noon: sensor.solar_noon
              sunrise: sensor.sunrise
              sunset: sensor.sunset
            meridiem: false
            name: Soleil
            type: 'custom:sun-card'

Sensors

sensor
  - platform: moon

Config:
arch | x86_64
dev | false
docker | true
hassio | true
os_name | Linux
python_version | 3.7.6
timezone | America/Toronto
version | 0.105.5
virtualenv | false

moon_sensor_state
moon_sensor_state2

Disable themes

How do I disable the recently introduced auto-shade background?

It has made a mess of my card:

Screenshot_2020-06-20 Overview - Home Assistant

Change moment.js to other library

Moment.js is heavy and does not support tree-shaking, so the result bundle is more than 1 MB. It's tempting to swap it with another date/time manipulation library that is at least lighter, ie: Luxon or JS-Joda

Version Key

After upgrade to HA 2021.3.0 the following warning is given:

2021-03-04 09:29:54 WARNING (MainThread) [homeassistant.loader] No 'version' key in the manifest file for custom integration 'sun2'. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'sun2'

does not work

hello
i have installed like this

UI:

  • type: module
    url: /community_plugin/sun-card/sun-card.js

file on the corresponding folder

created card with
type: 'custom:sun-card'
name: Sol

but does not work...returns unavaiable entity
what can i do

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.