Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Card not shown at all after updating to 3.1.0 #623

Closed
bcutter opened this issue Dec 30, 2023 · 35 comments
Closed

Card not shown at all after updating to 3.1.0 #623

bcutter opened this issue Dec 30, 2023 · 35 comments
Labels
bug Something isn't working details needed Waiting for more details

Comments

@bcutter
Copy link

bcutter commented Dec 30, 2023

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

@bcutter bcutter added the bug Something isn't working label Dec 30, 2023
@maxwroc
Copy link
Owner

maxwroc commented Dec 30, 2023

Can you please check if there are any errors in the dev console in your browser. And please let me know what is your browser?

I have tested your exact configuration with the group I have and everything works fine on Android/Chrome, PC/Chrome, iOS/Safari

You can try to refresh the page few times as sometimes browser caches something

@7oku
Copy link

7oku commented Dec 30, 2023

Same issue here in HA 202312.4.
Cache cleared. Tested with Firefox and Chrome. Console shows missing files:

XHRGET
https://raw.githubusercontent.com/maxwroc/battery-state-card/v3.1.0/node_modules/tslib/tslib.es6.js
[HTTP/2 404  158ms]

XHRGET
https://<redacted>/unknown/src/reactive-element.ts
[HTTP/1.1 404  0ms]

XHRGET
https://<redacted>/unknown/src/lit-element.ts
[HTTP/1.1 404  0ms]

XHRGET
https://<redacted>/unknown/src/lit-html.ts
[HTTP/1.1 404  0ms]

XHRGET
https://<redacted>/unknown/src/scoped-custom-element-registry.js
[HTTP/1.1 404  0ms]

Not sure if the last 4 belong to battery state card.

@maxwroc
Copy link
Owner

maxwroc commented Dec 30, 2023

The files from https://raw.githubusercontent.com/maxwroc/battery-state-card/* are being downloaded only when the console is open (they are referenced in the .js.map file which is included in the release package - it is useful if you want to debug js locally). But this is not used by the browser to execute sth on the HA page. The actual file which is being loaded on the page is battery-state-card.js and this one doesn't have references to such files like "tslib" etc

image

I was curious if there are some js errors?

I assume that if you downgrade everything works again?

BTW can you try to play with the card config and for example remove the folowing and check if the cards shows up:

    secondary_info: '{last_updated}'

This part was touched in the most recent update - I'm curious if it might be the root cause

@maxwroc
Copy link
Owner

maxwroc commented Dec 30, 2023

Let's check how many people will report this problem. TBH the same/similar issues are being reported after every single recent release and it is usually a problem on the side of the user.

I need more info to investigate it further. If you can try to play with the config and notice a pattern that when you add/remove something the card shows up it would be really helpful. You can start from something basic like:

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

And later add other parts of your current config to this one (one by one) checking if card renders

@bcutter
Copy link
Author

bcutter commented Dec 31, 2023

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 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...

@maxwroc
Copy link
Owner

maxwroc commented Dec 31, 2023

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 😞

@7oku
Copy link

7oku commented Dec 31, 2023

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.

@bcutter
Copy link
Author

bcutter commented Jan 6, 2024

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 😞

@maxwroc I referenced two other issues with similar problem descriptions. So fix one problem, solve several issues... :-)

@maxwroc
Copy link
Owner

maxwroc commented Jan 6, 2024

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

@maxwroc
Copy link
Owner

maxwroc commented Jan 8, 2024

@bcutter why do you have filter set to 0? I bet this is causing the problem in your case
image

I think all referenced other issues are not related - in all of them the card broke in v3.1.1 and v3.1.0 was working fine

@maxwroc maxwroc added the details needed Waiting for more details label Jan 8, 2024
@dnedeltchev
Copy link

Upgraded to 3.1.2 but the problem is still there. As mentioned in #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.

@Phoenix-DH
Copy link

Upgraded to 3.1.2 but the problem is still there. As mentioned in #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.

I have exactly the same issue here.

@maxwroc
Copy link
Owner

maxwroc commented Jan 8, 2024

@dnedeltchev First of all let's not mix two/three things. This issue was reported after the upgrade to v3.1.0. You are saying that this is the version which works for you. The OP's problem in #630 most probably will be fixed in 3.1.1 as indeed there was a bug in filters introduced.

The sort issue which you are experiencing is probably a separate third problem. Unfortunately I still don't know what can be the root cause.

@Phoenix-DH
Copy link

Ah, I did not get taht, just read this one here.

@dnedeltchev
Copy link

@dnedeltchev First of all let's not mix two/three things. This issue was reported after the upgrade to v3.1.0. You are saying that this is the version which works for you. The OP's problem in #630 most probably will be fixed in 3.1.1 as indeed there was a bug in filters introduced.

The sort issue which you are experiencing is probably a separate third problem. Unfortunately I still don't know what can be the root cause.

Hi Max,

In which case, #630, should not be marked as duplicate of this one and should not be closed as completed. I'd suggest you reopen #630.

@dnedeltchev
Copy link

Just to add, #630, was logged by me and the problem is not fixed in 3.1.1 or 3.1.2.
3.1.0 works as expected including the sorting. So I'm staying on 3.1.0 for now.

@maxwroc
Copy link
Owner

maxwroc commented Jan 8, 2024

Oh ok, I didn't realize that it was you who reported this (and I didn't check it before replying here :) ). Let's continue the discussion about your problem there

@bcutter
Copy link
Author

bcutter commented Jan 8, 2024

@bcutter why do you have filter set to 0? I bet this is causing the problem in your case image

I think all referenced other issues are not related - in all of them the card broke in v3.1.1 and v3.1.0 was working fine

No unfortunately your bet is wrong. Tested it once again (had it there cause at some places I use the filter, on others I use specific entities - I like to use a card in a "have all options there so I don't forget they exist once I come back and copy this one" manner).

I think you could read this post #623 (comment) once again where I tested by building up step by step from a minimal version. Filter is irrelevant here.
...OR you could check for a 5th time what changed from 3.0.1 to 3.1.0 :-)

(note: I tested with 3.1.0 and 3.1.2, no difference - still only empty cards!)

@maxwroc
Copy link
Owner

maxwroc commented Jan 8, 2024

Thanks. I will go through this one more time. There were quite "few" changes in v3.1.0 - I need to think about beta releases - it will be easier to find the culprit

@maxwroc maxwroc removed the details needed Waiting for more details label Jan 8, 2024
@CH1PSET1
Copy link

CH1PSET1 commented Jan 9, 2024

My card is not displayed, starting from version 1.3.1 with value = battery, without it the data appears
filter:
include:
- name: "attributes.device_class"
value: "battery"

Tell me how to roll back to 1.3.0?

@bcutter
Copy link
Author

bcutter commented Jan 9, 2024

value = battery, without it the data appears

Interesting. That might match with what I tested back in #623 (comment). Card was shown fine until I added (via include or entities) entities with battery values.


Rolling back is easy if you installed using HACS. Select the frontend integration, re-download and select the older version. Reset frontend cache, done.

@bcutter
Copy link
Author

bcutter commented Jan 9, 2024

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

@chma73
Copy link

chma73 commented Jan 10, 2024

I have the same issue
1
2

@hrw
Copy link

hrw commented Jan 11, 2024

For me it was not working in 3.1.[01] but started working again in 3.1.[23].

type: custom:battery-state-card
title: Stan baterii
filter:
  include:
    - name: attributes.device_class
      value: battery
sort:
  by: state
bulk_rename:
  - from: ' Bateria'
  - from: ' Battery'
  - from: ' level'
colors:
  steps:
    - '#ff0000'
    - '#ff9800'
    - '#4caf50'
  gradient: true

@maxwroc
Copy link
Owner

maxwroc commented Jan 13, 2024

@bcutter looking at your config I think that the latest 3.1.4 release dosn't have a fix for your issue but there is no harm to try.

If there is anyone who still has problems with not rendering card (with v3.1.4) please let me know

@maxwroc maxwroc added the details needed Waiting for more details label Jan 13, 2024
@bcutter
Copy link
Author

bcutter commented Jan 13, 2024

Tested 3.1.4 - nope, all cards not rendering.
Starts to really bore me... back to 3.0.1 for the 15th time. 😞

@chma73
Copy link

chma73 commented Jan 13, 2024

@maxwroc I still have problems with the update, setup see 3 days ago.

@maxwroc
Copy link
Owner

maxwroc commented Jan 13, 2024

@bcutter The only reason why I have asked you to try v3.1.4 is that I haven't received any console logs from you so I have no idea what is breaking rendering in your case. And in v3.1.4 I have fixed one bug which was breaking rendering - I was just hoping that this may solve the problem for you too.

If you are bored and you don't want to spend more time on this I understand it. I won't be at-mentioning you any more and feel free to close the issue.

If you (or anyone else who has the repro) is willing to help further please check the browser developer console for errors related to the card. If nothing is displayed/rendered it usually indicates an error/exception. (to open browser console press F12 if you are on PC or Cmd+Option+C in Safari)

@tylerakraft
Copy link

tylerakraft commented Jan 13, 2024

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.

@maxwroc
Copy link
Owner

maxwroc commented Jan 13, 2024

FYI in v3.1.5 whenever exception happens the error card is being rendered. Reporting issues should be much easier - I hope at least
image

@tylerakraft
Copy link

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.

@chma73
Copy link

chma73 commented Jan 13, 2024

Hi @maxwroc just tried 3.1.5 and it works fine - well done 👍 Thank you

@bcutter
Copy link
Author

bcutter commented Jan 14, 2024

Just a quick check with 3.1.5 while on the go and away from a desktop browser (this one is from the HA Companion app on iOS):

image

Shown for every entity which should be visible. So if there should be 10 entities, there's 10 times this error.

I guess you need the full output, right? Will check on a big screen in roughly 12 hours.

@maxwroc
Copy link
Owner

maxwroc commented Jan 14, 2024

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

@bcutter
Copy link
Author

bcutter commented Jan 14, 2024

Well I listed the version in the OP. Anyway, adding default_state_formatting: false made all my battery state cards to finally render again 👍

So that's obviously one setting that changed with v3.1.0 according to https://github.com/maxwroc/battery-state-card#common-options - just wasn't aware of that.

Do you know what HA version is the minimum one needed so I can switch from default_state_formatting: false to default_state_formatting: true once I upgraded so I can get the precision formatting advantages etc.? I'd like to leave myself a note for the update. After that feel free to close this issue (unless other still have it?).


Update: according to

...I'll probably just continue using the round option together with default_state_formatting: false. Not a big deal and I have a bit more control, don't see any disadvantages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working details needed Waiting for more details
Projects
None yet
Development

No branches or pull requests

9 participants