custom-cards / button-card

❇️ Lovelace button-card for home assistant
MIT License
1.83k stars 227 forks source link

entity variable is undefined name JS template despite card having valid entity configured #818

Closed CalamarBicefalo closed 6 months ago

CalamarBicefalo commented 6 months ago

Checklist

Describe the bug The entity object is undefined in a javascript template in the name attribute even though:

Version of the card Version: 4.1.1

To Reproduce This is the configuration I used:

type: "custom:button-card"
template: card_title
entity: "[[[ return 'input_select.'+variables.room_key+'_activity' ]]]"
name: [[[ return entity.state ]]]
CalamarBicefalo commented 6 months ago

That was in the custom_fields section of a template definition.

Adding the entity to the parent card solved the problem