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

Fan modes button error when HVAC is in Dry Mode #987

Open
Muzza opened this issue Dec 3, 2024 · 13 comments
Open

Fan modes button error when HVAC is in Dry Mode #987

Muzza opened this issue Dec 3, 2024 · 13 comments
Labels
bug Something isn't working Bug-Fix 🥳

Comments

@Muzza
Copy link

Muzza commented Dec 3, 2024

Steps:

  1. Create a new climate card
  2. Create a 'fan_modes' sub-button.
  3. Set the device mode to 'dry'.
  4. The bubble card shows an error 'o is null' and nothing else.

I'm using Sensibo for my climate integration. When I inspect the climate entity, the attribute 'fan_mode' gets set to 'null' when the device is in dry mode. (Fan modes are not adjustable in that mode)

Changing the HVAC mode to Cool or Heat allows the card to work again.
Ideally the fan sub-button would just disappear when it is not a valid option.

@Muzza Muzza added the bug Something isn't working label Dec 3, 2024
@Clooos
Copy link
Owner

Clooos commented Dec 3, 2024

Hi! There is not much that I can do "by default" because I guess that some types of climate entities handle that differently.

But you can add a simple template, in the editor, go to Styling options > Custom styles / Templates then add this to show it only when needed:

/* Replace "1" if needed to match your sub-button and replace "climate.your_entity" */
.bubble-sub-button-1 {
  display: ${hass.states['climate.your_entity'].attributes.hvac_mode !== 'dry' ? '' : 'none'} !important;
}

This should works as you want 🙂

@Muzza
Copy link
Author

Muzza commented Dec 4, 2024

Thanks for the response. This does not fix it though.
There is no attribute called hvac_mode, but I could still use the approach you suggested to test against fan_mode instead like this:

  .bubble-sub-button-1 {
    display: ${hass.states['climate.office'].attributes.fan_mode === null ? 'none' : ''} !important;
  }

This does disable the button, but only if the fan_modes button does not exist at all.

I made a gif to demo it.
The first card shows the problem.
The second card shows that the custom style is correctly removing the sub button.

Also worth noting that home assistant really does not like this. I sometimes get kicked out of editor mode and returned to the entry page, or the entire panel stops being displayed. To get it working again, I have to change the HVAC mode back to cool and refresh the page.

ClimateBug

The first card:

type: custom:bubble-card
card_type: climate
entity: climate.office
sub_button:
  - name: HVAC modes menu
    select_attribute: hvac_modes
    state_background: false
    show_arrow: false
  - entity: climate.office
    select_attribute: fan_modes
force_icon: false
show_state: true
show_last_changed: false
state_color: true
show_attribute: false
show_icon: false
name: Office
scrolling_effect: false
styles: |-
  .bubble-sub-button-2 {
    display: ${hass.states['climate.office'].attributes.fan_mode === null ? 'none' : ''} !important;
  }
card_layout: large

2nd card:

type: custom:bubble-card
card_type: climate
entity: climate.office
sub_button:
  - name: HVAC modes menu
    select_attribute: hvac_modes
    state_background: false
    show_arrow: false
force_icon: false
show_state: true
show_last_changed: false
state_color: true
show_attribute: false
show_icon: false
name: Office
scrolling_effect: false
styles: |-
  .bubble-sub-button-1 {
    display: ${hass.states['climate.office'].attributes.fan_mode === null ? 'none' : ''} !important;
  }
card_layout: large

3rd card is the mushroom climate card, just for reference.

@Muzza
Copy link
Author

Muzza commented Dec 4, 2024

From the home assistant log:

Uncaught error from Firefox 133.0 on Windows 10 TypeError: "sub_button" is read-only _arrayValueChange (/hacsfiles/Bubble-Card/bubble-card.js:1305:757) getConfigElement/makeSubButtonPanel/e</< (/hacsfiles/Bubble-Card/bubble-card.js:1149:71) call (src/lit-html.ts:2018:28) dispatchEvent (src/common/dom/fire_event.ts:76:7) ev.stopPropagation (src/components/ha-combo-box.ts:323:16) call (src/lit-html.ts:2018:28) dispatchEvent (node_modules/@polymer/polymer/lib/mixins/property-effects.js:328:42) dispatchNotifyEvent (node_modules/@polymer/polymer/lib/mixins/property-effects.js:353:2) fn (node_modules/@polymer/polymer/lib/mixins/property-effects.js:176:11) runEffectsForProperty (node_modules/@polymer/polymer/lib/mixins/property-effects.js:263:17)
Uncaught error from Firefox 133.0 on Windows 10 TypeError: r.forEach is not a function V (/hacsfiles/Bubble-Card/bubble-card.js:1:37106) updateBubbleCard/< (/hacsfiles/Bubble-Card/bubble-card.js:1:136145) updateBubbleCard (/hacsfiles/Bubble-Card/bubble-card.js:1:136826) connectedCallback (/hacsfiles/Bubble-Card/bubble-card.js:1:97485) apply (src/scoped-custom-element-registry.js:248:41) this.removeChild (src/panels/lovelace/cards/hui-card.ts:276:11) _updateVisibility (src/panels/lovelace/cards/hui-card.ts:261:9) changedProps.has (src/panels/lovelace/cards/hui-card.ts:218:11) update (src/reactive-element.ts:1329:13) performUpdate (src/reactive-element.ts:1261:16)
Uncaught error from Firefox 133.0 on Windows 10 TypeError: o is undefined B (/hacsfiles/Bubble-Card/bubble-card.js:1:33245) V/< (/hacsfiles/Bubble-Card/bubble-card.js:1:38407) V (/hacsfiles/Bubble-Card/bubble-card.js:1:37106) updateBubbleCard/< (/hacsfiles/Bubble-Card/bubble-card.js:1:136145) updateBubbleCard (/hacsfiles/Bubble-Card/bubble-card.js:1:136826) connectedCallback (/hacsfiles/Bubble-Card/bubble-card.js:1:97485) apply (src/scoped-custom-element-registry.js:248:41) this.removeChild (src/panels/lovelace/cards/hui-card.ts:276:11) _updateVisibility (src/panels/lovelace/cards/hui-card.ts:261:9) changedProps.has (src/panels/lovelace/cards/hui-card.ts:218:11)
Uncaught error from Firefox 133.0 on Windows 10 TypeError: o is undefined B (/hacsfiles/Bubble-Card/bubble-card.js:1:33245) V/< (/hacsfiles/Bubble-Card/bubble-card.js:1:38407) V (/hacsfiles/Bubble-Card/bubble-card.js:1:37106) updateBubbleCard/< (/hacsfiles/Bubble-Card/bubble-card.js:1:136145) updateBubbleCard (/hacsfiles/Bubble-Card/bubble-card.js:1:136826) connectedCallback (/hacsfiles/Bubble-Card/bubble-card.js:1:97485) 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:1401:11)
Uncaught error from Firefox 133.0 on Windows 10 TypeError: o is null B (/hacsfiles/Bubble-Card/bubble-card.js:1:33245) V/< (/hacsfiles/Bubble-Card/bubble-card.js:1:38407) V (/hacsfiles/Bubble-Card/bubble-card.js:1:37106) updateBubbleCard/< (/hacsfiles/Bubble-Card/bubble-card.js:1:136145) updateBubbleCard (/hacsfiles/Bubble-Card/bubble-card.js:1:136826) connectedCallback (/hacsfiles/Bubble-Card/bubble-card.js:1:97485) 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)

@MrBearPresident MrBearPresident added the wontfix This will not be worked on label Dec 10, 2024
@Muzza
Copy link
Author

Muzza commented Dec 12, 2024

I notice it has been marked as wontfix. I guess I had wrongly assumed this was a simple missing null check based on the log. I would love to understand more about why this is something that is non-trivial to fix. I had thought Sensibo was one of the biggest smart HVAC services. The climate documentation explicitly states that both fan_mode and fan_modes can be None, so I don't think there is any unusual behaviour going on here.
Here is the default UI handling it for reference.
ClimateBug2

@Clooos Clooos removed the wontfix This will not be worked on label Dec 12, 2024
@Clooos
Copy link
Owner

Clooos commented Dec 12, 2024

You're right, I will have to take a look at this 👍

@Clooos
Copy link
Owner

Clooos commented Dec 12, 2024

This should be fixed in the next release!

Clooos added a commit that referenced this issue Dec 12, 2024
- [x] Fan modes button error when HVAC is in Dry Mode #987
- [x] Enhancement: Add Box-Shadow Customization to Bubble Card. Fix added for PR #1009 by @flobiwankenobi
- [x] Better color handling for lights, now if the light doesn’t supports RGB it will take the accent color instead like the default Home Assistant behavior. #692
- [x] Templating .bubble-name is now instant. #975
- [x] Fixed an issue where some entity_picture url were not displayed.
- [x] New pop-up trigger system based on the same conditional system that Home Assistant use. Not to be confused with the visibility conditions. Note: This is NOT a breaking change, if you previously added a trigger in a pop-up, it will still works, but the editor will not display it anymore and it will be visible in YAML mode only. Then if you decide to use the new system, it will be used instead of your previous trigger. This new feature is based on the code from @MrBearPresident, so thanks again to him for this great new possibility! #332
@Clooos
Copy link
Owner

Clooos commented Dec 12, 2024

This issue should be fixed now! 🤞

https://github.com/Clooos/Bubble-Card/releases/tag/v2.3.1

@Muzza
Copy link
Author

Muzza commented Dec 15, 2024

I appreciate you looking at this, but unfortunately the error has just changed location.
It now changes to say 'a is null'.

Source: components/system_log/__init__.py:331
First occurred: December 12, 2024 at 7:56:13 PM (35 occurrences)
Last logged: 8:47:19 AM

Uncaught error from WebKit 605.1.15 on iOS 18.1.1 TypeError: null is not an object (evaluating 'a.forEach') B (/hacsfiles/Bubble-Card/bubble-card.js:1:33679) /hacsfiles/Bubble-Card/bubble-card.js:1:40656 forEach ([native code]::) N (/hacsfiles/Bubble-Card/bubble-card.js:1:39218) /hacsfiles/Bubble-Card/bubble-card.js:1:139503 updateBubbleCard (/hacsfiles/Bubble-Card/bubble-card.js:1:140183) connectedCallback (/hacsfiles/Bubble-Card/bubble-card.js:1:100313) this (src/scoped-custom-element-registry.js:248:47) appendChild ([native code]::) this.removeChild (src/panels/lovelace/cards/hui-card.ts:276:23)
Uncaught error from WebKit 605.1.15 on iOS 18.1.1 TypeError: undefined is not an object (evaluating 'a.forEach') B (/hacsfiles/Bubble-Card/bubble-card.js:1:33679) /hacsfiles/Bubble-Card/bubble-card.js:1:40656 forEach ([native code]::) N (/hacsfiles/Bubble-Card/bubble-card.js:1:39218) /hacsfiles/Bubble-Card/bubble-card.js:1:139503 updateBubbleCard (/hacsfiles/Bubble-Card/bubble-card.js:1:140183) connectedCallback (/hacsfiles/Bubble-Card/bubble-card.js:1:100313) this (src/scoped-custom-element-registry.js:248:47) appendChild ([native code]::) this.removeChild (src/panels/lovelace/cards/hui-card.ts:276:23)
Uncaught error from WebKit 605.1.15 on iOS 18.1.1 TypeError: null is not an object (evaluating 'a.forEach') B (/hacsfiles/Bubble-Card/bubble-card.js:1:33679) /hacsfiles/Bubble-Card/bubble-card.js:1:40656 forEach ([native code]::) N (/hacsfiles/Bubble-Card/bubble-card.js:1:39218) /hacsfiles/Bubble-Card/bubble-card.js:1:139503 updateBubbleCard (/hacsfiles/Bubble-Card/bubble-card.js:1:140183) connectedCallback (/hacsfiles/Bubble-Card/bubble-card.js:1:100313) this (src/scoped-custom-element-registry.js:248:47) insertBefore ([native code]::) t (src/lit-html.ts:1454:43)
Uncaught error from Firefox 133.0 on Windows 10 TypeError: a is null B (/hacsfiles/Bubble-Card/bubble-card.js:1:33678) N/< (/hacsfiles/Bubble-Card/bubble-card.js:1:40655) N (/hacsfiles/Bubble-Card/bubble-card.js:1:39211) updateBubbleCard/< (/hacsfiles/Bubble-Card/bubble-card.js:1:139502) updateBubbleCard (/hacsfiles/Bubble-Card/bubble-card.js:1:140183) connectedCallback (/hacsfiles/Bubble-Card/bubble-card.js:1:100297) apply (src/scoped-custom-element-registry.js:248:41) this.removeChild (src/panels/lovelace/cards/hui-card.ts:276:11) _updateVisibility (src/panels/lovelace/cards/hui-card.ts:261:9) changedProps.has (src/panels/lovelace/cards/hui-card.ts:218:11)
Uncaught error from Firefox 133.0 on Windows 10 TypeError: a is null B (/hacsfiles/Bubble-Card/bubble-card.js:1:33678) N/< (/hacsfiles/Bubble-Card/bubble-card.js:1:40655) N (/hacsfiles/Bubble-Card/bubble-card.js:1:39211) updateBubbleCard/< (/hacsfiles/Bubble-Card/bubble-card.js:1:139502) updateBubbleCard (/hacsfiles/Bubble-Card/bubble-card.js:1:140183) connectedCallback (/hacsfiles/Bubble-Card/bubble-card.js:1:100297) 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)```

@MrBearPresident
Copy link
Collaborator

Could you try the latest bèta and report back if this solves your issue?

@Clooos
Copy link
Owner

Clooos commented Dec 21, 2024

Could you try the latest bèta and report back if this solves your issue?

No need, I haven't worked on this issue in the lastest beta. But I will do my best for 2025 👌

@Clooos
Copy link
Owner

Clooos commented Dec 22, 2024

I've worked on this new issue but I'm still unable to try this use case.

Could you try this version? You need to remove Bubble Card from HACS first, then install it with the "Without HACS" method.

Once installed, clear your cache then check in the editor if you see v2.3.4.

bubble-card.js.zip

🤞

@Muzza
Copy link
Author

Muzza commented Dec 23, 2024

Still shows an error I'm afraid.

Source: components/system_log/__init__.py:331
First occurred: 9:07:46 PM (1 occurrences)
Last logged: 9:07:46 PM

Uncaught error from Firefox 133.0 on Windows 10 TypeError: a is null B (/local/bubble-card.js:1:33640) N/< (/local/bubble-card.js:1:40534) N (/local/bubble-card.js:1:38906) updateBubbleCard/< (/local/bubble-card.js:1:138999) updateBubbleCard (/local/bubble-card.js:1:139680) connectedCallback (/local/bubble-card.js:1:99919) 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)```

@Clooos
Copy link
Owner

Clooos commented Dec 23, 2024

Thank you for your answer! I will try again! 🫠

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

No branches or pull requests

3 participants