iantrich / config-template-card

📝 Templatable Lovelace Configurations
MIT License
434 stars 56 forks source link

Error: No style defined for element #52

Closed mathias-jakobsen closed 2 years ago

mathias-jakobsen commented 3 years ago

Checklist:

Release with the issue: 0.117.5

Last working release (if known):

Browser and Operating System: Microsoft Edge

Description of problem: When config template card is used as an element in a picture-elements card, I get an error saying "No style is defined for element".

Code used:

 - type: "custom:config-template-card"
   entities:
     - "light.bathroom_spotlights"
   element:
     type: image
     image: "${states['light.bathroom_spotlights'].attributes.hs_color ? '/local/floor_plan/bathroom.png?v=51' : '/local/floor_plan/bathroom.png?v=51'}"
     hold_action:
       action: none
     tap_action:
       action: none
   style:
     filter: "${`hue-rotate(${states['light.bathroom_spotlights'].attributes.hs_color ? states['light.bathroom_spotlights'].attributes.hs_color[0] : 0}deg)`} saturate(100%)"
     height: 100%
     left: 50%
     mix-blend-mode: lighten
     opacity: "${states['light.bathroom_spotlights'].attributes.brightness / 255}"
     top: 50%
     width: 100%`

Javascript errors shown in the web inspector (if applicable): element custom:config-template-card Error: No style defined for element at HTMLElement.setConfig (config-template-card.js:3271) at s (chunk.cdf43a32e306acfdb2f4.js:1749) at chunk.cdf43a32e306acfdb2f4.js:1749 at d (chunk.cdf43a32e306acfdb2f4.js:1749) at l (chunk.cdf43a32e306acfdb2f4.js:1749) at pe (chunk.070388aef4afe7ef2d22.js:1049) at n (chunk.070388aef4afe7ef2d22.js:1) at chunk.070388aef4afe7ef2d22.js:1 at Array.forEach () at HTMLElement.setConfig (chunk.070388aef4afe7ef2d22.js:1)

Additional information:

iantrich commented 3 years ago

For now put it at the element level as well. But I don't think all things will work currently as everything will be applied to the config-template-card and not the inner element. So some things like filter will likely not work. Might have to look at this again as I did put it together pretty quickly and didn't test all that much besides placement.

vring0 commented 3 years ago

image Issue has been around for a long time, but hasn't been closed. I took your example from Readme and it doesn't work on my plan. Where is the mistake?

iantrich commented 3 years ago

Try putting your style in the element as well; I'm guessing the config check is more strict now

iantrich commented 2 years ago

fixed in 1.3.4