Hi guys, I have a problem with the button card and I hope you can help me. Here is the very simple code that is giving me some trouble.
type: custom:button-card
entity: sensor.ir_studio
icon: mdi:raspberry-pi
aspect_ratio: 1/1
name: IR Studio
styles:
card:
- border-radius: 10%
- padding: 10%
- color: ivory
- font-size: 10px
- text-shadow: 0px 0px 5px black
- text-transform: capitalize
grid:
- grid-template-areas: '"i esc" "n n" "status status"'
- grid-template-columns: 1fr 1fr
- grid-template-rows: 1fr min-content min-content
name:
- font-weight: bold
- font-size: 13px
- color: white
- align-self: middle
- justify-self: start
- padding-bottom: 4px
img_cell:
- justify-content: start
- align-items: start
- margin: none
custom_fields:
esc:
- align-self: start
- justify-self: end
status:
- padding-bottom: 2px
- align-self: middle
- justify-self: start
- '--text-color-sensor': '[[[ if (states["sensor.raspbcpu"].state < 80) return "red"; ]]]'
custom_fields:
esc: |
[[[
return `<span>${sensor.ir_studio}</span>`
]]]
status: |
[[[
return `<span></span>`
]]]
and this is the error on the screen
uttonCardJSTemplateError: ReferenceError: sensor is not defined in 'return `<span>${sensor.ir_studio}</span>`'
sensor.ir_studio is an entity present in the system that works well.
Any ideas?