amaximus / garbage-collection-card

Custom Lovelace card for Garbage Collection custom component
MIT License
128 stars 24 forks source link

No card type found #30

Closed leopold005 closed 4 years ago

leopold005 commented 4 years ago

I'm trying to set up this card and I seem to be hitting a brick wall... I installed the card via HACS and it seems to be all present and correct, but when I start putting in the YAML code for the card, I get a message saying "No card type found" and a further one in orange saying, "Cannot read property 'setConfig' of undefined"

This is the code (after saving) that I have added to Lovelace to configure the card:

cards:
  - entity: sensor.blue_bin
    hide_date: false
    icon_color: blue
    icon_size: 35px
    type: 'custom:garbage-collection-card'
resources:
  - type: js
    url: /community_plugin/garbage-collection-card/garbage-collection-card.js

I have a sensor called Blue Bin, which I configured using the Garbage Collection integration.

amaximus commented 4 years ago

The rendering of your quote/preformatted part is a bit misleading, You should define in your configuration.yaml:

resources:
    - {type: js, url: '/local/community/garbage-collection-card/garbage-collection-card.js'}

while in the ui-lovelace.yaml:

card:
  - type: 'custom:garbage-collection-card'
    entity: sensor.blue_bin
    hide_date: false
    icon_color: blue
    icon_size: 35px

If your configuration.yaml was not needed to be edited, you may just reload your Lovelace UI in the browser (sometimes a cache flush is also needed).

leopold005 commented 4 years ago

Yeah, I hadn't reckoned on the post being reformatted with bullets. How annoying!

Anyway, thanks for the help, I got it working now!

Liese2007 commented 4 years ago

Hi, I have exactly the same problem....seems so. The plug-in is installed. My installation folder is: \config\www\community\garbage-collection-card I added

resources:
  - type: js
    url: /local/community/garbage-collection-card/garbage-collection-card.js

and as well

resources:
    - {type: js, url: '/local/community/garbage-collection-card/garbage-collection-card.js'}

but both return following on the frontend:

No card type configured.
card:
  - type: 'custom:garbage-collection-card'
    entity: sensor.stadtreinigung_hamburg_xxxx_blaue_papiertonne
    hide_date: false
    icon_color: blue
    icon_size: 35px

The file garbage-collection-card.js is present in that folder.

Any idea, what to check next?

amaximus commented 4 years ago

@Liese2007 , since your HASS is presumly running on Windows, you might need to use Windows-style path for the resource. Please also make sure you clear the browser cache and reload from server (shift-reload).

Liese2007 commented 4 years ago

Sorry, I copied the path via Samba access. My HASS is running on a Rasperry Pi with a Hassio image. Both upper examples should work, if the path itself is ok?

amaximus commented 4 years ago

Running on RPi the paths above should be fine. Please make sure you clear the browser cache and reload from server. Was a fresh new install of the custom card or it worked before?

Liese2007 commented 4 years ago

My Lovelace looks like this:

resources:
  - type: js
    url: /local/community/garbage-collection-card/garbage-collection-card.js
title: UnserHaus
views:
  - badges: []
    cards:
      - entity: binary_sensor.workday_sensor
...... etcpp....

Still error with this code: (the sensor state is a valid date - checked in Developer Tools)

card:
  - type: 'custom:garbage-collection-card'
    entity: sensor.stadtreinigung_hamburg_xxx_gelbe_wertstofftonne_sack
    hide_date: false
    icon_color: blue
    icon_size: 35px

When I want to leave the Manual Card in Lovelace, the error Cannot read property 'setConfig' of undefined is shown. But the setup can be saved.

Any more ideas what is wrong? Greetz Jörg

amaximus commented 4 years ago

Was the card installed via HACS? Looking in a terminal is the $configdir/www/community/garbage-collection-card/garbage-collection-card.js accessible? Is the garbage-collection-card set into a conditional card? (thus that's why the card: instead of cards: ) If not, then the syntax should be something similar to:

cards:
      - type: custom:garbage-collection-card
        entity: sensor.test_garbage_every4w
        icon_color: green
        icon_size: 35px
        hide_date: true
        details_size: 8px
Liese2007 commented 4 years ago

Sorry I am not a command line master... I am in Terminal & SSH add-on, what do I have to enter to check if the path is available? $configdir /www/community/garbage-collection-card/garbage-collection-card.js doesn't work

The Card is created lovelace UI 'Manual Card'.

amaximus commented 4 years ago

The $configdir would have been referred to the configuration directory of your HomeAssistant. It's just a way of refering to it, not a real variable. Anyway, since you are using the UI, I guess the path in your resource should be /hacsfiles/garbage-collection-card/garbage-collection-card.js. This has changed in 0.107.0 (for UI based). yaml based was not affected. Please see: https://community.home-assistant.io/t/0-107-warning-about-community-plugin/179511

Liese2007 commented 4 years ago

OK, finally I did it. I changed in my profile to 'Advanced Option' for the Settings --> Lovelace Dashboard. After that you will see at Lovelace Dashborad the Option to add Resources. I didn't add any resource line via Lovelace UI (Raw Config).

In addition the basic code to be filled in 'Manual Card' via Lovelace UI looks like:

type: 'custom:garbage-collection-card'
entity: sensor.stadtreinigung_hamburg_xxxx_gelbe_wertstofftonne_sack
icon_size: 35px
icon_color: green
hide_date: true

The style might have changed in the last HA updates for handling the Lovelace UI. Thanks for the Card :-)

PS: The resource link /hacsfiles/garbage-collection-card/garbage-collection-card.js I installed via HACS

amaximus commented 4 years ago

Great. I'm not using the UI for editing, so I'm not familar with how things work in that scenario.