maxwroc / battery-state-card

Battery state card for Home Assistant
MIT License
898 stars 38 forks source link

Only keep "Unavailable" sensors #721

Open dergreg opened 7 months ago

dergreg commented 7 months ago

Is there a way to only keep battery sensors with state "Unavailable"?

I have quite a few sensors, some of them rarely used where the battery is already discharged. I want to have separate views for the regular devices which have battery state >= 0% and the ones with state "Undefined".

Since the filter is only applied using OR condition, this will not work.

Any ideas?

YAML configuration

  include:
    - name: attributes.device_class
      value: battery
  include:
    - name: state
      value: Unavailable

Version 3.2.1

doppynl commented 3 months ago

I use the following:

  exclude:
    - name: state
      value: /[0-9]/
      operator: matches

which just filters out all that have a numerical value.

Although that doesn't show devices that have an empty battery, don't respond anymore and aren't marked as unavailable.