mishaaq / sun-card

Lovelace card for sun component - Home Assistant
MIT License
51 stars 10 forks source link

Moon not appearing on Lovelace Card #18

Closed YoinkZed closed 4 years ago

YoinkZed commented 4 years ago

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):

Smartphone (please complete the following information):

Additional

JesCR commented 4 years ago

Same here :/ My card:

      - type: "custom:sun-card"
        name: Orto-Ocaso
        entities:
          elevation: sun.sun
          max_elevation: sensor.max_elevation
          moon: sensor.moon
          noon: sensor.solar_noon
          sunrise: sensor.sunrise
          sunset: sensor.sunset
        style: |
          ha-card {
          --sc-sun-night-color: #606060;
          --sc-sunbeam-color: orange
          }
mishaaq commented 4 years ago

In the newest version I've added some guard checks and validation of moon sensor state values. Could you check it out, please?

JesCR commented 4 years ago

Hi @mishaaq , i'm with the new version but still no moon :/ (BTW is day now, i should wait till night to see it?)

mishaaq commented 4 years ago

(BTW is day now, i should wait till night to see it?)

No, it should be visible throughout the day. Can you check the console for entries prefixed with "Sun Card"?

JesCR commented 4 years ago

Nothing in the home-assistant.log with "sun" :/ (there are other place to check?)

JesCR commented 4 years ago

image

mishaaq commented 4 years ago

Thanks for testing. I meant browser's console - https://kb.mailster.co/how-can-i-open-the-browsers-console/

JesCR commented 4 years ago

Ok! :D

image

Maybe some "spanish character" like "ñ"?

YoinkZed commented 4 years ago

I see the exact same on my end. Running latest (Hass + Sun-Card):

image

ercsey commented 4 years ago

Same for me. Probably because sensor.moon has a state value of waning_gibbous which is not present in sun-card.js.

moonIcon(e) {
        const t = {
            new_moon: "new",
            waxing_crescent: "waxing-crescent",
            first_quarter: "first-quarter",
            waxing_gibbous: "waxing-gibbous",
            full_moon: "full",
            last_quarter: "last-quarter",
            waning_crescent: "waning-crescent"
        }[e];
        return t || console.error(`Sun Card: Unexpected state value '${e}' for moon sensor.`),
        `mdi:moon-${t}`