button-card icon indicating copy to clipboard operation
button-card copied to clipboard

custom:button-card fails to show intermittently on dashboards in ha-2023.4.xx

Open matthyne opened this issue 1 year ago • 35 comments

Checklist

  • [ X] I updated the card to the latest version available
  • [ X] I cleared the cache of my browser

Describe the bug Since either late 2023.3.xx and early 2023.4.xx something happened in HA that is causing cards with custom:button-card to intermittently fail to show in dashboards.

The cards show as missing but if you click on "edit dashboard" the card outlines will show and you can then click "edit" to see the YAML and preview.

Reloading the dashboard will either fix the problem or make it worse. Repeated reload of the browser window or a restart of HA will temporarily fix the problem (for that session).

The problem shows both in the Web version of HA and mobile companion app. Has been verified on multiple devices Version of the card Version: v3.5.0

To Reproduce This is the configuration I used: type: custom:button-card template: container color: '#00E730' name: Television Power custom_fields: buttons: card: type: horizontal-stack cards: - type: button tap_action: action: toggle entity: switch.family_tv_pwr icon: mdi:television name: Family/Living TV show_state: false - type: button tap_action: action: toggle entity: switch.kitchen_tv_pwr icon: mdi:television name: Kitchen TV - type: button tap_action: action: toggle entity: switch.media_tv_pwr name: Media TV icon: mdi:television

Screenshots image image

Expected behavior It is expected that the cards be fully rendered and show every time the dashboard shows.

Desktop (please complete the following information):

  • Browser: chrome
  • Version: 112.0.5615.137

Smartphone (please complete the following information):

  • Device: Samsung Galaxy S22
  • OS: Android 13
  • Browser Chrome
  • Version [e.g. 22]

Additional context Problem impacts both web and mobile client.
Very similar problem to https://github.com/home-assistant/frontend/issues/16155

matthyne avatar Apr 26 '23 14:04 matthyne

Seconding that I have this issue too. Happens across multiple devices and browsers, have cleared the cache and reinstalled the app many many times.

More details to the issue:

  • Never happens when paging between dashboards (e.g. go to energy and back to the main dashboard with button-cards on them, it works 100% of the time)
  • Most often happens on browser refresh or app close/open
  • Very random, sometimes it's missing one card, sometime it is missing 4-5
  • My dashboard has been static for over 6 months and this just started happening recently
  • Tried in 5.0 beta and this problem still occurs the same as in 4.6 stable
  • When the problem occurs, in my browser's console, I see the following error (not present when everything renders properly): hui-error-card TypeError: n.setConfig is not a function followed by a line reference to button-card.js:425:5936

awilson133 avatar Apr 27 '23 22:04 awilson133

Any logs in the javascript console?

RomRider avatar Apr 28 '23 01:04 RomRider

Any logs in the javascript console?

Personally I just get hundreds of the following when it happens: hui-error-card TypeError: n.setConfig is not a function followed by a line reference to button-card.js:425:5936

Can post the whole log trace but its literally just that and it would take some effort to sanitize. Happy to do so if it will help though!

awilson133 avatar Apr 28 '23 06:04 awilson133

could you simplify the erroneous card config? asking because embedding (core) button inside the custom:button-card in the main post.

Would be interesting to test if the embedded horizontal-stack is throwing the error, or the main card config itself.

Mariusthvdb avatar Apr 28 '23 09:04 Mariusthvdb

could you simplify the erroneous card config? asking because embedding (core) button inside the custom:button-card in the main post.

Would be interesting to test if the embedded horizontal-stack is throwing the error, or the main card config itself.

Absolutely. I made a new dashboard with 2 basic title cards containing 3 buttons each (all just native button-card stuff). The issue occurs exactly the same, dash is nothing fancy at all. I am a different guy than the OP and don't use core buttons inside of button cards anywhere, just button card items.

Attached the YAML in dashboard.txt. The error file is 103 MB of just looping errors as posted above, if you want me to try to trim it down and post it I can as well.

dashboard.txt

awilson133 avatar Apr 28 '23 20:04 awilson133

I have had the same issue. In my case, I have a picture-entity card within the button-card. I see thousands of the same error: hui-error-card TypeError: n.setConfig is not a function. As mentioned above, its intermittent, started suddenly around 2023.4, does not happen if switching views (only on a refresh) and nothing changed otherwise leading up to this. I had this button working for over a year prior. Occurs on PC web browser, mobile client, and Android wall tablet.

neon-rage avatar May 01 '23 14:05 neon-rage

I have had the same issue. In my case, I have a picture-entity card within the button-card. I see thousands of the same error: hui-error-card TypeError: n.setConfig is not a function. As mentioned above, its intermittent, started suddenly around 2023.4, does not happen if switching views (only on a refresh) and nothing changed otherwise leading up to this. I had this button working for over a year prior. Occurs on PC web browser, mobile client, and Android wall tablet.

Thanks for the support :)

In my case, no picture-entity-card is being used. Let me know if I can provide more assistance to help here. Absolutely love this project and would love to help out!

awilson133 avatar May 01 '23 20:05 awilson133

In the screenshot above it shows all instances of custom:button-card not showing up and some of these are very simple single element button cards without any additional embedded cards. Seems like the problem is only related to the custom:button-card card.

matthyne avatar May 02 '23 01:05 matthyne

Here is some config logs: image

matthyne avatar May 02 '23 01:05 matthyne

Those are the exact errors I see too in Chrome developer console.

Another tidbit, I thought maybe it was somehow time related, as it if it was happening in 1 browser, maybe it was happening right now in another at that instant, but have since disproven that theory.

neon-rage avatar May 02 '23 19:05 neon-rage

I'm seeing this problem very consistently in conjunction with popup cards (browsermod). Havent seen a button once on any of the popups after upgrade to 2023.4. Errors on devtools sound just slightly different in my case: image

sh00bx avatar May 06 '23 14:05 sh00bx

I think I found a smoking gun here... When using Chrome and toggling on "pause on breakpoints," I can see that the error trying to be passed back to n.SetConfig is as follows:

error

The interesting part too is that this error is implying that the use of either vertical-stack or horizontal-stack is playing a part here (it changes based on if my dashboard is using horizontal or vertical stack). If I remove all instances of horizontal or vertical stacks from the dashboard, everything works as expected, and the issue never happens. @RomRider any thoughts or any way I can assist here?

EDIT: I also changed horizontal-stack to grid and this 100% fixes the issue for me too. Something like:

Broken: type: horizontal-stack Working:

      type: grid
      columns: 2
      square: false

awilson133 avatar May 08 '23 20:05 awilson133

I think I found a smoking gun here... When using Chrome and toggling on "pause on breakpoints," I can see that the error trying to be passed back to n.SetConfig is as follows:

error

The interesting part too is that this error is implying that the use of either vertical-stack or horizontal-stack is playing a part here (it changes based on if my dashboard is using horizontal or vertical stack). If I remove all instances of horizontal or vertical stacks from the dashboard, everything works as expected, and the issue never happens. @RomRider any thoughts or any way I can assist here?

EDIT: I also changed horizontal-stack to grid and this 100% fixes the issue for me too. Something like:

Broken: type: horizontal-stack Working:

      type: grid
      columns: 2
      square: false

Just replying here to state that I changed all my dashboards to use grid instead of horizontal or vertical stack (which really makes them ugly but that is irrelevant), and have had NO incidences of this issue for 20 hours across all my devices. It used to happen every second or third load so this is clearly a fix.

awilson133 avatar May 09 '23 17:05 awilson133

My disappearing button card is not inside a vertical or horizontal stack, it is within a grid. However I do have a vertical-stack elsewhere on the dashboard.

neon-rage avatar May 09 '23 17:05 neon-rage

My disappearing button card is not inside a vertical or horizontal stack, it is within a grid. However I do have a vertical-stack elsewhere on the dashboard.

Believe it or not, this appears to be relevant in my testing. Try removing the vertical stack and see if it resolves similar to me. If a button card is in a stack anywhere on the dash, I get this problem. Even if it is a completely blank button card it will cause this issue to crop up and random cards to disappear (or all of them to)

awilson133 avatar May 09 '23 17:05 awilson133

Any resolution for this?

LexusSpeed03 avatar May 13 '23 01:05 LexusSpeed03

Any resolution for this?

I wish...My work around is still working for me, but it drastically "uglies up" my dashboards.

awilson133 avatar May 15 '23 19:05 awilson133

I am going to have to ditch custom:button-card if I cannot get an update or solution to this soon. I just cannot have my users complaining that they are missing cards appearing every day.

matthyne avatar May 16 '23 04:05 matthyne

I have gone ahead and removed all instances of horizontal-stack in my dashboard and I am still seeing the problem (after full reboot) so I am not sure if this problem is only related to horizontal-stack.

matthyne avatar May 17 '23 02:05 matthyne

For me the problem was a combination of grid/stack cards, and using basic entity cards. When I changed my buttons to custom:button_card it worked fine.

No idea what the cause was though

slothking87 avatar May 17 '23 02:05 slothking87

I have gone ahead and removed all instances of horizontal-stack in my dashboard and I am still seeing the problem (after full reboot) so I am not sure if this problem is only related to horizontal-stack.

Did you remove all instances of horizontal and vertical stacks from all parts of the dashboard? For me that fixed it. If I add even one back to an unrelated component the issue comes back.

awilson133 avatar May 17 '23 03:05 awilson133

So I have removed ALL instances of h-stack and v-stack cards from my dashboard now and it seem to be stable. I moved everything to grid cards with minimal impact on the UI.

matthyne avatar May 19 '23 02:05 matthyne

Has anyone figured out what's wrong with the stack cards that is causing this? I would love to fix the root issue instead of refactoring the large number (77) of stack cards I'm using across all my dashboard views.

ktownsend-personal avatar May 19 '23 20:05 ktownsend-personal

Has anyone figured out what's wrong with the stack cards that is causing this? I would love to fix the root issue instead of refactoring the large number (77) of stack cards I'm using across all my dashboard views.

Unfortunately I think this project is relatively unmaintained. I am not a JS expert so I have little idea where to start looking for issues.

awilson133 avatar May 21 '23 17:05 awilson133

Since upgrading to 2023.6 yesterday, I have not seen the missing custom:button-card objects once across the 3 devices I use the dashboard on. Maybe it was magically fixed by something in the core update? Has anyone else noticed this?

neon-rage avatar Jun 08 '23 20:06 neon-rage

Since upgrading to 2023.6 yesterday, I have not seen the missing custom:button-card objects once across the 3 devices I use the dashboard on. Maybe it was magically fixed by something in the core update? Has anyone else noticed this?

Confirmed, this fixed it for me as well. Recommend this issue be closed as resolved.

awilson133 avatar Jun 09 '23 01:06 awilson133

Not sure if its just me, but this appears to be back and happening to me on the same button card in 2023.10.

neon-rage avatar Oct 21 '23 23:10 neon-rage

I am seeing the same issue, sometimes having to restart my HA app on my phone several times before it will reappear. Currently running 2023.10.5.

milkmanrox avatar Oct 23 '23 04:10 milkmanrox

I am seeing the same issue, sometimes having to restart my HA app on my phone several times before it will reappear. Currently running 2023.10.5.

Verified it's the exact same issue again for me. Going back to 2023.9.* fixes it for me but that's hardly a "fix."

awilson133 avatar Oct 23 '23 20:10 awilson133

This is also happening to me. 2023.10.5

Guess we're rollin' back.

TimFrymire avatar Oct 31 '23 00:10 TimFrymire