lovelace-auto-entities icon indicating copy to clipboard operation
lovelace-auto-entities copied to clipboard

Cannot exclude MacBook model from list of batteries

Open stevegroom opened this issue 1 year ago • 4 comments

Setting up a card to show all batteries, I exclude some device models that I do not want to see, but cannot set a generic rule to exclude MacBook running the HomeAssistant app.

type: custom:auto-entities
card:
  type: entities
  title: Batteries
  state_color: true
filter:
  exclude:
    - device_model: ZBMINIL2
    - device_model: Smart-UPS_1000
    - device_model: '*iPad*'
    - device_model: '*iPhone*'
    - entity_id: sensor.macbook_pro_steve_internal_battery_level
    - entity_id: sensor.macbook_pro_steve_internal_battery_state
  include:
    - entity_id: sensor.*battery*
sort:
  method: state
  reverse: false
  numeric: true

In the filter exclude section I tried to exclude device_model: Mac14,10 and 'Mac' etc, but did not succeed in suppressing entities of my MacBook Pro from the results. In the end I had to explicitly exclude by entity_id

stevegroom avatar Aug 02 '23 10:08 stevegroom

Are other devices properly excluded? if yes - then probably this is not an issue for auto-entities card, this an incorrect device_model. Or maybe these Mac entities are just not associated to a device.

ildar170975 avatar Aug 02 '23 10:08 ildar170975

The model was auto detected when I installed the HomeAssistant app on the MacBook Pro. I was wondering if the issue could be related to the model name with a comma ',' in it: Mac14,10

stevegroom avatar Aug 02 '23 12:08 stevegroom

Check here: изображение core.device_registry: изображение So, both ways (using "*" and exact name with a comma) work.

For simplicity - try this code:

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - device_model: DEV_NAME_OF_MAC

ildar170975 avatar Aug 02 '23 21:08 ildar170975

Don't know the solution to the problem at hand, but may I suggest to use this filter:

filter:
  include:
    - attributes:
        device_class: battery

PeterSR avatar Sep 02 '23 07:09 PeterSR