Custom Dark Sky Animated Weather Card

Can you open

http://<your_ip>:8123/local/icons/weather_icons/static/cloudy-day-1.svg

or

http://<your_ip>:8123/local/icons/weather_icons/animated/cloudy-day-1.svg

in your browser?

Apparently not, but why is this happening?

Wrong path maybe?

<config-dir>/www/icons/
└── weather_icons
    ├── animated
    │   ├── cloudy-day-1.svg
    │   ├── cloudy-day-2.svg
    │   ├── cloudy-day-3.svg
    │   ├── ...
    └── static
        ├── cloudy-day-1.svg
        ├── cloudy-day-2.svg
        ├── cloudy-day-3.svg
        ├── ...

Sooo long story short , the folder was icos instead of icons. :smiley:
Now i have icons but i don;t have rest of them things showing on the card like pressure, todays temp, sun rise and sunset etc but i will have to check the entities

Trying to install this and I cannot create an icons folder in www. I can create a folder as long as I name it something other than icons.

Any ideas what could be causing this. Here’s there error I get.

image

1 Like

Make sure you have not excluded icons in the samba settings. (It will be excluded by default)

1 Like

That was it. Thanks

So I am having this issue. Could someone point me in the correct?

:8123/local/custom_ui/dark-sky-weather-card.js?v=0.10.2:96 Uncaught (in promise) TypeError: Cannot read property 'state' of undefined

my Yaml:

      - entity_apparent_temp: sensor.dark_sky_apparent_temperature
        entity_current_conditions: sensor.dark_sky_icon
        entity_daily_summary: sensor.dark_sky_daily_summary
        entity_daytime_high: sensor.dark_sky_daytime_high_temperature_0d
        entity_forecast_high_temp_1: sensor.dark_sky_daytime_high_temperature_1d
        entity_forecast_high_temp_2: sensor.dark_sky_daytime_high_temperature_2d
        entity_forecast_high_temp_3: sensor.dark_sky_daytime_high_temperature_3d
        entity_forecast_high_temp_4: sensor.dark_sky_daytime_high_temperature_4d
        entity_forecast_high_temp_5: sensor.dark_sky_daytime_high_temperature_5d
        entity_forecast_icon_1: sensor.dark_sky_icon_1d
        entity_forecast_icon_2: sensor.dark_sky_icon_2d
        entity_forecast_icon_3: sensor.dark_sky_icon_3d
        entity_forecast_icon_4: sensor.dark_sky_icon_4d
        entity_forecast_icon_5: sensor.dark_sky_icon_5d
        entity_forecast_low_temp_1: sensor.dark_sky_overnight_low_temperature_0d
        entity_forecast_low_temp_2: sensor.dark_sky_overnight_low_temperature_1d
        entity_forecast_low_temp_3: sensor.dark_sky_overnight_low_temperature_2d
        entity_forecast_low_temp_4: sensor.dark_sky_overnight_low_temperature_3d
        entity_forecast_low_temp_5: sensor.dark_sky_overnight_low_temperature_4d
        entity_humidity: sensor.dark_sky_humidity
        entity_pop: sensor.dark_sky_precip_probability
        entity_pop_1: sensor.dark_sky_precip_probability_1d
        entity_pop_2: sensor.dark_sky_precip_probability_2d
        entity_pop_3: sensor.dark_sky_precip_probability_3d
        entity_pop_4: sensor.dark_sky_precip_probability_4d
        entity_pop_5: sensor.dark_sky_precip_probability_5d
        entity_pop_intensity: sensor.dark_sky_precip_intensity
        entity_pressure: sensor.dark_sky_pressure
        entity_summary_1: sensor.dark_sky_summary_1d
        entity_summary_2: sensor.dark_sky_summary_2d
        entity_summary_3: sensor.dark_sky_summary_3d
        entity_summary_4: sensor.dark_sky_summary_4d
        entity_summary_5: sensor.dark_sky_summary_5d
        entity_sun: sun.sun
        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
        type: 'custom:dark-sky-weather-card'

I’m using this JS
https://raw.githubusercontent.com/iammexx/home-assistant-config/master/ui/darksky/dark-sky-weather-card.js

check to make sure all entities exist in states

Edit: I reread the instructions and all is well now. Noob here, that needs to RTFM!

So Chrome says this is the issue.

var daytimeHigh = this.config.alt_daytime_high ? html`<li><span class="ha-icon"><ha-icon icon="mdi:thermometer"></ha-icon></span><span id="alt-daytime-high">${this._hass.states[this.config.alt_daytime_high].state}</span></li>` : this.config.entity_daytime_high ? html`<li><span class="ha-icon"><ha-icon icon="mdi:thermometer"></ha-icon></span>${this.localeText.maxToday} <span id="daytime-high-text">${Math.round(this._hass.states[this.config.entity_daytime_high].state)}</span><span> ${this.getUOM('temperature')}</span></li>` : ``;

I believe I followed the instructions properly.

The min and max sensors require the templates:

      bom_today_max:
        entity_id:
          - sensor.bom_gosford_max_temp_c_0
          - sensor.today_temp_bom
        value_template: >
          {%- if states('sensor.bom_gosford_max_temp_c_0') == 'n/a' -%} 
            {{ state_attr('sensor.today_temp_bom', 'max_value') }}
          {% else %}
            {{ states('sensor.bom_gosford_max_temp_c_0') }}
          {% endif %}

      bom_today_min:
        entity_id:
          - sensor.bom_gosford_min_temp_c_0
          - sensor.today_temp_bom
        value_template: >
          {%- if states('sensor.bom_gosford_min_temp_c_0') == 'n/a' -%} 
            {{ state_attr('sensor.today_temp_bom', 'min_value') }}
          {% else %}
            {{ states('sensor.bom_gosford_min_temp_c_0') }}
          {% endif %}
  - platform: statistics
    name: today_temp_bom
    sampling_size: 150
    entity_id: sensor.bom_gosford_air_temp_c
    max_age:
      hours: 24

Change for your location.

The reason is once BOM has passed the min/max it shows as not available. So I use the statistics sensor to get the min/max for the day instead.

Check in states that those sensors exist otherwise you can’t parse them to the card.

Just wanted to chime in here. I had a custom element doesn’t exist error and it was because I had the wrong dark-sky-weather-card.js file. I saved the website(html file) for the link rather than the raw data. If you’re a dummy like me, go to the github link(https://github.com/iammexx/home-assistant-config/blob/652c1170bffb86c3cd431aaa7cd8ccee305237b0/ui/darksky/dark-sky-weather-card.js) and click the “Raw” button just above the code. Save this as your dark-sky-weather-card.js.

Other issues that can cause that error:

  • wrong user permissions within linux - search ‘chown’ commands.
  • wrong directory in which the dark-sky-weather-card.js file is saved. Find your config directory(where your home assistant is installed(where you configuration.yaml file is). From that directory, you add the www directory and the www/custom_ui directory. When you reference this in the raw config::: url: /local/custom_ui/dark-sky-weather-card.js?v=7.1, you actually do paste as-is(with /local/ on there) as the system will reference the www directory within your configuration directory.

Sorry for the super newbie post but I played with this for 2 hours before I checked - would like to save someone the time in the future.

1 Like

If I put this in my configuration.yaml my HA won’t connect, if I remove this works fine again, what am I doing wrong?

- platform: darksky
    api_key: <Your Dark Sky API Key>
    forecast:
      - 0
      - 1
      - 2
      - 3
      - 4
      - 5
    monitored_conditions:
      - icon
      - summary
      - nearest_storm_distance
      - nearest_storm_bearing
      - humidity
      - temperature
      - temperature_high
      - temperature_low
      - apparent_temperature
      - apparent_temperature_high
      - apparent_temperature_low
      - wind_speed
      - wind_bearing
      - precip_type
      - precip_probability
      - precip_accumulation
      - precip_intensity
      - precip_intensity_max
      - uv_index
      - daily_summary
      - pressure
      - visibility
    scan_interval:
      minutes: 5

If you have this in your configuration.yaml, this should be under sensor.

sensor:
  - platform: darksky
    api_key: !secret ds_api_key
    ...

If you already have a sensor, it should look like this.

sensor:
  - platform: whatever_you_have
    ...

  - platform: darksky
    api_key: !secret ds_api_key
    ...
1 Like

Hi

Great card! I love it! But it shows the wrong unit of the wind speed:

2020-03-25_19h44_42

Here the wind speed is 4,56 m/s.

2020-03-25_19h35_19

But the card shows 5 km/h. That’s wrong. It should be approx 16.4 km/h.

How can I fix that?

Thx

PS: locale is set to de

PPS: HASS unit system is metric

can anybody share the .js , .css, sensors.yaml, ui-lovelace.yaml code files please ?

i am running the latest ha 0.107.7 on raspberry pi.

i tried the different files posted in this thread, but can’t get any of them to work. it just shows blank screen, no errors or anything.
thanks

You are probably passing an entity through to the card that doesn’t exist. Go through the lovelace and make sure every entity exists in dev-tools

I am using dark sky platform and have all the entities defined in sensors.yaml file. What else am i missing ? I was following exact steps posted at github site.

Unfortunately I do not understand the JavaScript code. Therefore, I can’t find the problem myself. Maybe someone could help me and have a look at the script? Why does the card use the (wrong) unit km/h although the HASS unit is m/s???

The only reason the card won’t display at all is because you DON’T have every entity existing that is referenced in lovelace. If you open up the console (F12) in chrome you might see what entity is missing in there.