Suddenly my lovelace custom cards stopped working with
Access to script at 'https://unpkg.com/@polymer/lit-element@%5E0.5.2/lit-element.js?module' from origin 'https://xxx.duckdns.org:344444' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
ok well since I didnāt get assistance with his, I went another way, I created scripts for each command and set the buttons to toggle the scriptsā¦
I feel itās not the percfect way, a little indirect, but it worksā¦
I feel a bit stupid to ask but I just switched to Lovelace and trying the different cards. With below I would expect that -when I click the button- the light actually goes on/off and the icon changes from yellow to white and visa versa. However it just shows the state and tapping has no effect. Iāve tried several variations.
This button card is different than the stock button card. They just happen to share the same name. Assuming youāve already declared the use of this custom button card and downloaded the corresponding .js file, Your yaml code should be something like:
Also, since you are only using one entity, you donāt really need to declare a list with the dash (i.e. - switch.fibaro_system_fgwpef_wall_plug_gen5_switch)
Trying to create a button for my alarm_control_panel which has different icons and color depending on the state, but I cant use any icons I want, this for example will only show the correct icon for state āarmed_awayā
But if I change the icon for state āarmed_homeā to mdi:clock it works fine.
I also tried to use shield-home and shield-off on another custom button, same issue there.
So Iām guessing some icons dont work, I thought it might been icons with ā-ā in itās names, but water-percent works, and also window-closed.
To my knowledge, this card doesnāt properly support the changing of the icons based on the state of the entity. It has been requested a couple of times.
As a work around, you could use a conditional card, one for every state, where the main difference is the icon itself. I posted an example of this process earlier in this thread.
I use a different setup that works for me but its a lots of more things into itā¦
The setup I use and it involves input_boolean, input_select and a sensor.
I dont know if its the smartest setup but it works for meā¦ But I have the same problems like youā¦ some of the icons wont work like mdi:shield-lock or mdi:shield-home, they just turn up blank.
Hi, thank you for this awesome Button card. However, could you implement an icon template, please? And I canāt switch off and on group of switches/lights, only toggle. Thanks
I would like to highly recommend an alternative to Button Card, one that is being actively developed, and whose developer is responsive!
Itās a follow-on from Custom UI: Tiles, and is a fully functional and separate LoveLace custom card that follows strongly in its original Tiles roots. It is very customisable and feature rich with what you can do!
Anyway, as a taster, this is what Iāve done with mine:
Found a fix, you need to edit the the button-card.js file.
remove the ā^ā from line 3 in the url (next to the version number 0.5.2)
} from 'https://unpkg.com/@polymer/lit-element@^0.5.2/lit-element.js?module';
becomes
} from 'https://unpkg.com/@polymer/[email protected]/lit-element.js?module';
if this does not fix it for you it is likely because HA has cached the js file. to force it to refresh add or increment the version number in your ui-lovelace.yaml
eg: