Closed alvinleegit closed 1 year ago
Thank you for creating your first issue for the Swiss Army Knife custom card!
exact problem here. please help with a patch.
I made a very big solar-card with the live-state of my house and that card is very important for me. :-( For the moment i did a downgrade of Homeassistant to 2023-03...
Same issue here post upgrade to 2023.4.1 (Upgraded from 2023.3.3, skipped 2023.4.0).
Also seeing the following error in the HA core logs:
Logger: frontend.js.latest.202304061
Source: components/system_log/__init__.py:257
First occurred: 22:45:40 (52 occurrences)
Last logged: 22:56:58
http://x.x.x.x:8123/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:693:758 TypeError: SwissArmyKnifeCard.lovelace is null
:0:0 ResizeObserver loop completed with undelivered notifications.
This and #177 appear to be caused by a change in 2023.4.0 that makes custom-card-tools (which swiss-army-knife-card uses) break. I have a pull request in against custom-card-tools to fix this here:
https://github.com/custom-cards/custom-card-helpers/pull/73
In the meantime, to get swiss-army-knife-card working, you can grab the file from here:
https://raw.githubusercontent.com/cerebrate/custom-card-helpers/master/dist/index.m.js
place it in the www/community/swiss-army-knife-card/
directory under your Home Assistant configuration directory under the name custom-card-helpers.m.js
, and then very carefully find the part at the top of swiss-army-knife-card.js
in the same directory that reads
import{fireEvent,stateIcon,getLovelace}from"https://unpkg.com/custom-card-helpers@1.8.0/dist/index.m.js?module";
and change that and only that to
import{fireEvent,stateIcon,getLovelace}from"/local/community/swiss-army-knife-card/custom-card-helpers.m.js?module";
Since the browser will use the compressed version of the .js file if it can, after you have edited swiss-army-knife-card.js, delete swiss-army-knife-card.js.gz, and then make a new compressed version of your edited file with
gzip -k swiss-army-knife-card.js
Don't omit the -k, because you need both the .js and the .js.gz there. You'll need to do this any time you edit the .js.
Clear caches, reload resources, refresh, etc., and otherwise do the needful to get your browser to notice the changes, and you should have a working swiss-army-knife-card again.
Does not work for me... :-(
I'm sorry to say that's not working for me either....
I'm sorry to say too. Doesn't work for me.
The new custom-card-helpers.m.js works in the old ha (2023.3.6). But not in the new ha version (2023.4.2)
Unfortunately, I have the same problem. :(
"The new custom-card-helpers.m.js works in the old ha (2023.3.6). But not in the new ha version (2023.4.2)"
Well, that's damned odd, because it's working fine for me in 2023.4.2 right now...
...oh, bugger. Sorry, y'all, I forgot to mention a step. Since the browser will use the compressed version of the .js file if it can, after you have edited swiss-army-knife-card.js, delete swiss-army-knife-card.js.gz, and then make a new compressed version of your edited file with
gzip -k swiss-army-knife-card.js
Don't omit the -k, because you need both the .js and the .js.gz there. You'll need to do this any time you edit the .js.
Solved, 1000 thanks and gratitude!
Works for me too! Thank you very, very much! Very happy to see my 'under construction' dashboard is back again.
Worked on my side as well! Thanks a lot for clarifying ! :-)
Thanks a lot. Works for me too!
I applied the fix and its working, expect in the companion app in iOS. Is there something that I need to do to get it to work in the companion app in iOS?
@joeyjojo747
To clear cache in the iOS app the way that makes this fix work, you have to go to
Settings -> Companion App -> Debugging -> Reset frontend cache
If you haven't tried that already, try that, and then reload it. It should work then.
@cerebrate that worked. Thank you!!
@cerebrate - thanks so much for this! I've followed your instructions all the way through, but I'm coming unstuck at the final gzip step. Any pointers as to how I create the new compressed file?
@cerebrate - thanks so much for this! I've followed your instructions all the way through, but I'm coming unstuck at the final gzip step. Any pointers as to how I create the new compressed file?
depends on your HASS installation, but the easiest way is to go into a terminal either via SSH or on your HASS itself and then go to the correct folder. once there remove the old compressed file and run the gzip -k command to create a new one.
After update SAK to version v1.0.0-rc.4 the error "i.setconfig is not a function" came back, and the above procedure to solve the problem no longer works.
Thanks for the reply, but I don't understand what dependency is missing. I use storage mode, and resources were added through U.I.. Before the update it worked perfectly.
I can't repro this, I'm afraid. I just updated to v1.0.0-rc.4 here and it's working fine without having to repeat the procedure.
This commit: https://github.com/AmoebeLabs/swiss-army-knife-card/commit/22197063f84e836468e13051d68595d1fdfbaff4 should have fixed this problem and is part of release https://github.com/AmoebeLabs/swiss-army-knife-card/releases/tag/v1.0.0-rc.4
So, @cerebrate , Thanks for your efforts! I totally missed that change, as I had a fixed HA version (docker) running. So pulling new versions did not work and I didn't see my own cards failing...
@stgallazzi , did you clear your browser cache? And you should clear the frontend cache in the companion app for this change to get noticed by the mobile app.