Custom Dark Sky Animated Weather Card

Mine just did this:
image
Latest was working great inc current conditions… just now boom??

Well see here…


The fix there fixed it

I have just updated the darksky.js file to the latest as posted above, included the fix as per your link and done a hard-refresh using F12 etc… I get the below error yet card-tools IS on my system, hence the card DID work at one point yesterday. I dont know what else to try now

image

image

Any suggestions?

EDIT: I also get the below in the error log which I guess is relating to the wind direction. I’ll try and fix that in a minute and see if it clears that error.

https://xxxx:8123/local/custom_ui/dark-sky-weather-card.js?v=7.1:229:117 Uncaught TypeError: Cannot read property ‘state’ of undefined

The above error only shows up once whereas the below keeps spamming the log.

https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined

…and now I dont even get the card at all (so it was lucky I managed to get that first screen capture)

I had to delete cookies and auth again…

Just noticed, you seem to be using a different card here. (I don’t have a css file for a start. Your error also points to card-tools

yeah, that css was from the original dark-sky card I think. I could probably delete it since this card doesnt reference it. As i mentioned above though (and in the screen shot) i do have card-tools, I literally put it on my system yesterday… its got me fü©…

well it’s an error with card-tools … I have card-tools as well no error… The red error you’re displaying is for card-tools not darksky

got me back to here:

image

and these in the log:

Have you tried not wrapping it in card-modder?

Here is my config for the stack I have dark-sky in:

      - type: vertical-stack
        cards:
          - type: custom:dark-sky-weather-card
            entity_sun: sun.sun
            entity_daily_summary: sensor.dark_sky_daily_summary
            entity_current_conditions: sensor.dark_sky_icon
            entity_humidity: sensor.dark_sky_humidity
            entity_pressure: sensor.dark_sky_pressure
            entity_temperature: sensor.dark_sky_temperature
            entity_visibility: sensor.dark_sky_visibility
            entity_wind_bearing: sensor.dark_sky_wind_bearing
            entity_wind_speed: sensor.dark_sky_wind_speed
            entity_forecast_high_temp_1: sensor.dark_sky_daytime_high_temperature_1
            entity_forecast_high_temp_2: sensor.dark_sky_daytime_high_temperature_2
            entity_forecast_high_temp_3: sensor.dark_sky_daytime_high_temperature_3
            entity_forecast_high_temp_4: sensor.dark_sky_daytime_high_temperature_4
            entity_forecast_high_temp_5: sensor.dark_sky_daytime_high_temperature_5
            entity_forecast_low_temp_1: sensor.dark_sky_overnight_low_temperature_0
            entity_forecast_low_temp_2: sensor.dark_sky_overnight_low_temperature_1
            entity_forecast_low_temp_3: sensor.dark_sky_overnight_low_temperature_2
            entity_forecast_low_temp_4: sensor.dark_sky_overnight_low_temperature_3
            entity_forecast_low_temp_5: sensor.dark_sky_overnight_low_temperature_4
            entity_forecast_icon_1: sensor.dark_sky_icon_1
            entity_forecast_icon_2: sensor.dark_sky_icon_2

etc…

I’ll give it a try, however I just noticed this on another thread which could be causing the issue

"Unpkg seem to have problems at the moment"

ok that is the identical issue from github I referenced above. Yes that is the error and it seems common to a few plugins. (First post he mentions the mini media card)

yeah, its from the mini_media_player card but I figured that if that website is having troubles, perhaps its why I’m getting those errors since the errors reference that site. Just about to try removing the card-modder from my code and test again

I removed the card-modder code from my lovelace entry or this card and still get the same error spamming the log:

https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined

I had to delete all content on my iPad, log out etc delete cookies… it’s a PITA error of a small screen!

Delete all data, delete cookies and try again. Bloody frustrating.

I did that. Full delete of ALL data ‘time range - all time’ in Chrome. Still not happy. I don’t get the card at all (no red screen), just the log error

no matter what I do, the red card is showing, and have this in the log:

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

returned to the previous version of the card, and the red card is still there… have already cleared cache, refreshed, few times. nothing helps? logged out and back in: idem dito. Red card…
now what?

Did you see this:


That worked for me…

thanks! missed that, and indeed it works right away.

Makes me wonder though, that we need external resources, while the whole purpose of HA was to be able to have it all under local control… can’t we download that resource locally?

Seems more cards are going to use this resource, and if that would mean we are slowly moving to a cloudy solution, I would really appreciate that.

1 Like

I’d say some more clarity around this will be forthcoming over the next few days… Dark-Sky is cloud based anyway… no internet, no data.

sure, appreciate that, as are many external data.
But resources that create the HA instance should be local. We should be able to show an empty interface if the data were missing, and should not get a red card for not being able to load the core interface without connection, or failing servers anywhere.

Hope this will be discussed in the architecture forum.

also see: 🛠️ use local lit by iantrich · Pull Request #11 · bramkragten/custom-ui · GitHub Use local Lit. Not sure if we can use the in the weather-card as such, but Local Lit should be the way forward.

3 Likes

@m.p.frankland
HI Mark,
I think you made a small but important mistake in the Beaufort calculations.
This should be the correct calculation, based on a sensor that has state in m/s (meters per second)

  windkracht:
    friendly_name: Windkracht
    value_template: >
      {% set wind = 3.6 * states('sensor.br_wind_speed')|float %}
      {% set wind_round = wind|round(1) %}
        {% if wind <= 1 %}Bft: 0, Wind stil, {{wind_round}} m/s
        {% elif wind <= 5 %}Bft: 1, Zwak: flauwe wind, {{wind_round}} m/s
        {% elif wind <= 11 %}Bft: 2, Zwak, {{wind_round}} m/s
        {% elif wind <= 20 %}Bft: 3, Matig: lichte bries, {{wind_round}} m/s
        {% elif wind <= 28 %}Bft: 4, Matig: flauwe bries, {{wind_round}} m/s
        {% elif wind <= 39 %}Bft: 5, Vrij krachtig, {{wind_round}} m/s
        {% elif wind <= 50 %}Bft: 6, Krachtig, {{wind_round}} m/s
        {% elif wind <= 62 %}Bft: 7, Hard, {{wind_round}} m/s
        {% elif wind <= 75 %}Bft: 8, Stormachting, {{wind_round}} m/s
        {% elif wind <= 89 %}Bft: 9, Storm, {{wind_round}} m/s
        {% elif wind <= 103 %}Bft: 10, Zware storm, {{wind_round}} m/s
        {% elif wind <= 117 %}Bft: 11, Zeer zware storm, {{wind_round}} m/s
        {% else %} > 117 %}Bft: 12, Orkaan, {{wind_round}} m/s
      {%- endif %}

or:

  wind_bft:
    friendly_name_template: >
      Bft: {{states('sensor.wind_bft')}}
    value_template: >
      {% set wind = 3.6 * states('sensor.br_wind_speed')|float %}
        {% if wind <= 1 %}0
        {% elif wind <= 5 %}1
        {% elif wind <= 11 %}2
        {% elif wind <= 20 %}3
        {% elif wind <= 28 %}4
        {% elif wind <= 39 %}5
        {% elif wind <= 50 %}6
        {% elif wind <= 62 %}7
        {% elif wind <= 75 %}8
        {% elif wind <= 89 %}9
        {% elif wind <= 103 %}10
        {% elif wind <= 117 %}11
        {% else %} > 117 %}12
      {%- endif %}
    entity_picture_template: >
      {% set state = states('sensor.wind_bft') %}
      {% set path = '/local/weather/beaufort/' %}
      {% set ext = '.jpg'%}
        {{[path,state,ext]|join('')|lower}}

right now you forgot to multiply by 3.6 and as a consequence we have a windforce of 1 instead of 3 :wink:

24 31

versus:

41