config-template-card: Opacity does not work with 2021.9.x
Checklist:
- [x ] I updated to the latest version available
- [x ] I cleared the cache of my browser
Release with the issue: 2021.9.x
Last working release (if known): 2021.8.x
Browser and Operating System: All
Description of problem:
Javascript errors shown in the web inspector (if applicable):
Additional information: Also, the grey circle/oval does not disappear when clicking toggle icon unless you click elsewhere on the screen.
image: /local/floorplan/darkpanel.png
style: |
ha-card:first-child {
background: rgba(42, 46, 48, 1)
}
elements:
- type: custom:config-template-card
variables:
- states['sensor.sunlight_opacity'].state
entities:
- sun.sun
- sensor.sunlight_opacity
element:
type: image
entity: sun.sun
image: /local/floorplan/transp.png
action: none
state_image:
above_horizon: /local/floorplan/lightpanel.png
below_horizon: /local/floorplan/transp.png
style:
left: 50%
mix-blend-mode: lighten
opacity: ${ states['sensor.sunlight_opacity'].state }
style:
height: 100%
left: 50%
mix-blend-mode: lighten
opacity: 10%
top: 50%
width: 100%
tap_action:
action: none
hold_action:
action: none
- type: custom:config-template-card
variables:
COUCHB: states['light.couch_light'].attributes.brightness
entities:
- light.couch_light
element:
type: image
entity: light.couch_light
image: /local/floorplan/transp.png
state_image:
'on': /local/floorplan/transcouch.png
tap_action:
action: none
style:
left: 50%
style:
mix-blend-mode: lighten
opacity: ${ states['light.couch_light'].attributes.brightness / 255 }
width: 100%
top: 50%
left: 50%
- type: custom:config-template-card
entities:
- light.table_light
element:
type: image
entity: light.table_light
image: /local/floorplan/transp.png
state_image:
'on': /local/floorplan/transtablamp.png
tap_action:
action: none
style:
left: 50%
style:
mix-blend-mode: lighten
opacity: >-
${states['light.table_light'].state === 'on' ?
(states['light.table_light'].attributes.brightness / 255) :'0'}
top: 50%
width: 100%
left: 50%
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 29 (11 by maintainers)
I’ll take a look at the PR this weekend
1.3.5 released with @smonesi fix applied
It seems pretty simple…the config-template-card is simply not pulling states for styles. My hope is that @iantrich has just been busy. He’s been pretty on top of this from the start. There are likely many waiting for this. @smonesi, have you heard anything?
I opened a PR that will hopefully fix (and clarify) the situation: https://github.com/iantrich/config-template-card/pull/80
Meanwhile, my simple fix on Home Assistant frontend has been merged (https://github.com/home-assistant/frontend/commit/ff2bf1f3c1230d60348dbd4170e0f6383d80bdcb) so everything should be working as in HA 2021.8 (hopefully starting from 2021.10).
I still hope my PR on
config-template-card(https://github.com/iantrich/config-template-card/pull/80) will be discussed/merged because after I started usingconfig-template-cardinpicture-elements’elements(rather than the opposite,picture-elementsinside a singleconfig-template-card) the overall performance of the dashboard seems improved (since a change in the state of a single entity will no longer force an update of the wholepicture-elements).@read1st I think that it’s easy enough to guide you from here.
(type each single line, press enter, and wait after each line the procedure to be complete before you type the next line. There are four deferent lines with commands there, don’t paste them all together).
You are done!
I found the folder under
C:\Users\(your windows user)\config-template-cardand i followed again the instructions of smonesi in order to replace the file on my HA build.Hope that it helps! Maybe there is an easier way to do it through windows that i m not aware of but i can tell that it worked.
From my experiments, it looks like most of the style attributes (for sure
topandleft, but alsomix-blend-mode,opacityandfilter) work only if applied to the whole card.The only reason I needed to use a style on the element was when I had an image that I wanted to be displayed in a round box and the
border-radius: 100%style only worked on the element.without any intention to be pushy, or unthankful, but do we have any idea ‘IF’ this will be merged? My complete dashboard, is based on this functionality ';D so if it’s not, I should be searching for other solutions.
.
The performance is much better this way. Hopefully @iantrich will merge it this weekend.
@pmentis Thanks! very much appreciated. it works!
It’s actually pretty easy:
If everything goes fine, you will find the
config-template-card.jsfile in thedistdirectory.Hope this helps!
Any idea how long until this gets merged?