Closed JunghaJungha closed 2 years ago
Those are all remnants of different trials. The first is simply setting the opacity to the expression, the second tests for the condition, applies the expression if true, or the part after the colon if not. The opacity didn't work with either method. (The ? was an error, but it was tested with $ as well...still didn't work)
I work usually with something like this for the opacity:
opacity: >-
${states['light.flurleuchte_2'].state === 'on' ?
(states['light.flurleuchte_2'].attributes.brightness / 255) : '0'}
@iantrich
So can anyone provide me with a working example?
This should work with 1.3.2
type: picture-elements image: https://demo.home-assistant.io/stub_config/floorplan.png elements: - type: custom:config-template-card style: ...
Tried... now only the component under type: custom:config-template-card
is flickering. Of course, it's better than having everything flickering. But this is not a real "fix", the flickering is there and I can see the blue loading circle for a glimpse of a second.
Is it possible to overwrite the style somehow to disable the "blue loading circle" animation completely? I don't see any benefit in having a blue loading circle animation. Can one add a special "id" or style attribute to overwrite this behaviour? Any ideas?
I will try to Adblock the animation ^^, let's see if this helps.
@ Koendejongh, here is the begining of mine (quite a chore to change everything over). Basically, you have to have a new costom-config-card for each entity. Remember, though, that the transparencies are not working yet.
type: picture-elements 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% style: height: 100% left: 50% mix-blend-mode: lighten opacity: ${ states['sensor.sunlight_opacity'].state } top: 50% width: 100% tap_action: action: none hold_action: action: none - type: custom:config-template-card 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.table_light'].state === 'on' ? (states['light.table_light'].attributes.brightness / 255) :'0'} top: 50% left: 50%
@ Koendejongh, вот и начало моего (довольно утомительно, чтобы все изменить). По сути, у вас должна быть новая карта costom-config-card для каждой сущности. Однако помните, что прозрачные пленки еще не работают.
type: picture-elements 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% style: height: 100% left: 50% mix-blend-mode: lighten opacity: '${ states[''sensor.sunlight_opacity''].state }' top: 50% width: 100% tap_action: action: none hold_action: action: none - type: custom:config-template-card 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'].state === 'on' ? (states['light.couch_light'].attributes.brightness / 255) :'0'} width: 100% top: 50% left: 50%
Very uncomfortable. Is this a temporary solution or are we waiting for a fix?
This is how it needs to be coded now to avoid screen refreshing on state changes (and how it technically should've been done all along). The only thing not working is the opacity for elements as the config-template-card will not currently pull states of entities. There has been a probable fix for this and we're just waiting for it to be implemented.
Hello, I've reformatted my code but am not having any luck getting my LED lights to change according to the color wheel. using the FILTER attribute for light.bulb_2 It works in my pre-fixed dashboard but i rewrote it as requested to get around the page reloading issue.
- title: Floorplan
path: floorplan
panel: true
icon: mdi:floor-plan
type: panel
subview: false
badges: []
cards:
- type: custom:config-template-card
card:
type: picture-elements
image: /local/ui/floorplan/off_day.png
elements:
- type: image
entity: sun.sun
tap_action: none
hold_action: none
state_image:
above_horizon: /local/transparent.png
below_horizon: /local/ui/floorplan/off_night.png
unavailable: /local/ui/floorplan/off_night.png
style:
top: 50%
left: 50%
width: 100%
- type: custom:config-template-card
entity: light.bulb_2
tap_action: none
hold_action: none
state_image:
'on': /local/ui/floorplan/lucas_lamp_on.png
'off': /local/transparent.png
unavailable: /local/transparent.png
style:
filter: >-
${ "hue-rotate(" + (states['light.bulb_2'].attributes.hs_color
? states['light.bulb_2'].attributes.hs_color[0] : 0) + "deg)"}
top: 50%
left: 50%
width: 100%
mix-blend-mode: lighten```
- type: custom:config-template-card
card:
type: picture-elements
image: ...
elements:
...
- type: custom:config-template-card
entity: ...
- type: custom:config-template-card
entity: ...
...
state_image:
...
style:
filter: ...
Here is a correct syntax:
- type: custom:config-template-card
entities:
- ...
element:
type: ...
... rest of other code of this element
picture-elements
card inside CTC:
- type: custom:config-template-card
card:
type: picture-elements
image: ...
Use CTC for particular elements.
style:
filter: >-
${ ... some dependency of some entity ... }
use
card_mod:
style: |
:host {
{% if .... %}
--my-filter: .....;
{% else %}
--my-filter: .....;
{% endif %}
}
style:
filter: var(--my-filter)
Hi,
I have the same problem on my code, but I don't know how to move things to get it works, i've tested to put CTC inside picture-elements but still blinking when time update or light's state change :
`
type: 'custom:config-template-card' entities:
card: ################### Picture Elements Card ##################### type: picture-elements image: /local/ui/floorplan/main_night.png style: | ha-card:first-child { background: rgba(42, 46, 48, 1) } elements:
######################### DAY BASE FLOORPLAN OVERLAY #########################
######################### LIVING #########################
action: none entity: switch.lamp10 hold_action: action: none image: /local/ui/floorplan/lights/lamp10.png style: left: 50% mix-blend-mode: lighten opacity: "${states['switch.lamp10'].state === 'on' ? (states['switch.lamp10'].attributes.brightness / 255) : '0'}" top: 50% width: 100% tap_action: action: none type: image
action: none entity: switch.lamp9 hold_action: action: none image: /local/ui/floorplan/lights/lamp9.png style: left: 50% mix-blend-mode: lighten opacity: "${states['switch.lamp9'].state === 'on' ? (states['switch.lamp9'].attributes.brightness / 255) : '0'}" top: 50% width: 100% tap_action: action: none type: image
action: none entity: switch.lamp8 hold_action: action: none image: /local/ui/floorplan/lights/lamp8.png style: left: 50% mix-blend-mode: lighten opacity: "${states['switch.lamp8'].state === 'on' ? (states['switch.lamp8'].attributes.brightness / 255) : '0'}" top: 50% width: 100% tap_action: action: none type: image
action: none entity: switch.lamp2 hold_action: action: none image: /local/ui/floorplan/lights/lamp2.png style: left: 50% mix-blend-mode: lighten opacity: "${states['switch.lamp2'].state === 'on' ? (states['switch.lamp2'].attributes.brightness / 255) : '0'}" top: 50% width: 100% tap_action: action: none type: image
action: none entity: light.living hold_action: action: none image: /local/ui/floorplan/lights/wled-living.png style: filter: >- ${ "hue-rotate(" + (states['light.living'].attributes.hs_color ? states['light.living'].attributes.hs_color[0] : 0) + "deg)"} left: 50% mix-blend-mode: lighten opacity: "${states['light.living'].state === 'on' ? (states['light.living'].attributes.brightness / 255) : '0'}" top: 50% width: 100% tap_action: action: none type: image
######################### OUTSIDE #########################
action: none entity: switch.lamp3 hold_action: action: none image: /local/ui/floorplan/lights/lamp3.png style: left: 50% mix-blend-mode: lighten opacity: "${states['switch.lamp3'].state === 'on' ? (states['switch.lamp3'].attributes.brightness / 255) : '0'}" top: 50% width: 100% tap_action: action: none type: image
action: none entity: switch.balcony1 hold_action: action: none image: /local/ui/floorplan/lights/balcony1.png style: left: 50% mix-blend-mode: lighten opacity: "${states['switch.balcony1'].state === 'on' ? (states['switch.balcony1'].attributes.brightness / 255) : '0'}" top: 50% width: 100% tap_action: action: none type: image
######################### ENTRANCE #########################
action: none entity: switch.lamp4 hold_action: action: none image: /local/ui/floorplan/lights/4.png style: left: 50% mix-blend-mode: lighten opacity: "${states['switch.lamp4'].state === 'on' ? (states['switch.lamp4'].attributes.brightness / 255) : '0'}" top: 50% width: 100% tap_action: action: none type: image
action: none entity: switch.lamp5 hold_action: action: none image: /local/ui/floorplan/lights/5.png style: left: 50% mix-blend-mode: lighten opacity: "${states['switch.lamp5'].state === 'on' ? (states['switch.lamp5'].attributes.brightness / 255) : '0'}" top: 50% width: 100% tap_action: action: none type: image
######################### CAMERAS POPUP on click #########################
type: icon icon: mdi:cctv style: height: 24px left: 96.3% top: 50.5% width: 24px tap_action: action: call-service service: browser_mod.popup data: size: wide dismissable: true autoclose: false content: camera_view: live type: picture-glance entities: [] camera_image: camera.door1_sub
type: icon icon: mdi:doorbell-video style: height: 24px left: 87% top: 94% width: 24px tap_action: action: call-service service: browser_mod.popup data: size: wide dismissable: true autoclose: false content: camera_view: live type: picture-glance entities: [] camera_image: camera.doorbell_fluent
type: icon icon: mdi:cctv style: height: 24px left: 92% top: 16% width: 24px tap_action: action: call-service service: browser_mod.popup data: size: wide dismissable: true autoclose: false content: camera_view: live type: picture-glance entities: [] camera_image: camera.door2_sub
type: icon icon: mdi:cctv style: height: 24px left: 43% top: 16% width: 24px tap_action: action: call-service service: browser_mod.popup data: size: wide dismissable: true autoclose: false content: camera_view: live type: picture-glance entities: [] camera_image: camera.garage_sub
######################### INDIVIDUAL LIGHT ICONS #########################
entity: switch.lamp10 type: custom:button-card style: left: 51.5% top: 69% template:
entity: switch.lamp9 type: custom:button-card style: left: 44.5% top: 40.5% template:
entity: switch.lamp8 type: custom:button-card style: left: 50.5% top: 40% template:
entity: light.living type: custom:button-card style: left: 49.7% top: 49.9% template:
entity: switch.lamp2 type: custom:button-card style: left: 48.3% top: 61.5% template:
entity: switch.lamp3 type: custom:button-card style: left: 83% top: 59% template:
entity: switch.balcony1 type: custom:button-card style: left: 52.5% top: 79.7% template:
entity: switch.lamp4 type: custom:button-card style: left: 64% top: 44% template:
entity: switch.lamp5 type: custom:button-card style: left: 65% top: 49.5% template:
action: none hold_action: action: none image: /local/ui/sidebar/sidebarBG2.png style: height: 100% left: 11.73828125% top: 50% width: 23.4765625% tap_action: action: none type: image
#################################################################
#################################################################
######################### DATETIME #########################
Can someone help me to modify this code? Thanks!
@Anoxym Using CTC for the whole picture-elements is not recommended. CTC should be used to style a single element.
I am using the floorplan from lukevink. First I am a HA beginner but I did get it to run (Cleaning and Room Control) but I have the flickering issue. I read a lot and I get only (for me) some kind of sh** CTC inside outside picture element inside outside.
Can somebody explain me in easy what I have to do to get ridd of this "reloading" site if light is changing. THX!
The light images I changed it from - action:none to - type: custom:config-template-card (they work) but there are so many - action: none types and I do not know where to start to check?
Hi, it seems since HA version 2021.9.0 the config-template-card fully reloads as soon as any entity has a value change. It worked perfect in previous versions.
I use this card in my floorplan and uses the light entities to update the floorplan.
Since this version, it gives the blue round circles when in loading phase (it did not in previous HA version) and it will reload (disappear and start over again building the card) as soon as it gets triggered by an entity.
Thanks in advance for support.