Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow template when excluding based on state value #645

Open
MrAdam opened this issue Jan 10, 2024 · 1 comment
Open

Allow template when excluding based on state value #645

MrAdam opened this issue Jan 10, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@MrAdam
Copy link

MrAdam commented Jan 10, 2024

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 MrAdam added the enhancement New feature or request label Jan 10, 2024
@maxwroc
Copy link
Owner

maxwroc commented Jan 12, 2024

Interesting idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants