custom-cards / button-card

❇️ Lovelace button-card for home assistant
MIT License
1.93k stars 233 forks source link

still broken for me - cannot read properties of null (reading 'config') #679

Closed loki-sft closed 1 year ago

loki-sft commented 1 year ago

Checklist

Describe the bug After updating HA and button card to latest version its still broken still broken for me - cannot read properties of null (reading 'config')

Version of the card Version: 3.5.0

To Reproduce This is the configuration I used:

    - type: custom:button-card
      entity: light.wohn_deckenlampe
      style:
        z-index: 100
        left: 57%
        top: 53%
      template:
        - light_white

in template:

  light_white:
    template:
      - icon_main
      - circle
    show_state: false
    show_icon: true
    show_name: false
    show_label: true
    size: 70%
    color_type: icon
    color: rgb(255, 159, 0)
    color_off: rgb(255, 255, 255)
    tap_action:
      action: toggle
      haptic: light
    label: >
      [[[ return Math.round(entity.attributes.brightness / 2.54); ]]]
    styles:
      card:
        - width: 3.5vw
        - height: 3.5vw
        - borderRadius: 15vw
        - background-color: >
            [[[ return (entity.state === 'on' || entity.state === 'home') ? 'rgba(255, 255, 255, 1.0)' : 'rgba(115, 115, 115, 0.6)'; ]]]
      label:
        - color: gray
        - font-size: 9px
    variables:
      circle_input: >
        [[[ return Math.round(entity.attributes.brightness / 2.54); ]]]
    hold_action:
      action: fire-dom-event
      browser_mod:
        service: browser_mod.popup
        data:
          style:
            $: |
              s.popup-inner{
                padding: 15px 0 30px 0;
              }
              .mdc-dialog .mdc-dialog__container {
              }
              .mdc-dialog .mdc-dialog__container .mdc-dialog__surface {
                border-radius: 2vw;
              }
              ha-svg-icon {
                margin-top:-7px;
              }
            .: |
              :host {
                --mdc-dialog-scrim-color: rgba(0,0,0,0.5);
              }
              mwc-icon-button {
                color: #FFF;
              }
          title: >
            [[[ return entity.attributes.friendly_name ]]]
          content:
            type: entities
            entities:
              - type: custom:light-popup-card
                entity: >
                  [[[ return entity.entity_id ]]]
                icon: none
                hideIcon: true
                fullscreen: false
                brightnessWidth: 10vw
                brightnessHeight: 35vh
                switchWidth: 10vw
                switchHeight: 35vh
                borderRadius: 1.7em
                sliderColor: '#c7c7c7'
                sliderTrackColor: rgba(25, 25, 25, 0.9)

Expected behavior no error message, display the card

Desktop (please complete the following information):

Mariusthvdb commented 1 year ago

please dont open issues for the same issues (that have already been fixed...) you need to take care your browser resets cache, and actually uses the new Card. This is described all over the Community and in this Repo, and is generic for all custom cards

Mariusthvdb commented 1 year ago

No. There is not a single issue using templates. Must be you don't have 3.5 loaded correctly. Force your browser to use the correct new resource. A simple cache reload is not what establishes that.

foobarth commented 1 year ago

As @Mariusthvdb said, you have to trick your browser into reloading the resource:

For me button cards are working fine again on HA 2023.4.2

keesvanbemmel commented 1 year ago

Just adding my two cents: clearing the entire application storage in Chrome did not resolve the error for me. The addition of a cache breaker ?v=3.5.0 worked.

loki-sft commented 1 year ago

I can confirm, clearing the browser cache AND adding the cache breaker worked for me too.

r4f4w commented 1 year ago

I can confirm, clearing the browser cache AND adding the cache breaker worked for me too.

Yep, same here. Only adding the cache breaker or only clearing the browser cache didn't work. Just make sure that you add the cache breaker and then clear the browser cache

r0m1CH commented 1 year ago

How do you achieve the cache breaker ? I can't find a way to make it works.

r0m1CH commented 1 year ago

I find a way but no sure this is the right way to do it. I force a new generation of the gz file in the www/community/button-card/