battery-state-card: Card not shown at all after updating to 3.1.0

Describe the bug

After updating from 3.0.1 to 3.1.0, the card is not shown at all.

How to reproduce Update from 3.0.1 to 3.1.0.

Expected behavior Card is shown as there are no breaking changes listed at https://github.com/maxwroc/battery-state-card/releases/tag/v3.1.0

YAML configuration Just one example

- type: custom:battery-state-card
    entities:
      - entity: group.batterystate_devices
    title: šŸ“± GerƤte
    secondary_info: '{last_updated}'
    tap_action: more-info
    sort:
      by: state
      desc: false
    collapse: 12
    filter: 0
    round: 0
    unit: '%'
    colors: null
    bulk_rename:
      - from: ' Battery Level'
        to: ''
      - from: ' Battery level'
        to: ''
      - from: ' Akkufüllstand'
        to: ''
      - from: ' Batterieladung'
        to: ''
      - from: ' Batteriestand'
        to: ''

Screenshots Just imagine a white/empty space here…

Version Battery State Card: 3.1.0 HA: 2023.4.6

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 35 (13 by maintainers)

Most upvoted comments

Thanks! Unfortunately Mon will be the earliest I’ll be able to look into it. The only advice I can give now is to downgrade, sorry for the inconvenience

This gives me enough info. Now I have realized that you have a pretty old HA instance and the status formatting function doesn’t exist in it

The below setting at the card/entity level should help

default_state_formatting: false

Hi @maxwroc just tried 3.1.5 and it works fine - well done šŸ‘ Thank you

Did some more digging and went into the Chrome settings and went to ā€œPrivacy and securityā€ and clicked ā€œClear browsing dataā€ then checked ā€œCookies and other site dataā€ and ā€œCached images and filesā€ and cleared those for ā€œAll timeā€ and restarted Chrome. I had to sign back into HA but the card started working.

Just wanted to chime in… Chrome 120.0.6099.129 on Linux does not display the card but the card does display correctly in Firefox 121.0.1 on Linux and on the Home Assistant Companion app on Android. At least that’s what’s happening for me.

Please note: tested https://github.com/maxwroc/battery-state-card/releases/tag/v3.1.3, no change (cards still not shown at all).

Upgraded to 3.1.2 but the problem is still there. As mentioned in https://github.com/maxwroc/battery-state-card/issues/630 removing the sort section fixes the display issue, i.e. entities are visible, however they are not sorted. 3.1.0 still works as expected.

Yes, solved this as well for me. My pretty simple config was:

type: custom:battery-state-card
title: Filters
sort_by_level: asc
entities: null
state_map:
  - from: 'off'
    to: OK
filter:
  include:
    - name: entity_id
      value: '*_batter*'

I had to remove the entities: null line. Not sure by what this line was introduced. Only changes recently where clicking through the updates of HA and addons.

Thank you so much for such detailed testing and info. I’ll try to figure out something from it in the next couple of days (although I’ll be traveling and I don’t know how much time I’ll be able to spend on it).

What I can recommend at the moment only is to downgrade to 3.0.X šŸ˜ž

Well I did so and built from

type: custom:battery-state-card
entities:
 - sensor.your_battery_entity_which_worked_before

to

  - type: custom:battery-state-card
    entities:
     - sensor.non-existing-entity
    title: '*** Test BSC v3.1.0 ***'
    secondary_info: '{last_updated}'
    tap_action: more-info
    sort:
      by: state
      desc: false
    collapse: 12
    filter: 0
    round: 0
    unit: '%'
    colors: null
    bulk_rename:
      - from: ' Battery Level'
        to: ''
      - from: ' Battery level'
        to: ''
      - from: ' Akkufüllstand'
        to: ''
      - from: ' Batterieladung'
        to: ''
      - from: ' Batteriestand'
        to: ''

What I discovered in 1/2 an hour of further testing:

  • even the minimal (basic) version fails to render completely, ONCE an actually existing entity is referenced
  • as long as a non-existing one is given, the card seems to render just fine: grafik
  • update:
  - type: custom:battery-state-card
    entities:
     - sensor.non-existing-entity
     - sensor.home_assistant_core_cpu_percent
     #- sensor.iphone_battery_level

renders fine too: grafik

  • but using my group.batterystate_devices as entity does not. So does when using one random entity of that group like sensor.iphone_battery_level, which gives <nothing> again
  • I compared the working entity sensor.home_assistant_core_cpu_percent to (one of) the non-working sensor.iphone_battery_level: grafik grafik So in this comparison the only difference are device_class and state_class

So it seems like if there’s only one single ā€œwrongā€ entity, v3.1.0 is refusing to render the whole card. Just a wild theory.

Really not sure if you can make something out of this. Trying with many different entities is likely a good approach to find a pattern. As I’m not used to the dev-tools power of my browser I’d need to have an exact how-to if you want me to test something (using Firefox). By the way of course I tested it with other browsers too: the HA Companion app (iOS) also shows not a single card anymore with 3.1.0. I’ll downgrade for now…