amaximus / garbage-collection-card

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

Missing views? #71

Closed Rincovanderbeek closed 3 years ago

Rincovanderbeek commented 3 years ago

Hi, I installed conform the manual, however it state's missing views.

Any Idea what I'm doing wrong?

configuration.yaml:

sensor:
  - platform: afvalinfo
    resources:
      - gft
      - kerstboom
      - pbd
      - papier
      - restafval
      - textiel
      - trash_type_today
      - trash_type_tomorrow
    location: epe
    postcode: 8171BC
    streetnumber: 16
    dateformat: "%A %d %B %Y"
    locale: "nl"
    timespanindays: 365

  - platform: template
    sensors:
      afvalinfo_next_trash_type_and_date:
        value_template: >
          {% set ns = namespace(minimum=365) %}
          {% set list = ['gft', 'kerstboom', 'papier', 'pbd', 'restafval','textiel'] %}
          {%- for l in list %}
          {%- set days = state_attr('sensor.afvalinfo_' ~l, 'days_until_collection_date')%}
          {%- if days != None and days < ns.minimum %}
          {%- set ns.minimum = days %}
          {%- endif %}
          {%- endfor %}
          {%- for l in list %}
          {%- set days = state_attr('sensor.afvalinfo_' ~l, 'days_until_collection_date')%}
          {%- if days == ns.minimum %}
          {{l}} · {{ states('sensor.afvalinfo_' ~l) }}
          {%- endif %}
          {%- endfor %}

ui-lovelace.yaml:

cards:
  - type: custom:garbage-collection-card
    entity: sensor.afvalinfo_next_trash_type_and_date
    icon_size: 35px
    icon_color: green
    hide_date: true
  - type: custom:garbage-collection-card
    entity: sensor.afvalinfo_next_trash_type_and_date
    hide_before: 4
    icon_color: '#0561ba'
amaximus commented 3 years ago

Hi,

please note that the card expects sensor state and attributes as per [1]. The afvalinfo platform doesn't seem to comply with that.

[1] https://github.com/bruxy70/Garbage-Collection/