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
198 stars 23 forks source link

Include / Exclude by properties #34

Closed yolani closed 3 years ago

yolani commented 4 years ago

I am not sure if it can be done, at least i did not find it in the documentation.

I would like to create auto entities based on an attribute, for example all battery powered devices below 20% capacity, so something like

entities: include: '*.batterly_level' condition: state < 20

Is that possible or maybe planned?

daringer commented 3 years ago

you can easily use modify to also exclude entries by simply returning null the row will not be shown if you have strict: true set. Just tried it out for my battery-table, works good, have to admit that this is not very fancy, but works:

clickable: true
columns:
  - align: center
    data: node_id
    icon: 'mdi:z-wave'
    name: NodeID
  - data: name
    name: Name
  - align: right
    data: battery_level
    icon: 'mdi:battery'
    name: Battery Level
    modify: (parseInt(x)<85 && x) || null
    suffix: ' %'
entities:
  exclude:
    - unknown_device
  include: zwave.*
sort_by: battery_level+
strict: true
title: Battery Levels
type: 'custom:flex-table-card'

This works as expected for me: showing only devices with a battery level below 85

daringer commented 3 years ago

looks fixed for me, feel free to re-open, if there are still open questions/issues....