swiss-army-knife-card
swiss-army-knife-card copied to clipboard
Error : i.setConfig is not a function
Dear all -
Swiss Army Knife version
The version I am using is : v 2.5.1
HA version
Home Assistant 2023.6.3 Supervisor 2023.06.2 Operating System 10.3 Frontend 20230608.0 - latest
Bug description
I installed the frontend as discribe on the official page, as it's not possible to have a full install via HACS. when I use the examples I got this error.
Desktop browser (please complete the following information):
- OS: Windows 10
- Browser : Google Chrome
- Version : 114.0.5735.134
I hope it's clear.
Thanks for your help.
Thank you for creating your first issue for the Swiss Army Knife custom card!
Also seeing this error on same versions as OP. iOS Companion app.
Just trying to get it off the ground so I guess I’ll try a previous version or wait
edit: tried a few versions down to 2.4.3, no luck.
Hi,
Same issue here
I too see this issue. I was just beginning with this repository and was trying out the example at Battery Card: Usage
Swiss Army Knife custom card v2.5.1 Home Assistant 2023.8.4
Same here. I was copying the SAKE1 example partly to my lovelace. Worked in the beginning on Chrome and Companion app. Not on Fully Kiosk.
After a HA reboot it stopped working on all my devices
Funny detail is that all dashboards with SAK no longer work. Even the example dashboards
Figured it out for me. I was missing the template references in ui-lovelace.yaml. See step 2b of the installation manual
After digging more: It's the same issue as described here: https://github.com/AmoebeLabs/swiss-army-knife-card/issues/161
The includes that should be in ui-lovelace.yaml do not work when in storage-mode. Only when in yaml-mode. As far as I know, there currently is no way to have the required includes when in storage-mode. But hopefully, I am wrong here,..
Hello @BarBaar44 , I use the Storage mode option, for SAK templates, I add the includes at the beginning of the Filename file. It works very well.
my config got dublicate sometimes and when i fix it cards start work until it again dublicate keys in configs, also here error
Logger: frontend.js.latest.202308021
Source: components/system_log/__init__.py:270
First occurred: 8:48:56 PM (6 occurrences)
Last logged: 8:51:39 PM
http://192.168.0.54:8123/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js?hacstag=214786112251:923:1550 Uncaught Error: 2.5.1
sometimes it brake my configuration.yaml and sometimes this files
Logger: homeassistant.util.yaml.loader
Source: util/yaml/loader.py:163
First occurred: 8:55:43 PM (323 occurrences)
Last logged: 8:55:46 PM
YAML file /config/lovelace/sak_templates/templates/material3/toolset-m3-surface-colors-template.yaml contains duplicate key "cx". Check lines 41 and 342
YAML file /config/lovelace/sak_templates/templates/material3/toolset-m3-surface-colors-template.yaml contains duplicate key "cx". Check lines 41 and 357
YAML file /config/lovelace/sak_templates/templates/material3/toolset-m3-surface-colors-template.yaml contains duplicate key "cx". Check lines 41 and 372
YAML file /config/lovelace/views/sak-tutorial-views/view-tutorial-99-part1.yml contains duplicate key "fill". Check lines 4984 and 4985
YAML file /config/lovelace/views/sak-tutorial-views/view-tutorial-99-part1.yml contains duplicate key "fill". Check lines 4985 and 4986
it works until somethink happens with files
2.5.1 - SAK - System Templates reference NOT defined.
See also:
- #243
My conclusion is that the last few HA versions have problems loading the Lovelace configuration.
With issue #243 I have now proven that HA loads an OLD configuration. I added two files a week ago, and those are NOT loaded by default, only after ctrl-F5.
This happens both on Desktop and mobile (iPad/iPhone).
The problems look similar to this issue: if you have changed files, HA can't find the SAK card anymore in the resources...
I made an issue for the HA frontend, but there are no solutions yet...
@VR-VIDEO , those might be indeed duplicate definitions or just yaml anchors that the HA YAML loader can't handle. I will check those files and lines!
@wernerhp , YEP, if even those are not defined, than Lovelace hasn't loaded even the templates...
BTW: did anyone see any differences if HA is restarted?
@VR-VIDEO .
These are indeed duplicates. I will fix those and update Github:
YAML file /config/lovelace/views/sak-tutorial-views/view-tutorial-99-part1.yml contains duplicate key "fill". Check lines 4984 and 4985
YAML file /config/lovelace/views/sak-tutorial-views/view-tutorial-99-part1.yml contains duplicate key "fill". Check lines 4985 and 4986
These are YAML anchors and aliases, ie a shortcoming of the HA YAML loader:
YAML file /config/lovelace/sak_templates/templates/material3/toolset-m3-surface-colors-template.yaml contains duplicate key "cx". Check lines 41 and 342
YAML file /config/lovelace/sak_templates/templates/material3/toolset-m3-surface-colors-template.yaml contains duplicate key "cx". Check lines 41 and 357
YAML file /config/lovelace/sak_templates/templates/material3/toolset-m3-surface-colors-template.yaml contains duplicate key "cx". Check lines 41 and 372
The YAML anchor definition:
And one of the aliases using the anchor, including overwriting the 'cx:' field for which the HA YAML loader is complaining:
Yeah, I get the same with 2.4.6 - SAK - System Templates reference NOT defined.
, tried hard refreshing and cache disabled. Restarted HA. Reinstalled. No luck.
/config/www/community/swiss-army-knife-card
I don't have a /config/lovelace
folder.
I followed all the instructions step-by-step something like 10 times and now matter what, I cannot use this card :( always the same error "i.setConfig is not a function" when I try to add a card but as well with all the demo and examples from the package... am I dumb or there's something that I can fix somehow?
In case someone comes here with the same issue, here is my experience.
First, the installation instructions mention that you need to include the sak
templates in the ui-lovelace.yaml
file. This applies when you are using yaml
mode to define your dashboards as the author mentions. That ui-lovelace.yaml
file is just where the default dashboard is defined if you follow Home Assistant instruction to start using yaml
mode. If you have multiple dashboards and they are defined in different files, you need to include the templates in each one of them where you want to use the sak card.
Second, make sure you use the full path to the file, starting with /config/www/
. Notice that it starts with /
. Otherwise it will be considered a relative path starting with the folder where your dashboard is defined.
I've followed so many of the different instructions on here and for the life of me I can't get this card to work on 2024.3.0..
I guess it doesn't help that the instructions are for a much older version of HA... I really wanted this card to work, especially the car dashboard like one, but still get this same i.setConfig error..
Someone I know, managed to make the Swiss Amy Knife cards work following the problem i.setConfig is not a function. He did the following steps and it works for him. Is it possible for peoples who have this problem to take a test?
Steps:
I have just taken over everything from the installation of the dashboard that uses Swiss-Army-Knife, and I was able to make it work in a repeatable way. This involves a few manual steps since the installation of Swiss-Army-Knife is broken. The process assumes that HACS is installed and configured, and that Lovelace is used in more storage.
Installation of Swiss Army Knife custom card from HACS
Ensure that the Javascript module /hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js is loaded into the environment
Clone the git repo of swiss-army-knife to a suitable place to copy files
https://github.com/AmoebeLabs/swiss-army-knife-card.git
According to the SwissArmyKnife doc, step 2A, copy the sak_templates folder of the git repo (ha-config/lovelace) into your lovelace folder
I didn't do step 2B of the SwissArmyKnife doc
In the SwissArmyKnife doc, step 2C, add the following configuration in the configuration.yaml file:
http:
cors_allowed_origins:
- https://unpkg.com
- https://unpkg.com/lit-html@1/directives/style-map.js?module
- https://unpkg.com/lit-html@1/directives/if-defined?module
- https://unpkg.com/lit-html@%5E1.0.0?module
- https://unpkg.com/lit-html@1/directives/style-map.js?module
Okay... back in this place.. Since the upgrade to HA 2024.4, my dashboard just stopped working. Getting this in de HA-logs:
`Logger: frontend.js.latest.202404041 Source: components/system_log/init.py:320 First occurred: 5 April 2024 at 17:41:24 (41 occurrences) Last logged: 18:45:29
Uncaught error from Chrome 123.0.0.0 on Linux x86_64 Error: 2.5.1 get styles (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:923:1550) gs.getStyles (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:159:137) gs._getUniqueStyles (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:159:256) gs.initialize (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:159:690) new K (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:134:2350) new gs (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:702:1424) E (src/scoped-custom-element-registry.js:388:6) J (src/scoped-custom-element-registry.js:236:10) createErrorCardConfig (src/panels/lovelace/create-element/create-element-base.ts:100:27) customElements.get (src/panels/lovelace/create-element/create-element-base.ts:118:11)`
As I have not changed anything, I am hesitant to change anything. Good very well be just another template-not-found-thing. I don't know...
Any help is appreciated (again!).
And wondering if there is still some active development, as there hasn't been any releases lately?
I've been trying to get SAK working, but facing this error as well. Running HA 2024.4.3 and seeing the e.setConfig is not a function error more or less consistently.
Found the following errors in the HA log:
Uncaught error from Firefox 122.0 on Mac OS 10.15 Error: 2.5.1 get styles (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:923:1550) getStyles (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:159:125) _getUniqueStyles (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:159:256) initialize (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:159:690) K (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:134:2350) at (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:159:87) gs (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:702:1424) E (src/scoped-custom-element-registry.js:388:6) J (src/scoped-custom-element-registry.js:236:10) createErrorCardConfig (src/panels/lovelace/create-element/create-element-base.ts:100:27)
Uncaught error from Chrome WebView 124.0.6367.179 on Android 12 Error: 2.5.1 get styles (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:923:1550) gs.getStyles (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:159:137) gs._getUniqueStyles (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:159:256) gs.initialize (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:159:690) new K (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:134:2350) new at (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:159:87) new gs (/hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js:702:1424) E (src/scoped-custom-element-registry.js:388:6) J (src/scoped-custom-element-registry.js:236:10) createErrorCardConfig (src/panels/lovelace/create-element/create-element-base.ts:100:27)
Interestingly, the card seems to work (well, most of the time) on my Mac using Firefox, but my Android HA app seems to exhibit the error all the time. Apart from one time, when my Android App started working until I changed the config of the SAK card. Loading HA on my iPad Safari, results in a 'custom card not found' error...
Hi, same probleme here with i.setConfig is not a function
Cong:
Core 2024.5.5 Supervisor 2024.05.1 Operating System 12.3 Frontend 20240501.1
File (configuration.yaml):
frontend: extra_module_url: - /hacsfiles/Bubble-Card/bubble-pop-up.js - /hacsfiles/lovelace-card-mod/card-mod.js - /hacsfiles/swiss-army-knife-card/swiss-army-knife-card.js