Skip to content

Error when loading dashboard #1629

@RuldBaz

Description

@RuldBaz

Describe the bug
It doesnt load properly

To Reproduce
Steps to reproduce the behavior:

Sometimes when loading the dashboard it appear after 2/3 refreshes it dissapear

Screenshots

Image

Additional context
Add any other context about the problem here.

Related Logs (can be found in the browser-console (F12))

ButtonCardJSTemplateError: TypeError:
Cannot read properties of undefined
(reading state) in 'const event = new
Date; const options = (month: 'short,
day: 'numeric' ); var locale = vari..:

Related Card Config
Add the card config from ui-lovelace.yaml with the related problem

tap_action:
  action: more-info
type: custom:button-card
group_expand: false
hold_action:
  action: none
double_tap_action:
  action: none
layout: vertical
size: 80%
color_type: icon
show_name: false
show_state: false
show_icon: false
show_units: true
show_label: true
show_entity_picture: false
show_live_stream: false
card_size: 3
styles:
  label:
    - justify-self: center
    - padding: 0px 6px
    - font-weight: bold
    - font-size: 14px
    - line-height: 100%
  img_cell:
    - width: 24px
  grid:
    - grid-template-areas: '''l'''
  card:
    - border-radius: 18px
    - box-shadow: |
        [[[
          if (hass.themes.darkMode){
            return "0px 2px 4px 0px rgba(0,0,0,0.80)";
          } else {
            return "var(--box-shadow)";
          }
        ]]]
    - height: 36px
    - width: auto
    - padding-left: 6px
    - padding-right: 6px
    - width: 100px
    - box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.80)
    - '--mdc-ripple-press-opacity': 0.12
template: chip_weather_date
entity: weather.openweathermap
variables:
  ulm_language: |
    [[[
      return hass["language"];
    ]]]
  ulm_weather: weather.openweathermap
triggers_update:
  - '[[[ return variables.ulm_weather ]]]'
label: |
  [[[
    const event = new Date();
    const options = {month: 'short', day: 'numeric' };
    var locale = variables.ulm_language;
    let formatted_date = event.toLocaleDateString(locale, options);
    var state = states[variables.ulm_weather].state;
    var icon = {
      "clear-night": "🌙",
      "cloudy": "☁️",
      "exceptional": "🌞",
      "fog": "🌫️",
      "hail": "⛈️",
      "lightning": "⚡",
      "lightning-rainy": "⛈️",
      "partlycloudy": "⛅",
      "pouring": "🌧️",
      "rainy": "💧",
      "snowy": "❄️",
      "snowy-rainy": "🌨️",
      "sunny": "☀️",
      "windy": "🌪️",
      "default": "🌡️"
      }
    return (icon[state] || icon["default"]) + ' ' + formatted_date
  ]]]
state: []
lock:
  enabled: false
  duration: 5
  unlock: tap

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions