maxwroc / battery-state-card

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

Can't get battery charging state to work. #732

Open RedNo7 opened 1 month ago

RedNo7 commented 1 month ago

Describe the bug I have a bunch of Aqara shades with the following (type) of entities: sensor.bedroom_shade_battery

How to reproduce From my yaml below I am trying to list them all and also show the charging status but I cannot get it to work.

Expected behavior I'm expecting to see a status per the docs, with a 'flas' icon when charging

YAML configuration

  - type: custom:battery-state-card
    title: 'Shades'
    default_state_formatting: false
    sort:
      by: "state"
    collapse:
      - name: 'x{count} at {min}% min'
        min: 70
    colors:
      steps:
        - "#ff0000" # red
        - "#ffff00" # yellow
        - "#00ff00" # green
      gradient: true
    bulk_rename:  # note: "to" is not required if you want to remove string
      - from: " Battery"
      - from: " shade"
    filter:
      include:
        - name: entity_id
          value: "sensor.*_shade*battery"
    #secondary_info: "{charging}"
    charging_state:
      attribute:
        name: "charging_status"
        value: "true"
      icon: "mdi:flash"

Entity debug data

{
  "entity_id": "sensor.bedroom_shade_battery",
  "state": "73",
  "attributes": {
    "state_class": "measurement",
    "battery": 73,
    "charging_status": true,
    "device_temperature": 33,
    "linkquality": 61,
    "motor_speed": "high",
    "motor_state": "stopped",
    "position": 100,
    "power_outage_count": 444,
    "running": false,
    "update": {
      "installed_version": 3870,
      "latest_version": 3870,
      "state": "idle"
    },
    "update_available": null,
    "unit_of_measurement": "%",
    "device_class": "battery",
    "friendly_name": "Bedroom shade Battery"
  },
  "context": {
    "id": "01J41SYKYGBGAQ8WRWN5R6FRBA",
    "parent_id": null,
    "user_id": null
  },
  "last_changed": "2024-07-30T12:30:58.000Z",
  "last_updated": "2024-07-30T12:30:58.000Z",
  "display": {
    "entity_id": "sensor.bedroom_shade_battery",
    "device_id": "74ed47147bdd8948e7b4b47ee32cf9b6",
    "labels": [],
    "platform": "mqtt",
    "entity_category": "diagnostic",
    "name": "Battery"
  },
  "device": {
    "area_id": null,
    "configuration_url": null,
    "config_entries": [
      "9eb50c5fe32b415269c3e42d545b4457"
    ],
    "connections": [],
    "disabled_by": null,
    "entry_type": null,
    "hw_version": null,
    "id": "74ed47147bdd8948e7b4b47ee32cf9b6",
    "identifiers": [
      [
        "mqtt",
        "zigbee2mqtt_0x54ef44100078540c"
      ]
    ],
    "labels": [],
    "manufacturer": "Aqara",
    "model": "Roller shade driver E1 (ZNJLBL01LM)",
    "name_by_user": null,
    "name": "Bedroom shade",
    "primary_config_entry": "9eb50c5fe32b415269c3e42d545b4457",
    "serial_number": null,
    "sw_version": null,
    "via_device_id": "0817c962606c5d5a58693d97498a36c1"
  }
}

Dev console errors No batter-state-card errors Screenshots Screenshot 2024-07-30 at 13 27 00 Screenshot 2024-07-30 at 13 26 50

Version