Custom Dark Sky Animated Weather Card

Ok… looks like a bug… The sun was above the horizon when I wrote the code so this code path didn’t get thoroughly tested… will put out an update soon

If you comment out the 132 and 135 it “works”. So it has to be something about that method.

edit: man, you’re too fast :slight_smile:

I figured as much. Still, I want it to show always, sort of a header for the card… I might rethink the options then, and think of some default icon to show if the weather component goes wrong…

i use the buienradar component for this card.

  - type: custom:card-modder
    style:
      background-image: url("/local/lovelace/images/weather-background-[[ sun.sun.state ]].png")
      background-size: 100% 400px
      --primary-text-color: var(--primary-text-color)
      --secondary-text-color: var(--secondary-text-color)
      --paper-item-icon-color: var(--primary-text-color) #small variation icons
    card:
      type: custom:weather-card
      title: Modded Woensdrecht
      entity_weather: weather.woensdrecht
      entity_sun: sun.sun
      entity_apparent_temperature: sensor.jagti_windchill
      entity_wind_force: sensor.br_wind_force

which has the station name as attributes.friendly_name.

@Kaostral @Narfel I have updated the card. Try it again if you wouldn’t mind. It is working now for me.

I can confirm, it is working fine.

Thank you for the quick update !

By the way, i noticed that you used this in your lovelace
entity_forecast_low_temp_1: sensor.dark_sky_overnight_low_temperature_0

It doesn’t seem to be working unless I replace it by
entity_forecast_low_temp_1: sensor.dark_sky_overnight_low_temperature_1

Getting this error when I do not
dark-sky-weather-card.js:169:85 Uncaught TypeError: Cannot read property 'state' of undefined

You need to add the 0th forecast day to your Dark Sky sensor config.

    forecast:
      - 0
      - 1
      - 2
      - 3
      - 4
      - 5

This was a note I had in the original post about this …

More info on this …

Oh thank you, I actually read those but i guess I missed this.

this pops up every time the card is loaded:

frontend_latest/app-0d042052.js:773:25742 TypeError: this.detached is not a function. (In 'this.detached()', 'this.detached' is undefined)

have another weather card which gives the same, which might be expected, since the cards use plenty same code.

always points at the line:

this.content.innerHTML = `

can’t and the detached in the code though so what might that be?

Great work! Like it!
Would be nice if the locale setting also changes the wind direction letters.
So ‘E’ (East) would be ‘O’ (Ost) in my language.

Does the card eventually load or does it stay at that error…

Yah… The wind direction letters are hard coded. If someone can provide a translation list for a specific language I can add it and use the locale flag to show them

Can’t find one at google, so maybe everyone can add his language?

de:
  N
W   O
  S
en:
  N
W   E
  S

For me the ‘O’ is enough. :grinning:

Wondering how it’s done in the darksky weather component.
Auswahl_160

EDIT: Or maybe a simple flag?
directions: NOSW

its loaded fine! also the new sunset and sunrise Ive asked for… thanks for that a bunch.

couldn’t that be done with a mapper, just like the weather icons?

btw, Ive simply done it manually in my other cards:

const windDirections = ['N','NNO','NO','ONO',
                        'O','OZO','ZO','ZZO',
                        'Z','ZZW','ZW','WZW',
                        'W','WNW','NW','NNW',
                        'N'];

for italian:

N (north) S (South) O (West) Est (Est)

Thanks for the update! Another minor thing: on iOS/webkit the tooltip info gets printed rather ugly below the temps.

That looks like a .css file issue. I dont have a iPhone so I cant test…

HI!

trying to get the Tooltips more in style with the icons I made it this far:

21

would the tooltip box have a border we can change?

this is what I did to change the color of the box and text, and the little arrow below the tooltip:

.fcasttooltip .fcasttooltiptext {
  visibility: hidden;
  width: 110px;
  background-color: rgb( 75,155,239);
  color: #fff ;
  text-align: center;
  border-radius: 6px;
  padding: 5px 0;

  /* Position the tooltip */
  position: absolute;
  z-index: 1;
  bottom: 50%;
  left: 0%; 
  margin-left: -5px;
}

.fcasttooltip .fcasttooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: rgb(255,161,0) transparent transparent transparent;
}

would love to have the border around the blue box in the same orange color
/* color orange = rgb(255,161,0)

If you take out the ::after part in the css it works fine in ios/webkit as the usual “tap to tooltip” behaviour.

edit: what i meant is: if you remove the section shown below

image

No problems on iOS here.