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

e.slice is not a function #77

Closed
PrestonMcAfee opened this issue Feb 20, 2024 · 3 comments
Closed

e.slice is not a function #77

PrestonMcAfee opened this issue Feb 20, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@PrestonMcAfee
Copy link

PrestonMcAfee commented Feb 20, 2024

I'm a newbie at HA but code in python, mathematica and javascript regularly. Sorry if I've made a rookie mistake.

I installed decluttering-card via HACS and it shows in the list of resources. I get a javascript error: e.slice is not a function.

I've tried various things, like making a hello world simple declutter, removing and installing 0.6.3.

Checklist:

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

Release with the issue: both 0.6.3 and1.0.0

Last working release (if known): N/A

Browser and Operating System: Chrome 121.0.6167.185 running on Windows 11 23H2.

Description of problem:

custom:decluttering-card produces javascript errors and does not run. I added it with HACS, and it shows in the list of resources along with other HACS cards. My decluttering template is

decluttering_templates:
  menu:
    card:
      type: custom:button-card
      name: '[[name]]'
      icon: mdi:'[[icon]]'
      tap_action:
        action: call-service
        service: script.togr
        service_data:
          room: '[[room]]'
      styles:
        icon:
          - color: |
              [[[ if (states['[[room]]'].state == 'on') 
                  return "#FF00FF";
                else return "var(--primary-text-color)";  ]]]

which I put at the top of the dashboard using the raw configuration editor. I then created this card:

type: custom:decluttering-card
template: menu
variables:
  name: Lights
  icon: home-floor-3
  room: input_boolean.r3

which produces the error. There is no error if the card is not present, perhaps because decluttering-card.js isn't called.

Javascript errors shown in the web inspector (if applicable):

create-element-base.ts:180 card custom:decluttering-card TypeError: e.slice is not a function
    at decluttering-card.js?hacstag=188686483100:190:1654
    at ke.setConfig (decluttering-card.js?hacstag=188686483100:190:2127)
    at r (create-element-base.ts:95:11)
    at create-element-base.ts:109:12
    at h (create-element-base.ts:213:12)
    at c (create-element-base.ts:170:12)
    at g (create-card-element.ts:101:3)
    at i.value (hui-view.ts:66:21)
    at i.value (hui-view.ts:304:26)
    at t.addEventListener.once (hui-view.ts:80:16)

Additional information:
I also put this to the community here.

@PrestonMcAfee PrestonMcAfee added the bug Something isn't working label Feb 20, 2024
@ildar170975
Copy link

Answered in community.

@PrestonMcAfee
Copy link
Author

As ildar notes, solution was that I hadn't used a list for the configuration

type: custom:decluttering-card
template: menu
variables:
  - name: Lights
  - icon: home-floor-3
  - room: input_boolean.r3

@PrestonMcAfee
Copy link
Author

Closing as solved

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

2 participants