Closed andyblac closed 1 year ago
Can you share the relevant main card + custom_field config please? The code has not changed on the custom_fields part on those new versions
This works well:
- type: custom:button-card
variables:
entity: light.test_light
styles:
grid:
- grid-template-areas: "'test' 'icon'"
custom_fields:
test:
card:
icon: mdi:fan
type: custom:button-card
entity: '[[[ return variables.entity; ]]]'
tap_action:
action: more-info
entity: '[[[ return variables.entity; ]]]'
So there's something else going on with your code
BTW, using templates for entity
or show_entity_picture
outside of a custom field doesn't work and has never been possible
- type: "custom:button-card"
template:
- custom_card_andyblac_person
entity: person.christine_leek
variables:
ulm_card_person_entity: person.christine_leek
ulm_card_person_use_entity_picture: false
ulm_card_person_icon: mdi:face-woman
ulm_card_person_battery: sensor.christines_iphone_icloudv3_battery
ulm_address: sensor.christines_iphone_icloudv3_zone_name
ulm_card_person_eta: sensor.christines_iphone_icloudv3_zone_distance
thats the dashbaord code, I have also attached the entier YAML for the template. custom_card_andyblac_person.yaml.zip
BTW this is just tweaked code from the Lovelace Minimalist project, lost of templates are now broken in 4.0 beta.
Yeah, so what you are doing has never been possible, as stated in my last comment, you can't template entity
or show_entity_picture
in the main button-card. This never worked so it's unrelated to the latest beta.
this is strange because it works in 3.5 and Minimalist project use it all over.
show entity picture still works
Yes, but if you look here https://ui-lovelace-minimalist.github.io/UI/usage/cards/card_person/#usage, you'll see they redefine the entity in the main config + on the variables.
And again, show_entity_picture
doesn't support templates (it works magically because the picture exists, else I fall back to the icon)
just like i do in my above code. I used their code as a base.
What is this, then entity: "[[[ return variables.ulm_card_person_entity; ]]]"
in your first post ?
This is not needed entity_picture: "[[[ return variables.ulm_card_person_use_entity_picture ? states[variables.ulm_card_person_entity].attributes.entity_picture\ \ : null ]]]"
as I do it in the code directly (and anyway, it's not templatable)
from the template line 14 and again line 31.
I was speaking about this:
tap_action:
action: "more-info"
entity: "[[[ return variables.ulm_card_person_entity; ]]]"
name: "[[[ return states[variables.ulm_card_person_entity].attributes.friendly_name ]]]"
entity: "[[[ return variables.ulm_card_person_entity; ]]]" # <<<<<<<<< THIS HERE
icon: "[[[ return variables.ulm_card_person_icon; ]]]"
show_entity_picture: "[[[ return variables.ulm_card_person_use_entity_picture ]]]"
entity_picture:
"[[[ return variables.ulm_card_person_use_entity_picture ? states[variables.ulm_card_person_entity].attributes.entity_picture\
\ : null ]]]"
yes exactly the same in there code, line 31
if i comment out the entity from the tap_action everything works as expected, but this then means we can nolonger have a different entity for tap actions ?
Ok, you need to share the full context... and how you instantiate the template else it's impossible to know what we're taking about. Just showing me what you shared initially and not how you use it will make me think you are trying to template the entity
config entry...
i'm not sure, this the code i use with minimalist project. should I report the bug there instead ? I gave you my full code for dashboard and the template import.
Alright, I found the bug now that I understand the context :)
sorry I could not be more help, still learning all this stuff.
:tada: This issue has been resolved in version 4.0.0-dev.16 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
thanks alot fix works, how can I send you a donation ?
You can't :D
hahah, ok, i'll keep trying to help find bugs.
:tada: This issue has been resolved in version 4.0.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
Checklist
Version of the card Version: 4.0b15
Describe the bug
in V3.5 the above code works fine, but in v4.0b12, when you set an entity in the tap_action and then tap on it in the dashboard you see the following error.
in the example above the action entity and the main entity, both use the same entity variable.
Expected behavior it should show the person enity