custom-cards / flex-table-card

Highly Flexible Lovelace Card - arbitrary contents/columns/rows, regex matched, perfect to show appdaemon created content and anything breaking out of the entity_id + attributes concept
GNU General Public License v3.0
208 stars 26 forks source link

When referenced entity attributes doesn't exist, lovelace tab and other cards don't load #24

Closed timdonovanuk closed 4 years ago

timdonovanuk commented 4 years ago

In my config I have:

          - cards: null
            columns:
              - align: center
                attr_as_list: next_trains
                modify: x.scheduled
                name: Train Time
              - align: center
                attr_as_list: next_trains
                modify: x.estimated
                name: Est
              - align: center
                attr_as_list: next_trains
                name: Status
                prefix: '<style> cc { color: red; } </style>'
              - align: center
                attr_as_list: next_trains
                name: Delay
                suffix: m
            entities:
              include: sensor.next_train_to_xyz
            icon: 'mdi:train'
            style: |
              ha-card {
                background: #5C4432;
                border-radius: 5px;
              }
            type: 'custom:flex-table-card'

If there are no trains (due to it being late or engineering works that day), the attribute sensor.next_train_to_xyz.next_trains[] does not exist - this stops that entire lovelace tab from loading (i.e. no other cards load on that tab).

daringer commented 4 years ago

oopsy, this is an evil one, also specific to attr_as_list, pushing one-liner for the rescue...

daringer commented 4 years ago

would be great if you could confirm that it's working for you...

timdonovanuk commented 4 years ago

Fix confirmed! Thank you so much, that's amazing :)