iammexx / home-assistant-config

Files for my Home Assistant setup
75 stars 77 forks source link

Uncaught (in promise) TypeError:Cannot read property 'state' of undefined #26

Closed psykro closed 5 years ago

psykro commented 5 years ago

Hello there,

I'm trying to configure this awesome looking card however i'm facing an issue :(

Here is what i get in the console:

dark-sky-weather-card.js?v=7.1:61 Uncaught (in promise) TypeError: Cannot read property 'state' of undefined at dark-sky-weather-card.js?v=7.1:61 at Array.map () at HTMLElement.render (dark-sky-weather-card.js?v=7.1:55) at HTMLElement.update (app.7bd99ba1.js:formatted:1367) at HTMLElement.performUpdate (app.7bd99ba1.js:formatted:1188) at HTMLElement._enqueueUpdate (app.7bd99ba1.js:formatted:1167)

I tried to figure out what was the issue but could not fix it I followed the installation instructions from the readme (except that i installed under custom-lovelace and not custom_ui, as i already have custom components there)

The sensors entities are correctly defined and report good values and i put the same lovelace configuration (required parametrs) as defined in the README

  - type: 'custom:dark-sky-weather-card'
    entity_current_conditions: sensor.dark_sky_icon
    entity_temperature: sensor.dark_sky_temperature
    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_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

Please help :)

psykro commented 5 years ago

Fixed it myself, seems to work now !

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

For any reason my sensor start at 1d and not 0d, i just changed the name to 1d, 2d, 3d...

psykro commented 5 years ago

Actually my own fault, i did not add 0 in the forecast for the dark sky component ...