custom-cards / decluttering-card

🧹 Declutter your lovelace configuration with the help of this card
MIT License
379 stars 29 forks source link

Cannot read properties issue since 2023.4.x #67

Open SupremeSports opened 1 year ago

SupremeSports commented 1 year ago

Checklist:

Release with the issue: v1.0.0 Last working release (if known):

Browser and Operating System: Chrome on Win10, HA App on iOS

Description of problem: Unable to use standard HACS ressource reference, have to manually enter it. Problem occurs since 2023.4.x (went from 2023.3.6 to 2023.4.4 and got the issue). Tested on 2 different HA systems and same thing happens.

Error message on each declut card: Cannot read properties of null (reading'config') Error message

Into resource.yaml: Normal reference:

  - url: /hacsfiles/decluttering-card/decluttering-card.js
    type: module

Modified reference:

  - url: /local/community/decluttering-card/decluttering-card.js
    type: module
electricJP commented 1 year ago

I have the same issue but I already use the modified reference

lovelace: mode: yaml resources:

brainpt commented 1 year ago

I have the same issue but I already use the modified reference

lovelace: mode: yaml resources: - url: /hacsfiles/lovelace-hui-element/hui-element.js type: module - url: /local/community/decluttering-card/decluttering-card.js type: module - url: /local/community/button-card/button-card.js type: module - url: /local/community/apexcharts-card/apexcharts-card.js type: module - url: /local/community/bar-card/bar-card.js type: module

I'm also facing the same issue, running the latest decluttering version (and already had the modified reference) and with HA 2023.4.6 version.

Cannont read properties of null (reading 'config')

rcdailey commented 1 year ago

I'm having this issue as well. What do you guys mean by "modified reference"? Is that referring to the /hacsfiles URL paths in the resources.yaml file?

luixal commented 1 year ago

Same problem on a fresh install using HACS.

brainpt commented 1 year ago

I'm having this issue as well. What do you guys mean by "modified reference"? Is that referring to the /hacsfiles URL paths in the resources.yaml file?

Yes. That's it.

rcdailey commented 1 year ago

Can you point me to where that change is documented? I haven't touched my URL paths in a LONG time and I'm unaware of any deprecations or the like.

RandyLevensalor commented 1 year ago

I ended up uninstalling decluttering-card from HACS, then reinstalling it.

I changed the resource import from:

    - url: /local/community/decluttering-card/decluttering-card.js
      type: module

to:

    - url: /hacsfiles/decluttering-card/decluttering-card.js
      type: module

It's now working. I'm not entirely sure why. I had tried the hacsfiles url before reinstalling and didn't work. This last update up home assistant had all kinds of issess, many of which required extra restarts.

Nerkyator commented 1 year ago

I have same problem. Changing resource import doesn't fix :(

HA version: 2023.10.1 Decluttering card version: last Installation method: HACS Dashboard: storage Decluttering card added in resources through "three dots method" from UI

Just created decluttering_templates.yaml file with

decluttering_templates:
  cameras:
    card:
      camera_view: live
      type: picture-glance
      title: "[[title]]"
      entities: []
      camera_image: "[[camera]]"
      theme: Mushroom Shadow
      view_layout:
        grid-area: "[[gridArea]]"

Dashboard page yaml file:

decluttering_templates: !include ../common/decluttering_templates.yaml

type: custom:layout-card
layout_type: custom:grid-layout
view_layout:
  grid-area: content
layout:
  margin: 0px 0px 0px 0px
  card_margin: 0px 0px 0px 0px
  grid-template-columns: auto
  grid-template-rows: auto
  grid-template-areas: |
    "road terrace"
    "porch ."
cards:
  - type: custom:decluttering-card
    template: cameras
    variables:
      - title: Road
      - camera: camera.g4_dome_high
      - gridArea: road

Opening dashboard I have the well known error:

Cannot read properties of undefined (reading 'cameras')
type: custom:decluttering-card
template: cameras
variables:
  - title: Road
  - camera: camera.g4_dome_high
  - gridArea: road
danielbrunt57 commented 9 months ago

I've just implemented this card for the first time and I had zero issues, once I wrapped my head around how it works.

Installed card via HACS. image

Verified resource added. image

Added decluttering template to lovelace dashboard via raw config editor. image

Edited my existing 6 cards to use the decluttering card.

type: vertical-stack
cards:
  - type: custom:mushroom-title-card
    title: ''
    subtitle: Kitchen
    alignment: center
  - type: horizontal-stack
    cards:
      - type: custom:decluttering-card
        template: iblinds
        variables:
          - blind: kitchen_blind_1
          - display_name: Blind 1
      - type: custom:decluttering-card
        template: iblinds
        variables:
          - blind: kitchen_blind_2
          - display_name: Blind 2
      - type: custom:decluttering-card
        template: iblinds
        variables:
          - blind: kitchen_blind_3
          - display_name: Blind 3
view_layout:
  column: 1

image

type: custom:mod-card
card_mod:
  style:
    hui-horizontal-stack-card $: |
      div#root > :first-child {
        width: 66%;
        flex: auto; 
      }
      div#root > :last-child {
        width: 33%;
        flex: auto; 
      }
card:
  type: horizontal-stack
  cards:
    - type: vertical-stack
      cards:
        - type: vertical-stack
          cards:
            - type: custom:mushroom-title-card
              title: ''
              subtitle: Living Room
              alignment: center
            - type: horizontal-stack
              cards:
                - type: custom:decluttering-card
                  template: iblinds
                  variables:
                    - blind: living_room_blind
                    - display_name: Window
                - type: custom:decluttering-card
                  template: iblinds
                  variables:
                    - blind: patio_door_blind
                    - display_name: Patio Door
    - type: vertical-stack
      cards:
        - type: custom:mushroom-title-card
          title: ''
          subtitle: Master Bedroom
          alignment: center
        - type: horizontal-stack
          cards:
            - type: custom:decluttering-card
              template: iblinds
              variables:
                - blind: bedroom_blind
                - display_name: Window
view_layout:
  column: 1

image