battery-state-card icon indicating copy to clipboard operation
battery-state-card copied to clipboard

Allow template when excluding based on state value

Open MrAdam opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. I'm trying to get the battery card to show up conditionally based on a sensor which triggers when a device has a battery level below a certain threshold, which works fine. However, I haven't been able to figure out how to exclude devices in the shown card based on a sensor value from another entity.

type: conditional
conditions:
  - condition: state
    entity: binary_sensor.low_battery
    state: 'on'
card:
  type: custom:battery-state-card
  title: Battery Levels
  secondary_info: '{last_changed}'
  filter:
    include:
      - name: entity_id
        value: '*_battery_level'
      - name: attributes.device_class
        value: battery
    exclude:
      - name: state
        value: '{input_number.low_battery_threshold}' <--- This doesn't work
        operator: '>'
      - name: entity_id
        value: binary_sensor.low_battery
  sort:
    by: state
  bulk_rename:
    - from: ' Battery'
    - from: ' level'
  colors:
    steps:
      - '#ff0000'
      - '#ffff00'
      - '#00ff00'
    gradient: true

Describe the solution you'd like I'd like it to be possible to use templating for the value of a filter (if it's not already possible in another way than what I'm trying)

MrAdam avatar Jan 10 '24 18:01 MrAdam

Interesting idea

maxwroc avatar Jan 12 '24 16:01 maxwroc