-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
${card.querySelector()}
not working on initial page load, but works after a state change on any bubble card
#975
Comments
Followup question. Can i set JS variables in the style template and reuse them? |
If i manually fire off a state change of some kind after the elements are on the screen, the items update. I think there is something wrong with how the styles are appended and looking for the |
Video demo showing what is happening: |
hass.states[]
multiple times doesn't work on initial load${card.querySelector()}
not working on initial page load, but works after a state change on any bubble card
Another video showing the delay/timeout it takes for the name to update. Not sure why this is happening, honestly. I have the code pulled down but i don't know how to test it in HA to get an idea of how to fix it. https://drive.google.com/file/d/1gQdOixLgXnOGnwQxbnQahRJqh4JPL6Tq/view?usp=sharing |
Hi! For your error in your previous comment, you don't use the correct class, it's I will check if I can reproduce your initial issue. |
I was able to reproduce it and indeed it was only an issue when |
Yeah I actually solved the class error. |
Nice! Can you possibly reference this issue so I can review what you did update it? I'm really interested how you handled that with the HTMLElement inside of HA. Also, can you add contribution instructions to your readme? I would love to be able to contribute to the project, but I've never built a front-end plug-in for home assistant before. So I don't even know how to get started with contribution or testing in my setup. I'm a frontend developer and would really like to be able to contribute to a cool project in FOSS and this one is pretty cool. |
Indeed I should clarify this, in fact you "just" need to install Webpack to build the sources, there is a config file at the root of the GitHub repo, just use it then you're all good. I've configured it so that it send the updated js file to my HA server each time that I save, I've also disabled the cache in my browser for Home Assistant. And your help would be more than welcome, working on this project just by myself is not always the easiest task! 😃 |
You may want to variabilize that class name or the selector name that you're passing into the query selector function. Then it'll work for whatever you pass into it maybe? |
I don't know, I will not try other ways for now (I'm truly tired, and I will have less time for some days), but don't hesitate to give it a look! If you have any questions, don't hesitate to ask them! 😄 And to be honest I've started Bubble Card as a way to learn JS, I'm not an experienced developer even if I've learned a lot by myself in a year with this project. So some of my approaches are probably not the most optimized ones. |
I will take a look! You've done a great job! |
- [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
The new release is here! Tell me if everything works as it should now 🙂 |
Hi! I had to remove my fix in the new beta as I suspect that it was causing performance issues, I definitely need to find a better fix! Unless you want to help me on this 😁 |
For any feature request you can open a new discussion here:
https://github.com/Clooos/Bubble-Card/discussions/categories/feature-requests
For any question you can open a new discussion here:
https://github.com/Clooos/Bubble-Card/discussions/categories/q-a
Describe the bug
When the same
hass.states[].state
is used multiple times in a style template, the second time doesn't always resolve properly. For example when I try to listen to the do not disturb sensor on my phone, i want to change the bubble button color and set the text for the bubble name to sayQuin is on DND
- This works if i am already on the home assistant dashboard then it works fine, but when i reload the page, the color resolves but the text does not, and it shows my default name variable.*****EDIT --- I think the bug has to do with the
card.querySelector()
and when it is going off. The element isn't selectable on the initial page load. That's why the colors are working but not the nested JS stuff.Expected behavior
*.querySelector()
should work on initial load so that button states and names can be resolved for anything custom that is being overwritten for customizationScreenshots
YAML
Full button code
Informations (please complete the following information):
The text was updated successfully, but these errors were encountered: