State-switch card isn't displayed in v1.6.0 and above with TypeError: Cannot read properties of undefined (reading 'states')
Describe the bug The state switch card is not working in the pop-up. I'm using a template to show a card depending of states.light. It's working on v1.5.3 but it's not working since v1.6.0
To Reproduce Add a state-state-switch card in a pop-up view.
Config for the state-switch card inside the vertical-stack:
type: custom:state-switch
entity: template
template: |
{% set areas = states.light
| selectattr('name')
| rejectattr('state','match','unavailable')
| rejectattr('state','match','unknown')
| map(attribute='entity_id')
| map('area_name') | unique | reject('none') | list %}
{% if "Cuisine" in areas %}
true
{% endif %}
states:
'true':
type: custom:bubble-card
card_type: separator
name: Lumières
icon: mdi:lightbulb-group
The separator of the state-switch card is not building in the dashboard:
Expected behavior
Result with v1.5.3:
Curiously, with v.1.6.4 we can see the expected behavior when in editing mode:
Desktop (please complete the following information):
- OS: Windows 10
- Browser: Chrome
- Version: I tried on v1.6.0 and v1.6.4 and both version have this bug.
Smartphone (please complete the following information):
- Device: iPhoneXR
- OS: iOS17.3
- Browser: Home Assistant Companion App
- Version: v1.6.4
Additional context
Here are some of the errors displayed by the browser console in v1.6.4:
Hi, can you tell me if this is fixed in the new v1.7.1? And thanks for the feedback!
https://github.com/Clooos/Bubble-Card/releases/tag/v1.7.1
Sometimes I can see the state card but it stop working after a while. I also tried with the newest version. I can't get it to work with v1.7.2 and v1.7.3.
Doesn't show the separator card when the state is changed. Shows in editing mode but not on dashboard.
Log:
ogger: frontend.js.latest.202403060 Source: components/system_log/init.py:306 First occurred: March 24, 2024 at 11:07:27 PM (321 occurrences) Last logged: 12:04:44 AM
Uncaught error from WebKit 605.1.15 on iOS 16.7.7 TypeError: undefined is not an object (evaluating 'e.states') /hacsfiles/Bubble-Card/bubble-card.js:1:4363 k (/hacsfiles/Bubble-Card/bubble-card.js:1:4598) /hacsfiles/Bubble-Card/bubble-card.js:520:22386 updateBubbleCard (/hacsfiles/Bubble-Card/bubble-card.js:520:24069) hass (/hacsfiles/Bubble-Card/bubble-card.js:520:1103) connectedCallback (/hacsfiles/lovelace-state-switch/state-switch.js:1:18872) this (src/scoped-custom-element-registry.js:248:47) insertBefore ([native code]::) t (src/lit-html.ts:1454:43) i (src/lit-html.ts:1563:23) Uncaught error from WebKit 605.1.15 on Mac OS 10.15.7 TypeError: undefined is not an object (evaluating 'e.states') /hacsfiles/Bubble-Card/bubble-card.js:1:4363 k (/hacsfiles/Bubble-Card/bubble-card.js:1:4598) /hacsfiles/Bubble-Card/bubble-card.js:520:22386 updateBubbleCard (/hacsfiles/Bubble-Card/bubble-card.js:520:24069) hass (/hacsfiles/Bubble-Card/bubble-card.js:520:1103) connectedCallback (/hacsfiles/lovelace-state-switch/state-switch.js:1:18872) this (src/scoped-custom-element-registry.js:248:47) insertBefore ([native code]::) t (src/lit-html.ts:1454:43) i (src/lit-html.ts:1563:23) Uncaught error from Chrome 123.0.0.0 on Mac OS 10.15.7 TypeError: Cannot read properties of undefined (reading 'states') /hacsfiles/Bubble-Card/bubble-card.js:1:4364 k (/hacsfiles/Bubble-Card/bubble-card.js:1:4598) /hacsfiles/Bubble-Card/bubble-card.js:520:22385 V.updateBubbleCard (/hacsfiles/Bubble-Card/bubble-card.js:520:24069) set hass (/hacsfiles/Bubble-Card/bubble-card.js:520:1087) pt.connectedCallback (/hacsfiles/lovelace-state-switch/state-switch.js:1:18877) apply (src/scoped-custom-element-registry.js:248:41) insertBefore (src/lit-html.ts:1411:52) k (src/lit-html.ts:1454:35) $ (src/lit-html.ts:1563:11) Uncaught error from Chrome 123.0.0.0 on Mac OS 10.15.7 TypeError: Cannot redefine property: googletag :1:196 :1:524 Uncaught error from WebKit 605.1.15 on Mac OS 10.15.7 TypeError: null is not an object (evaluating 't.popUp.classList') /hacsfiles/Bubble-Card/bubble-card.js:520:1626
The next release should finally fix that, I will release it in beta at first in a week or two.
Can you tell me if it's now working as expected in the last beta?