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

Error : i.setConfig is not a function #237

Open
LittleScarabee opened this issue Jun 27, 2023 · 24 comments
Open

Error : i.setConfig is not a function #237

LittleScarabee opened this issue Jun 27, 2023 · 24 comments
Labels
bug Something isn't working

Comments

@LittleScarabee
Copy link

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.

@LittleScarabee LittleScarabee added the bug Something isn't working label Jun 27, 2023
@github-actions
Copy link

Thank you for creating your first issue for the Swiss Army Knife custom card!

@LintHart
Copy link

LintHart commented Jun 30, 2023

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.

@RienduPre
Copy link

Hi,

Same issue here

@mrUlrik
Copy link

mrUlrik commented Aug 26, 2023

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

image

@BarBaar44
Copy link

BarBaar44 commented Aug 29, 2023

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: #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,..

@ghost
Copy link

ghost commented Sep 7, 2023

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.

IMG_7608
IMG_7609

@VR-VIDEO
Copy link

VR-VIDEO commented Sep 8, 2023

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
image

@wernerhp
Copy link

2.5.1 - SAK - System Templates reference NOT defined.

@AmoebeLabs
Copy link
Owner

AmoebeLabs commented Sep 17, 2023

See also:

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?

@AmoebeLabs
Copy link
Owner

@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:
image

And one of the aliases using the anchor, including overwriting the 'cx:' field for which the HA YAML loader is complaining:
image

@wernerhp
Copy link

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.

@wernerhp
Copy link

/config/www/community/swiss-army-knife-card
I don't have a /config/lovelace folder.
image

@papperone
Copy link

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?

@reydelleon
Copy link

reydelleon commented Jan 20, 2024

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.

@lexiismadd
Copy link

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

@ghost
Copy link

ghost commented Mar 29, 2024

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

@BarBaar44
Copy link

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?

@trizmark
Copy link

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

@lilp69
Copy link

lilp69 commented May 28, 2024

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

@gralfj
Copy link

gralfj commented Sep 27, 2024

``I find myself in the same place.

after spending lots of hours just to install, at least that´s what I thoguth, now cards show isetConfig is not a function message

I took a look at the logs and thers is plenty of them, well there are errors and warnings

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) k (src/scoped-custom-element-registry.js:388:6) J (src/scoped-custom-element-registry.js:236:10) createErrorBadgeConfig (src/panels/lovelace/create-element/create-element-base.ts:121:27) customElements.get (src/panels/lovelace/create-element/create-element-base.ts:146:11)

@gralfj
Copy link

gralfj commented Sep 27, 2024

@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: image

And one of the aliases using the anchor, including overwriting the 'cx:' field for which the HA YAML loader is complaining: image

I found dulicates in many of the themes, HA shows warnings for them

@VR-VIDEO
Copy link

VR-VIDEO commented Sep 27, 2024 via email

@gralfj
Copy link

gralfj commented Sep 27, 2024

Yes, what weird it's making duplicates.

On Fri, Sep 27, 2024, 3:18 AM gralfj @.> wrote: @VR-VIDEO https://github.com/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: [image: image] https://private-user-images.githubusercontent.com/7996307/268497736-561ca3bc-ac3f-4d51-8352-f6d627653a65.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mjc0MjE3NjksIm5iZiI6MTcyNzQyMTQ2OSwicGF0aCI6Ii83OTk2MzA3LzI2ODQ5NzczNi01NjFjYTNiYy1hYzNmLTRkNTEtODM1Mi1mNmQ2Mjc2NTNhNjUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkyNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MjdUMDcxNzQ5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZmQ0NWEyMzhhZGMxM2Q3ODQ3YmIyZGMyMTIyNjk3YjRkZGI3NDVlOTU4YjVkN2I1NTJjOWMxZjVhYTA1MjMyYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.PpnOUEARZp3FgjrBWuccAND21sBkLqgaUSo7D39enPc And one of the aliases using the anchor, including overwriting the 'cx:' field for which the HA YAML loader is complaining: [image: image] https://private-user-images.githubusercontent.com/7996307/268497727-5b488a18-9d44-4b30-873d-6e87fcf20a46.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mjc0MjE3NjksIm5iZiI6MTcyNzQyMTQ2OSwicGF0aCI6Ii83OTk2MzA3LzI2ODQ5NzcyNy01YjQ4OGExOC05ZDQ0LTRiMzAtODczZC02ZTg3ZmNmMjBhNDYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkyNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MjdUMDcxNzQ5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MThhY2QyNmY5YTAwNDI3MmY1N2U2ZDJiZmIxZDNjZDE5ZjA4NTQ3NWY1NzliMGIzMGRmZjgyZGFlMzEyYjUzYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.Zpu8tjB4OqgCLrgwOKw1B-B4nEuoyKHGLjDspMBLI-c I found dulicates in many of the themes, HA shows warnings for them — Reply to this email directly, view it on GitHub <#237 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK4ORJHVNMMAUVSU23HRGRLZYUBFRAVCNFSM6AAAAAAZWDYNDCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZYGU3TQOJXG4 . You are receiving this because you were mentioned.Message ID: @.>

thank you for your reply, do you think there is something going on with the installation? or is it a bug?

@falkio8
Copy link

falkio8 commented Nov 18, 2024

Is there any solution to this? I installed via HACS, made all manual steps described in 2. Copied files to /lovelace, set the lovelace: storage mode in the configuration.yaml and copied the example dashboard. The dashboard showed up but "i.setConfig is not a function" on all views of the example dashboard. I think for whatever reason the loading of the required ressources failed.

I got it to work for a short period of time by deleting the browser cache. No its back to the error. This is not usable.

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

No branches or pull requests