thomasloven / lovelace-auto-entities

🔹Automatically populate the entities-list of lovelace cards
MIT License
1.19k stars 111 forks source link

Cannot exclude MacBook model from list of batteries #375

Open stevegroom opened 11 months ago

stevegroom commented 11 months ago

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

ildar170975 commented 11 months ago

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.

stevegroom commented 11 months ago

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

ildar170975 commented 11 months ago

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
PeterSR commented 10 months ago

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

filter:
  include:
    - attributes:
        device_class: battery