maxwroc / battery-state-card

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

Excessive Console Warn Messages / Exclude not being pre-processed #714

Open versile2 opened 5 months ago

versile2 commented 5 months ago

Describe the bug I use two battery-state-cards in my dashboard because they are amazing, however I've been having issues, especially on mobile devices with bloat. Looking at the console logs over a 5 minute period I received nearly a thousand "warn" messages from this card. I do not have anything specifying "state_map" for "unavailable" yet the message is [battery-state-card] Missing option for 'unavailable' in 'state_map.' See screenshot as well.

How to reproduce have the browser_mod installed, use the following or something similar, any time a browser_mod entity goes "Unavailable" it doesn't matter what you do these "warnings" pop up. You can get rid of the entities showing by using the below but the warnings still continue. So the exclude is just excluding them from view not the processing part of the card. (Should be considered a bug in itself) ` exclude:

Expected behavior Exclude should happen before card processing and after include/entities. And entities that report 'unavailable' should not be included.

YAML configuration


type: custom:battery-state-card
title: Motion Activated
secondary_info: '{last_changed}'
icon: '{state|equals(off,mdi:motion-sensor-off)|equals(on,mdi:motion-sensor)}'
filter:
  include:
    - name: attributes.device_class
      value: motion
  exclude:
    - name: attributes.type
      value: browser_mod
state_map:
  - from: 'off'
    to: 0
    display: Clear
  - from: 'on'
    to: 100
    display: Motion
bulk_rename:
  - from: Motion
  - from: Sensor
  - from: Front Ring Camera
    to: Front Yard
  - from: Garage Ring Camera
    to: Driveway
  - from: Camper Doorbell Camera
    to: Alleyway
  - from: Front Doorbell Camera
    to: Front Door
sort:
  - by: state
    desc: true
  - by: entity.last_changed
    desc: true
colors:
  steps:
    - color: blue
      value: 0
    - color: '#ff0000'
      value: 100
unit: null
collapse: 4

Entity debug data

{
  "entity_id": "binary_sensor.115f0402_511034cb",
  "state": "unavailable",
  "attributes": {
    "restored": true,
    "device_class": "motion",
    "supported_features": 0
  },
  "context": {
    "id": "01HSE4KM07F122Y39HZ5C20RVE",
    "parent_id": null,
    "user_id": null
  },
  "last_changed": "2024-03-20T14:35:25.063Z",
  "last_updated": "2024-03-20T14:35:25.063Z",
  "display": {
    "entity_id": "binary_sensor.115f0402_511034cb",
    "device_id": "88def7cc15cb9158c25796e5b6d31966",
    "platform": "browser_mod",
    "name": null
  },
  "device": {
    "area_id": null,
    "configuration_url": null,
    "config_entries": [
      "4825c5d2ef6b33e9e0d0637f5f525525"
    ],
    "connections": [],
    "disabled_by": null,
    "entry_type": null,
    "hw_version": null,
    "id": "88def7cc15cb9158c25796e5b6d31966",
    "identifiers": [
      [
        "browser_mod",
        "115f0402-511034cb"
      ]
    ],
    "manufacturer": "Browser Mod",
    "model": null,
    "name_by_user": null,
    "name": "115f0402-511034cb",
    "serial_number": null,
    "sw_version": null,
    "via_device_id": null
  }
}

Dev console errors See screenshot and description

Screenshots Screenshot 2024-03-20 100341 Screenshot 2024-03-20 103203

Version 3.2.1