lovelace-card-templater
lovelace-card-templater copied to clipboard
Issue - only red box - picture-entity
Hi,
I've a picture-entity card and want to change the picture based on its state. This seems to work but if I reload the page, the card only shows a red box. If I change into Lovelace Editview the box becomes visible again (until next refresh) I tested a little bit and I noticed, if I add an additional "normal" picture entity cardto the site, the "custom-picture entity" card becomes visible (also after refresh).
Screenshot after reload:
Screenshot edit mode
Here is my code:
type: 'custom:card-templater'
card:
type: picture-entity
entity: sensor.tonnen
name_template: '{{ states.sensor.tonnen.attributes.days }} days'
show_name: true
show_state: false
state_image:
'0': /hacsfiles/picture/tonnen.png
'1': /hacsfiles/picture/tonnen.png
'2': /hacsfiles/picture/tonnen_grau.png
entities:
- sensor.tonnen
What is the state of the sensor.tonnen sensor normally (i.e. what does it display like in an entities card)?
In my example the state is 0. State for sensor.tonnen could be 0 / 1 / 2 (will changed automatically based on date calculation)
Are there any errors in either home-assistant.log or the browser console when this happens?
Consolse shows only: CARD-TEMPLATER Version 0.0.8
Unfortunately nothing in the log
Screenshot if default picture entity card is added to the view, everything works
I don't see a reference to 'custom:card-templater' in your config, the config should be something like:
type: 'custom:card-templater'
card:
type: picture-entity
entity: sensor.tonnen
name_template: '{{ states.sensor.tonnen.attributes.days }} days'
show_name: true
show_state: false
state_image:
'0': /hacsfiles/picture/tonnen.png
'1': /hacsfiles/picture/tonnen.png
'2': /hacsfiles/picture/tonnen_grau.png
entities:
- sensor.tonnen
Is that what your config looks like?
Yes the config looks exactly same. I also edited my first post, there was a issue with the "insert code" function and the first line "type: 'custom:card-templater'" was not displayed
I tested a little bit:
Custom card on View 1 --> Custom card don't work Add a defafult picture-entity card to view 1 --> Custom card works
Custom Card on View 1 & Default Card on View 2 --> Custom card don't work Change to View2 & Change to View 1 again --> Custom card works
I'm not a developer but it seems a dependency is missing. Hope this helps
Hi I have same issue, red boxes, but give it some time and a refresh, then it works. Btw great work on templater...
Same issue here with my Garbage card;
https://tweakers.net/i/3KcXMzIYSDEaoDUO_vDkeDlFMBg=/full-fit-in/4920x3264/filters:max_bytes(3145728):no_upscale():strip_icc():fill(white):strip_exif()/f/image/OTbE7uSFwpVDGG03DXCuzD3c.jpg?f=user_large
After a refresh it often works; https://tweakers.net/i/PVf80Q1uOCOTNjsQquFNbiBs08w=/full-fit-in/4920x3264/filters:max_bytes(3145728):no_upscale():strip_icc():fill(white):strip_exif()/f/image/rLchPd6jgyQj13haP2imWRkD.jpg?f=user_large
Card code:
card:
cards:
- card:
entity: sensor.papier_2
name_template: |-
{%- if is_state("sensor.papier_2", "0")%}
Vandaag
{% elif is_state("sensor.papier_2", "1")%}
Morgen
{% else %}
{{states.sensor.papier_2.attributes.days }}
dagen
{%- endif %}
show_name: true
show_state: false
state_image:
'0': /local/images/trash_card/papier.png
'1': /local/images/trash_card/papier.png
'2': /local/images/trash_card/papier_bw.png
type: picture-entity
entities:
- sensor.papier_2
type: 'custom:card-templater'
- card:
entity: sensor.gft_rest
name_template: |-
{%- if is_state("sensor.gft_rest", "0")%}
Vandaag
{% elif is_state("sensor.gft_rest", "1")%}
Morgen
{% else %}
{{states.sensor.gft_rest.attributes.days }}
dagen
{%- endif %}
show_name: true
show_state: false
state_image:
'0': /local/images/trash_card/gft_rest.png
'1': /local/images/trash_card/gft_rest.png
'2': /local/images/trash_card/gft_rest_bw.png
type: picture-entity
entities:
- sensor.gft_rest
type: 'custom:card-templater'
- card:
entity: sensor.pmd
name_template: |-
{%- if is_state("sensor.pmd", "0")%}
Vandaag
{% elif is_state("sensor.pmd", "1")%}
Morgen
{% else %}
{{states.sensor.pmd.attributes.days }}
dagen
{%- endif %}
show_name: true
show_state: false
state_image:
'0': /local/images/trash_card/pmd.png
'1': /local/images/trash_card/pmd.png
'2': /local/images/trash_card/pmd_bw.png
type: picture-entity
entities:
- sensor.pmd
type: 'custom:card-templater'
type: horizontal-stack
type: 'custom:mod-card'
I have the exact same issue with a gauge card.
@Diamant80 @klint76 @Meelobee @JonasPed Can you please make sure you are updated to the latest version of the card, 0.0.12, and see if it works now? I discovered that I was using an older version of a library, which would cause issues, and 0.0.12 uses the latest version of the library which should fix it.
It seems to have fixed the issue, but now the days aren't updating for my garbage days.
On Tue, 21 Jul 2020, 2:44 pm Steven Rollason, [email protected] wrote:
@Diamant80 https://github.com/Diamant80 @klint76 https://github.com/klint76 @Meelobee https://github.com/Meelobee @JonasPed https://github.com/JonasPed Can you please make sure you are updated to the latest version of the card, 0.0.12, and see if it works now? I discovered that I was using an older version of a library, which would cause issues, and 0.0.12 uses the latest version of the library which should fix it.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gadgetchnnel/lovelace-card-templater/issues/16#issuecomment-661667867, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKT75N47FZLUIYDLCMYHPSLR4U2NRANCNFSM4LRW2TBA .
Sorry, just took time to update. All good so far. Will keep you updated. Great work thanks
Klint
On Tue, 21 Jul 2020, 2:44 pm Steven Rollason, [email protected] wrote:
@Diamant80 https://github.com/Diamant80 @klint76 https://github.com/klint76 @Meelobee https://github.com/Meelobee @JonasPed https://github.com/JonasPed Can you please make sure you are updated to the latest version of the card, 0.0.12, and see if it works now? I discovered that I was using an older version of a library, which would cause issues, and 0.0.12 uses the latest version of the library which should fix it.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gadgetchnnel/lovelace-card-templater/issues/16#issuecomment-661667867, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKT75N47FZLUIYDLCMYHPSLR4U2NRANCNFSM4LRW2TBA .
It seems to have fixed the issue, but now the days aren't updating for my garbage days. … On Tue, 21 Jul 2020, 2:44 pm Steven Rollason, @.***> wrote: @Diamant80 https://github.com/Diamant80 @klint76 https://github.com/klint76 @Meelobee https://github.com/Meelobee @JonasPed https://github.com/JonasPed Can you please make sure you are updated to the latest version of the card, 0.0.12, and see if it works now? I discovered that I was using an older version of a library, which would cause issues, and 0.0.12 uses the latest version of the library which should fix it. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#16 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKT75N47FZLUIYDLCMYHPSLR4U2NRANCNFSM4LRW2TBA .
having the same issue described. v0.0.13 used
In my environment everything is working totally fine 👍